Solve the permission problem that docker needs to enter sudo every time

 

Every time you use the docker command, you must add sudo permissions, otherwise it will report

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.38/images/json: dial unix /var/run/docker.sock: connect: permission denied

Let's add permissions

1. Enter

$ sudo groupadd docker
Back to displaygroupadd: group 'docker' already exists

2. Give permissions to the docker account

sudo gpasswd -a <你的用户名> docker
E.g: sudo gpasswd -a caoft docker

3. Restart docker

sudo service docker restart

 

 

 

78 original articles published · 32 praised · 120,000 views

Guess you like

Origin blog.csdn.net/caofengtao1314/article/details/104512211