
普通用户使用docker
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 usingsudo
. The Docker daemon always runs as theroot
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.
引用自官方文档
问题说明
普通用户在使用docker时候报错,提示权限不足,导致docker功能无法正常使用,此文章将解决该问题
解决步骤
创建 docker 用户组( 一般安装docker已经存在 )
sudo groupadd docker
添加当前用户( 如果想要添加其他用户修改 $USER 位置为对应的用户名就好 )到 docekr 组
sudo usermod -aG docker $USER
重启系统后普通用户即可使用 docker ,如果不想重启直接使用,可以使用以下命令
newgrp docker
再次执行 docker info 命令进行验证
本文是原创文章,完整转载请注明来自 夏夜
评论
匿名评论
隐私政策
你无需删除空行,直接评论以获取最佳展示效果