Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock
[问题解决]Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock
写了一个脚本读取docker日志,发生报错:Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock
有不少方法,
1、用sudo执行脚本
2、将用户添加进docker用户
sudo usermod -aG docker ${USER}
但是这几种方法对我来说不怎么适用:
经过搜索,发现
https://stackoverflow.com/questions/47854463/got-permission-denied-while-trying-to-connect-to-the-docker-daemon-socket-at-uni
这个回答里面的第二个答案,对我来说有用。
sudo chmod 777 /var/run/docker.sock