I have been geting prepped to build the OpenShift origin codebase on Centos 7. I started from a fairly minimal VM which did not have docker or Development Tools installed. Once I thought I had all the prerequisites, I kicked off the build and got
Cannot connect to the Docker daemon. Is the docker daemon running on this host? |
This seems to be due to the fact that the ayoung user does not have permissions to read/write on the domain socket. /var/run/docker.sock
$ ls -la /var/run/docker.sock srw-rw----. 1 root root 0 Aug 9 09:03 /var/run/docker.sock |
Enough other stuff seems to discuss this as well. How can we set up for non-root and non-sudo access to docker?
On my Fedora system, I have:
$ ls -la /var/run/docker.sock srw-rw----. 1 root docker 0 Aug 7 09:01 /var/run/docker.sock |
I set this up long enough ago that I do not remember if I was the one that did this, or if it was a configuration setup by some other package. The docker group has a pretty random ID:
$ getent group docker docker:x:14372:ayoung |
So I probably did that.
Back to the VM:
sudo groupadd docker sudo chown root:docker /var/run/docker.sock sudo usermod -aG docker ayoung |
I exited out and logged back in:
$ groups
ayoung wheel docker |
And it worked. Will the socket stay that way? Hmm. After the build completes, I’ll reboot the VM and see what we have.
Yes it did. Is there a better way to do this? Let me know if you do.
Per this doc it’s the way to do
https://docs.docker.com/engine/installation/linux/linux-postinstall/#manage-docker-as-a-non-root-user
Yep, and I followed that if you compare the two, but RPMs and the Red Hat based deployments tend to manage those kind of things; you can end up breaking assumptions used by other systems if you deviate from the package managed way to set up permissions etc. That was my real concern.