sarovo
sarovo

Reputation: 575

Unable to pull image from GitHub Container Registry (GHCR)

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.

Upvotes: 47

Views: 35116

Answers (3)

skolima
skolima

Reputation: 32714

It seems ghcr.io does enforce authentication on some pull/images. I was finally able to authenticate by going to my Docker Hub account and connecting it to my GitHub account as instructed in https://app.docker.com/settings/connected-accounts .

Upvotes: 0

stevec
stevec

Reputation: 52708

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.

Upvotes: 20

Andreas Violaris
Andreas Violaris

Reputation: 4178

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.

Upvotes: 94

Related Questions