简体   繁体   中英

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

以超级用户身份运行可以达到以下目的:

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM