When working with Docker, you might encounter the following error while pulling an image:
Error response from daemon: pull access denied for <image>, repository does not exist or may require 'docker login': denied: requested access to the resource is denied
This is a common error that can confuse beginners and experienced developers alike. Let’s break down why it happens and how to fix it.
1️⃣ Why This Error Happens
There are three main reasons why you’ll see this error:
- The image name is incorrect
- A typo or wrong repository name means Docker Hub (or another registry) can’t find it.
- Example: Running
docker pull ubunutinstead ofubuntu.
- The image is private
- If the repository is private, you need to log in before pulling it.
- Example:
docker pull mycompany/appfails unless you have access.
- You are not logged in to the correct registry
- If the image is hosted in Docker Hub, AWS ECR, GCP Artifact Registry, or GitHub Packages, you must authenticate with the correct credentials.
2️⃣ How to Fix It
✅ Step 1: Check the Image Name
Make sure the image name and tag are correct.
docker pull ubuntu:20.04
If you don’t specify a tag, Docker defaults to :latest.
✅ Step 2: Log In to Docker Hub (or Other Registry)
If the image is private, log in:
docker login
Enter your Docker Hub username and password (or access token).
For other registries:
- Amazon ECR:
aws ecr get-login-password | docker login ... - Google Artifact Registry:
gcloud auth configure-docker - GitHub Packages:
docker login ghcr.io
✅ Step 3: Use the Correct Registry URL
If the image is not on Docker Hub, you must specify the full registry path.
Example for AWS ECR:
docker pull <aws_account_id>.dkr.ecr.<region>.amazonaws.com/myapp:latest
Example for GitHub Packages:
docker pull ghcr.io/username/repo:tag
✅ Step 4: Verify Access to Private Repository
If you’re part of an organization, make sure your account has been granted permission to pull the image.
3️⃣ Example Scenarios
- Typo in image name
docker pull ubunut # ❌ wrong docker pull ubuntu # ✅ correct - Private image on Docker Hub
docker login docker pull myusername/private-repo - AWS ECR image
aws ecr get-login-password --region us-east-1 \ | docker login --username AWS --password-stdin <account_id>.dkr.ecr.us-east-1.amazonaws.com docker pull <account_id>.dkr.ecr.us-east-1.amazonaws.com/myapp:latest
📌 Summary
The error:
pull access denied, repository does not exist or may require docker login
Usually means:
- ❌ Wrong image name
- 🔒 Private repository requiring authentication
- 🔑 Missing login credentials for custom registry
✅ Double-check the image name, ensure you’re logged in, and include the full registry URL if needed.
With these fixes, you should be able to pull your Docker images successfully.