docker非root用户权限运行

本文指导如何在不使用sudo的情况下,让非root用户在Linux(如Ubuntu)上运行Docker。按照官方教程,创建一个名为docker的Unix组,并将用户添加到该组,使用户能够访问Docker守护进程的Unix套接字。注意,加入docker组会赋予用户root等效权限,可能影响系统安全性。此外,介绍了Docker的非root模式(Rootless模式),但这是实验性特性。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

运行dokcer命令时需要使用sudo权限,如果想要不是用sudo运行docker命令,可参考官网教程:

https://docs.docker.com/engine/install/linux-postinstall/

搬运如下!

Manage Docker as a non-root user

The Docker daemon binds to a Unix socket instead of a TCP port. By default that Unix socket is owned by the user root and other users can only access it using sudo. The Docker daemon always runs as the root user.

If you don’t want to preface the docker command with sudo, create a Unix group called docker and add users to it. When the Docker daemon starts, it creates a Unix socket accessible by members of the docker group.

Warning

The docker group grants privileges equivalent to the root user. For d

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值