普通用户docker不再用sudo

切换机器多次忘记,仅以此记录

创建用户组

sudo groupadd docker

添加当前用户

sudo usermod -aG docker ${USER}

查看效果

docker run hello-world

如果成功运行并且弹出

WARNING: Error loading config file: /home/jsk/.docker/config.json: stat /home/jsk/.docker/config.json: permission

可通过修改owner,添加权限

sudo chown "$USER":"$USER" /home/"$USER"/.docker -R
sudo chmod g+rwx "$HOME/.docker" -R

参考链接https://www.digitalocean.com/community/questions/how-to-fix-docker-got-permission-denied-while-trying-to-connect-to-the-docker-daemon-socket

 

 

相关推荐