<p>I have a setup where docker ONLY works as root (I know, my fault). I'm trying to follow the GCR quickstart: [1]. I can't find anything on the troubleshooting page [2] either.</p>

<p>Can you help me (and I can then file a document fix)?</p>

<p>[1] <a href="https://cloud.google.com/container-registry/docs/quickstart" rel="nofollow noreferrer">https://cloud.google.com/container-registry/docs/quickstart</a>
[2] <a href="https://cloud.google.com/container-registry/docs/support/troubleshooting" rel="nofollow noreferrer">https://cloud.google.com/container-registry/docs/support/troubleshooting</a></p>

<h1>Repro</h1>

<p>Reproduction steps (also in b/68796816):</p>

<pre><code>$ docker -v
Docker version 1.6.2, build 7c8fca2
ricc@rubino:~/git/gce-recipes/gke/quickstart-image$ sudo docker run busybox date
Thu Nov  2 12:29:35 UTC 2017
$ sudo docker tag quickstart-image gcr.io/ric-cccwiki/quickstart-image 
# All good so far ...
</code></pre>

<p>Option 1 (no sudo):</p>

<pre><code># no sudo: docker doesn't work
$ gcloud docker -- push gcr.io/ric-cccwiki/quickstart-image
FATA[0000] Post http:///var/run/docker.sock/v1.18/images/gcr.io/ric-cccwiki/quickstart-image/push?tag=: dial unix /var/run/docker.sock: permission denied. Are you trying to connect to a TLS-enabled daemon without TLS? 
</code></pre>

<p>Option 2: with sudo:</p>

<pre><code># docker works but gcloud is not found
$ sudo gcloud docker -- push gcr.io/ric-cccwiki/quickstart-image
sudo: gcloud: command not found
</code></pre>

<p>Neither way works</p>

<p>There are a few options, the best being to just make docker usable without root: <a href="https://docs.docker.com/engine/installation/linux/linux-postinstall/" rel="nofollow noreferrer">https://docs.docker.com/engine/installation/linux/linux-postinstall/</a></p>

<p><strong>Option 1: Specify your full path to gcloud when using it.</strong></p>

<pre><code>sudo $(which gcloud) 
</code></pre>

<p><strong>Option 2: Install glcoud as root</strong></p>

<pre><code>sudo su
#install gcloud
gcloud version
</code></pre>

<p>However, the best thing to do is to just use docker as non-root :)</p>
