How to fix denied: requested access to the resource is denied in Docker

DockerBEGINNERLOWUpdated Dec 6, 2025ยท 225 views

The 'requested access to the resource is denied' error occurs when pushing a Docker image to a registry. This typically happens because the image is not tagged with your Docker Hub username, you are not logged in, or you are trying to push to a repository you do not own.

Quick fix

Fixes denied: requested access to the resource is denied

# Check your current image name
docker images

# Tag the image with your username
docker tag myimage:latest YOUR_DOCKERHUB_USERNAME/myimage:latest

# Now push the correctly tagged image
docker push YOUR_DOCKERHUB_USERNAME/myimage:latest
  1. Tag your image with your Docker Hub username
  2. Log in to Docker Hub
  3. Log out and log back in
  4. Verify your email address
docker โ€” error
# Check your current image name
docker images
# Tag the image with your username
docker tag myimage:latest YOUR_DOCKERHUB_USERNAME/myimage:latest
# Now push the correctly tagged image
docker push YOUR_DOCKERHUB_USERNAME/myimage:latest
denied: requested access to the resource is denied

What this error means

This error message appears when Docker attempts to push an image to a container registry (like Docker Hub) but the operation is rejected by the registry. The registry denies access for several reasons related to authentication or authorization. The most common cause is that the image is not properly tagged with your Docker Hub namespace (username). Docker Hub requires images to be named in the format `username/imagename:tag`. If you try to push an image without your username in the tag, Docker Hub does not know which account should own the image and denies the request. Additionally, this error occurs if: 1. **You are not logged in** - The Docker client has not authenticated with the registry 2. **Session expired** - Your login credentials have become stale or corrupted 3. **Wrong namespace** - You are trying to push to a repository owned by another user or organization 4. **Private repository limits** - You have exceeded your free tier limit for private repositories

Typical symptoms

  • Docker push commands fail with 'denied: requested access to the resource is denied'
  • Push works for some images but not others
  • CI/CD pipeline fails at the docker push step
  • Error occurs after 'docker build' succeeds
  • Login appears successful but push still fails
  • Error message appears immediately without progress indicators

Common causes

  1. Image not tagged with your Docker Hub username (most common cause)
  2. Not logged in to Docker Hub or the target registry
  3. Login session expired or credentials corrupted
  4. Trying to push to a repository owned by another user or organization
  5. Email address not verified on Docker Hub account
  6. Exceeded private repository limit on Docker Hub free tier
  7. Using 'docker push' without matching 'docker login' (with/without sudo)
  8. Typo in Docker Hub username when tagging the image
  9. Pushing to wrong registry (e.g., omitting registry URL for private registries)

How to fix "denied: requested access to the resource is denied"

1Tag your image with your Docker Hub username

The most common fix is to tag your image with your Docker Hub username as the namespace. Docker Hub requires images to follow the format username/image:tag.

bash
# Check your current image name
docker images

# Tag the image with your username
docker tag myimage:latest YOUR_DOCKERHUB_USERNAME/myimage:latest

# Now push the correctly tagged image
docker push YOUR_DOCKERHUB_USERNAME/myimage:latest

Replace YOUR_DOCKERHUB_USERNAME with your actual Docker Hub username. You can find your username by logging into hub.docker.com.

2Log in to Docker Hub

Ensure you are authenticated with Docker Hub before pushing:

bash
# Log in to Docker Hub
docker login

# Enter your username and password when prompted
# Or use stdin for CI/CD environments
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin

After logging in, you should see "Login Succeeded". Your credentials are stored in ~/.docker/config.json.

3Log out and log back in

If you were already logged in but still get the error, your credentials may be stale or corrupted. Force a fresh login:

bash
# Log out first
docker logout

# Log back in
docker login

This clears any cached credentials and forces Docker to re-authenticate with the registry.

4Verify your email address

Docker Hub requires email verification before you can push images. If you have not confirmed your email:

1. Go to [hub.docker.com](https://hub.docker.com) and log in
2. Check your account settings for email verification status
3. If unverified, request a new verification email
4. Click the verification link in the email
5. Try pushing again after verification

5Build with the correct tag from the start

To avoid retagging, build your image with the correct name from the beginning:

bash
# Build with your username in the tag
docker build -t YOUR_DOCKERHUB_USERNAME/myimage:latest .

# Push directly
docker push YOUR_DOCKERHUB_USERNAME/myimage:latest

For CI/CD pipelines, use environment variables:

bash
docker build -t $DOCKER_USERNAME/myimage:$TAG .
docker push $DOCKER_USERNAME/myimage:$TAG
6Reset Docker credentials completely

If the above steps do not work, try a complete credential reset:

bash
# Log out from all registries
docker logout

# Backup and remove the Docker config file
mv ~/.docker/config.json ~/.docker/config.json.backup

# Restart Docker daemon (Linux)
sudo systemctl restart docker

# Or restart Docker Desktop (macOS/Windows)
# Use the Docker Desktop menu to restart

# Log in fresh
docker login

This clears all stored credentials and forces a complete re-authentication.

Advanced notes

### Private Registry Authentication

For private registries, you must include the registry URL in both the login and tag commands:

bash
# Log in to private registry
docker login registry.example.com

# Tag with registry URL
docker tag myimage:latest registry.example.com/myimage:latest

# Push to private registry
docker push registry.example.com/myimage:latest

Do NOT include the registry URL when logging into Docker Hub - use just docker login without a URL parameter.

### Docker Hub Private Repository Limits

Docker Hub free accounts have a limit on private repositories. If you exceed this limit:
- New pushes to private repositories will fail with "access denied"
- The repository may be created but in a blocked state
- Solution: Delete unused private repos, or upgrade your Docker Hub plan

Check your repository count at hub.docker.com under your account settings.

### Sudo and Credential Scope

If you use sudo for some Docker commands, be aware that credentials are stored per-user:

bash
# Credentials stored in ~/.docker/config.json
docker login
docker push username/image

# Credentials stored in /root/.docker/config.json
sudo docker login
sudo docker push username/image

Be consistent with sudo usage. If you use sudo docker push, you must also use sudo docker login.

### Organization Repositories

To push to an organization repository, your account must:
1. Be a member of the organization
2. Have push access to the specific repository

Tag the image with the organization name:

bash
docker tag myimage:latest myorganization/myimage:latest
docker push myorganization/myimage:latest

### GitHub Container Registry (GHCR)

For GitHub Container Registry, use a Personal Access Token (PAT) with the write:packages scope:

bash
echo $GITHUB_PAT | docker login ghcr.io -u USERNAME --password-stdin
docker tag myimage:latest ghcr.io/USERNAME/myimage:latest
docker push ghcr.io/USERNAME/myimage:latest

### Amazon ECR

For Amazon ECR, authenticate using the AWS CLI:

bash
aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin 123456789012.dkr.ecr.us-east-1.amazonaws.com

Frequently asked questions

What does "denied: requested access to the resource is denied" mean?
This error message appears when Docker attempts to push an image to a container registry (like Docker Hub) but the operation is rejected by the registry. The registry denies access for several reasons related to authentication or authorization. The most common cause is that the image is not properly tagged with your Docker Hub namespace (username).
How do I fix "denied: requested access to the resource is denied"?
The 'requested access to the resource is denied' error occurs when pushing a Docker image to a registry. This typically happens because the image is not tagged with your Docker Hub username, you are not logged in, or you are trying to push to a repository you do not own.
What causes "denied: requested access to the resource is denied"?
Image not tagged with your Docker Hub username (most common cause) Not logged in to Docker Hub or the target registry Login session expired or credentials corrupted
Is the "denied: requested access to the resource is denied" error serious?
It is a low-severity error โ€” more of a blocker than a risk. The steps above resolve it.

Official resources & further reading