Unable to pull image from GitHub Container Registry (GHCR)

10.7k views Asked by At

For the past two days, I haven't been able to pull any images from the GitHub Container Registry (GHCR). This issue occurs with both public and private images. I have tried using both CMD and Windows Terminal, but without success. However, I am able to pull images normally from the Docker Hub.

The command I use is this:

docker pull ghcr.io/someorg/someimage:sometag

and the error I get is this:

Error response from daemon: Head "https://ghcr.io/v2/someorg/someimage/manifests/sometag": denied: denied

It only states "denied" without offering any explanation regarding the reason. After extensive searching, all I found was an issue on GitHub which stated that it was a platform issue that had been resolved.

2

There are 2 answers

0
Andreas Violaris On BEST ANSWER

Since the images you are trying to pull are public and you get that error, it is safe to assume that you are logged in with an access token that no longer exists (because you probably deleted it or it expired).

Given this, you have to remove login credentials for ghcr.io using the following command:

docker logout ghcr.io

and either log in again with an existing access token or don't log in at all.

The pull command should then work.

0
stevec On

I got a similar error when pulling a private package:

docker pull ghcr.io/user/image-name:latest
Error response from daemon: Head "https://ghcr.io/v2/user/image-name/manifests/latest": unauthorized

To login to ghcr.io

docker login ghcr.io -u username -p accesstoken

Replace username with your github username, and password (GitHub personal access token) is obtained by going here -> Generate New Token -> Classic. And selecting repos and packages permissions:

enter image description here

Now docker pull will succeed.