首页 > 系统服务 > 详细

Add User To Docker Group In Ubuntu Linux

时间:2020-07-16 00:37:42      阅读:68      评论:0      收藏:0      [点我收藏+]

Add User To Docker Group In Ubuntu Linux

By default, the docker command should run with root privileges. To run Docker as a non-root user in Ubuntu, you have to add the user to the docker group. Otherwise, you will receive an error.

Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.40/containers/json: dial unix /var/run/docker.sock: connect: permission denied

First check if the docker group already exists on your Ubuntu system:

grep docker /etc/group
技术分享图片

If the group already in there, add the user to the docker group using the usermod command.

usermod -aG docker user_name

Make sure you replace the user_name with your own. To add yourself (the current logged in user), run:

usermod -aG docker $USER

The user needs to Log out and log back into the Ubuntu server so that group membership is re-evaluated. After that the user will be able to run Docker commands without using root or sudo.

If the group does not exist, Create the docker group:

sudo groupadd docker

And restart the docker service:

sudo systemctl restart docker

Add User To Docker Group In Ubuntu Linux

原文:https://www.cnblogs.com/mouseleo/p/13310170.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!