Reputation: 470
I was trying to build kubernetes from source: https://github.com/GoogleCloudPlatform/kubernetes/blob/master/docs/getting-started-guides/binary_release.md#building-from-source
I have docker installed on my ubuntu.
royalharsh95@ubuntu:~$ sudo docker version
Client version: 1.0.1
Client API version: 1.12
Go version (client): go1.2.1
Git commit (client): 990021a
Server version: 1.0.1
Server API version: 1.12
Go version (server): go1.2.1
Git commit (server): 990021a
I tried after sudo service docker start
but got the same error.
royalharsh95@ubuntu:~$ cd kubernetes
royalharsh95@ubuntu:~/kubernetes$ make release
build/release.sh
+++ Verifying Prerequisites....
Can't connect to 'docker' daemon. please fix and retry.
Possible causes:
- On Mac OS X, boot2docker VM isn't installed or started
- On Mac OS X, docker env variable isn't set appropriately. Run:
$(boot2docker shellinit)
- On Linux, user isn't in 'docker' group. Add and relogin.
- Something like 'sudo usermod -a -G docker royalharsh95'
- RHEL7 bug and workaround: https://bugzilla.redhat.com/show_bug.cgi?id=1119282#c8
- On Linux, Docker daemon hasn't been started or has crashed
make: *** [release] Error 1
Upvotes: 2
Views: 4225
Reputation: 312263
The problem you are experiencing is caused by the fact that you are unable to access the Docker socket /var/run/docker.sock
as a non-root user. When you run sudo docker version
you are running the Docker client as root so it does not experience this problem.
This is a basic Unix permissions problem and there are the standard solutions:
root
with sudo make release
.sudo
.If you look at the permissions on the Docker socket, you will probably see something like:
$ ls -l /var/run/docker.sock /var/run/docker.sock
srw-rw----. 1 root docker 0 Mar 17 12:26 /var/run/docker.sock
This shows a socket that is readable by root
and by members of the docker
group. In this case, I am a member of the docker
group so I can run the docker
client without sudo
. You could set up the same thing in your environment.
Note that of course you always need to start the Docker daemon as root, but in general you would expect to have this configured to start automatically when your system boots, rather than starting it manually.
Upvotes: 4