<p>I was trying to build kubernetes from source: 
<a href="https://github.com/GoogleCloudPlatform/kubernetes/blob/master/docs/getting-started-guides/binary_release.md#building-from-source" rel="nofollow">https://github.com/GoogleCloudPlatform/kubernetes/blob/master/docs/getting-started-guides/binary_release.md#building-from-source</a></p>

<p>I have docker installed on my ubuntu.</p>

<pre><code>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
</code></pre>

<p>I tried after <code>sudo service docker start</code> but got the same error.</p>

<pre><code>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
</code></pre>

<p>The problem you are experiencing is caused by the fact that you are unable to access the Docker socket <code>/var/run/docker.sock</code> as a non-root user.  When you run <code>sudo docker version</code> you are running the Docker client <em>as root</em> so it does not experience this problem.</p>

<p>This is a basic Unix permissions problem and there are the standard solutions:</p>

<ul>
<li>You could run the Kubernetes build as <code>root</code> with <code>sudo make release</code>.</li>
<li>You can fix the permissions on the socket such that you are able to use Docker without <code>sudo</code>.</li>
</ul>

<p>If you look at the permissions on the Docker socket, you will probably see something like:</p>

<pre><code>$ ls -l /var/run/docker.sock /var/run/docker.sock
srw-rw----. 1 root docker 0 Mar 17 12:26 /var/run/docker.sock
</code></pre>

<p>This shows a socket that is readable by <code>root</code> and by members of the <code>docker</code> group.  In this case, I am a member of the <code>docker</code> group so I can run the <code>docker</code> client without <code>sudo</code>.  You could set up the same thing in your environment.</p>

<p>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.</p>
