Docker
GHCR
error handling
authentication issue
container registry

Docker error from daemon: Get https://ghcr.io/v2/: denied: denied

Codemia Knowledge Hub ·

"Error response from daemon: Get https://ghcr.io/v2/: denied: denied" means the GitHub Container Registry (GHCR) refused Docker's request, usually when pulling an image. The most common cause is that Docker is not authenticated with GHCR, or the credentials lack permission for the image. Logging in with a GitHub personal access token that has the right package scopes typically fixes it.

Reading the error message

  • Error response from daemon: The Docker daemon, the background service that manages images, containers, networks, and volumes, is reporting the error.
  • Get https://ghcr.io/v2/: The URL the daemon tried to access. ghcr.io is the GitHub Container Registry domain.
  • denied: denied: The request was not authorized. The repeated word just emphasizes that access was refused.

Causes of the ghcr.io denied error

  1. Authentication issues:
    • Docker is not properly authenticated with GHCR.
    • Login credentials are missing or incorrect.
  2. Insufficient permissions:
    • The Docker user lacks permission to access private container images in GHCR.
    • Permissions are usually controlled through GitHub repository settings.
  3. Network problems:
    • Connectivity issues are blocking access to GHCR.
  4. Outdated Docker version:
    • Older Docker versions may not support the authentication methods modern registries use.

Authenticating Docker with GHCR

You need a GitHub personal access token (PAT).

Generate a personal access token

  • Go to GitHub > Profile > Settings > Developer settings > Personal access tokens.
  • Generate a new token (classic) with the scopes needed for GHCR, typically read:packages and write:packages. GitHub Packages only accepts classic personal access tokens.

Log in with the token

bash
export CR_PAT=YOUR_TOKEN
echo $CR_PAT | docker login ghcr.io -u USERNAME --password-stdin

Use your GitHub username for USERNAME. Docker prints Login Succeeded, and pulls of images you have access to then work.

Rule out network issues

  • Confirm that your network can reach ghcr.io.
  • Check whether firewall settings are blocking the connection.

Course
Beginner
27 lessons
10 hours
System Design Fundamentals

Build a strong foundation in designing scalable, reliable distributed systems.

View the course
System Design practice on Codemia

Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.

Practice system design