clairctl: Got permission denied while trying to connect to the Docker daemon socket
In the clairctl service, I executed the commands:
$ clairctl pull ubuntu:16.04
$ clairctl --log-level debug push ubuntu:16.04 --local
The pull request works fine, but the push request fails and produces the following error message:
2017-07-06 19:15:21.850610 C | cmd: retrieving manifest for "ubuntu:16.04": cannot save image ubuntu:16.04: 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.24/images/get?names=ubuntu%3A16.04: dial unix /var/run/docker.sock: connect: permission denied
I get a similar error if, in the clairctl service, I execute the command docker run hello-world; not a good sign. Clairctl needs to add user(s) to the docker group to avoid this error.
About this issue
- Original URL
- State: open
- Created 7 years ago
- Comments: 32 (5 by maintainers)
This is what worked for me:
sudo chmod 666 /var/run/docker.sockseems you are running docker on user mode than root. I had faced the same problem earlier.
Run chmod for /var/run/docker.sock. for ex chmod 777 /var/run/docker.sock. This should solve ur problem .
I got the same issue on Ubuntu 17.10. The fix was simple: add yourself to the docker group:
sudo usermod -aG docker [your_user_name]Then, you need to reboot, because group membership is somehow cached on linux.
While
sudo chmod 666 /var/run/docker.sockis helping, you need to be aware that this allows any user/non-root-process access the docker socket which can completely compromise your system.I suggest using this flag instead:
--group-add=$(getent group docker | cut -d: -f3)This will work when the following conditions are met:
dockergroup is created;/var/run/docker.socksocket file is owned by thedockergroup;/var/run/docker.socksocket file hasrwflag for the group;If relogin after adding to docker group was unsuccessful, its not necessary to reboot your system or changing
/var/run/docker.sockfile mod, trysudo service docker restartto restart docker serviceI find as well that I can run
But with a colon in the image name: