Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Servers, nginx and Docker

docker push is denied: requested access to the resource is denied

Errordenied: requested access to the resource is denied

Short answer

The registry refused the push. Most often the image is tagged without your Docker Hub namespace, so Docker tries to push to a repository you do not own. Tag it as namespace/name:tag, make sure docker login succeeded for that account, and check the account has write access.

  • Applies to Docker Engine 28, Docker Hub
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Look at the full name of the image you are pushing. The part before the first slash is the namespace.

    docker image ls
  2. 2Match what you see, then jump to its fix

    1. 1The image is listed as just myapp, or with a namespace that is not your accountThe image has no namespace of yours in its nameFix
    2. 2The namespace is right, but the push is refused straight awayYou are not logged in, or logged in as another accountFix
    3. 3Pull works, push is denied on an organization repositoryThe account can read the repository but not write to itFix

What does the error look like?

  • denied: requested access to the resource is denied
  • push access denied, repository does not exist or may require authorization

Cause 1 of 3

The image has no namespace of yours in its name

1Check

A bare name resolves to the library namespace, which is reserved for Docker Official Images, so a push there is refused.

docker image ls myapp

2Fix

Add your account or organization name as the namespace by tagging again, then push the new name.

docker image tag myapp <your-namespace>/myapp:1.0
docker image push <your-namespace>/myapp:1.0

3Verify

The push finishes with a digest.

docker image push <your-namespace>/myapp:1.0

Confirmed by docs.docker.com

Did this fix it?

Cause 2 of 3

You are not logged in, or logged in as another account

1Check

docker login authenticates to the registry named in its SERVER argument. A login to one registry does not apply to another host.

cat ~/.docker/config.json

2Fix

Log out and in again with the right account. For a registry that is not Docker Hub, include its host.

docker logout
docker login

3Verify

Login succeeds and the push is accepted.

docker image push <your-namespace>/myapp:1.0

Confirmed by docs.docker.com

Did this fix it?

Cause 3 of 3

The account can read the repository but not write to it

1Check

Access to organization repositories comes from member roles, teams and their permissions.

docker pull <org>/myapp:1.0

2Fix

Ask an organization owner to give your team write permission on that repository, or push to a repository you own.

docker image tag myapp <your-namespace>/myapp:1.0

3Verify

Push again after the permission change.

docker image push <your-namespace>/myapp:1.0

Confirmed by docs.docker.com

Did this fix it?

How do I stop it coming back?

  • Put the full registry path in your build tag from the start, using one variable for the namespace.
  • In CI use an access token with write scope, stored as a secret.
  • Test docker login before the build step so a credential problem fails fast.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.