If you get the following error: “Error response from daemon: Head <repo-url>: unauthorized” this likely means like either you do not have the permission to access the repository or you need to login with docker before pulling the image.

Step 1: docker login ghcr.io -u

This will give you a prompt to enter your password:

Password: <insert your personal access token here>

Where to get your personal access token for Github?

“In the upper-right corner of any page, click your profile photo, then click Settings. In the left sidebar, click Developer settings. In the left sidebar, click Personal access tokens. Click Generate new token.” from https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token

At the moment of writing the format of the token starts prefixed by “ghp_”. I would recommend setting a short expiry time and limited permission as a safety precaution in case the personal access token is leaked for any reason.

How to know that login is successful?

If you get “Error response from daemon: Get “https://ghcr.io/v2/”: denied: denied” this likely means that you have set the wrong password (or no permission to the repo).

But in case the login is successful you will get “Login Succeeded”. You should then be able to pull your docker images.

Finally, if you want to login without a prompt you could also run:

docker login -u your_github_username -p your_personal_access_token https://ghcr.io