3
votes

I am getting a permission denied error message when pulling a docker image from the Google Cloud Container Registry, in a Compute Engine VM:

gcloud docker pull -- gcr.io/your-project-id/example-image

Results in:

FATA[0000] Post http:///var/run/docker.sock/v1.18/images/create?fromImage=gcr.io%2Fyour-project-id%2Fexample-image%3Alatest: dial unix /var/run/docker.sock: permission denied. Are you trying to connect to a TLS-enabled daemon without TLS?

I got the "gcloud docker pull" command from a sample and the docs: https://cloud.google.com/container-registry/docs/pulling

2

2 Answers

2
votes

Running as super user did the trick:

sudo gcloud docker pull -- gcr.io/your-project-id/example-image
0
votes

Adding user to docker group worked for me. Added benefit is that, after adding the user to docker group, you will not have to use sudo along with docker commands.

sudo usermod -a -G docker ${USER}
Note: It requires a machine restart

Now you can use docker pull
gcloud docker pull -- gcr.io/your-project-id/example-image

https://cloud.google.com/container-registry/docs/support/troubleshooting