解决非root用户使用docker的办法

栏目: 编程工具 · 发布时间: 5年前

内容简介:通常我们使用Docker的时候都是使用的root,官方说法如下:下面是使用非root用户操作的步骤:1、创建docker组

通常我们使用 Docker 的时候都是使用的root,官方说法如下:

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 access it with sudo. For this reason, docker daemon always runs as the root user.   To avoid having to use sudo when you use the docker command, create a Unix group called docker and add users to it. When the docker daemon starts, it makes the ownership of the Unix socket read/writable by the docker group.

下面是使用非root用户操作的步骤:

1、创建docker组

sudo groupadd docker

2、将当前用户加入docker组

sudo gpasswd -a ${USER} docker

3、重新启动docker服务(下面是CentOS7的命令)

sudo service docker restart 或 sudo systemctl restart docker

4、当前用户退出系统重新登陆


以上所述就是小编给大家介绍的《解决非root用户使用docker的办法》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

The Cult of the Amateur

The Cult of the Amateur

Andrew Keen / Crown Business / 2007-6-5 / USD 22.95

Amateur hour has arrived, and the audience is running the show In a hard-hitting and provocative polemic, Silicon Valley insider and pundit Andrew Keen exposes the grave consequences of today’s......一起来看看 《The Cult of the Amateur》 这本书的介绍吧!

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

在线进制转换器
在线进制转换器

各进制数互转换器

图片转BASE64编码
图片转BASE64编码

在线图片转Base64编码工具