IAmCoder
IAmCoder

Reputation: 3442

Permission denied when pulling Docker image from Google Cloud Container Registry

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

Upvotes: 7

Views: 8360

Answers (2)

Anurag
Anurag

Reputation: 916

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

Upvotes: 5

IAmCoder
IAmCoder

Reputation: 3442

Running as super user did the trick:

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

Upvotes: 4

Related Questions