Docker push, see error denied: requested access to the resource is denied

I follow the step in https://docs.docker.com/get-started/introduction/build-and-push-first-image/

section Build and push the image

when I follow the step
docker push DOCKER_USERNAME/getting-started-todo-app

it return
denied: requested access to the resource is denied

  1. what does it mean?
  2. in fact after the command
    docker build -t DOCKER_USERNAME/getting-started-todo-app .

where is the docker image built?

the whole message is as follow:

docker push DOCKER_USERNAME/getting-started-todo-app
Using default tag: latest
The push refers to repository [docker.io/DOCKER_USERNAME/getting-started-todo-app]
6f2cd730f750: Preparing 
500859eb4358: Preparing 
a71bb56c8884: Preparing 
eb603a7dbff4: Preparing 
5b0cec2b8249: Preparing 
ae4ae70cb51f: Waiting 
8d3455c7439c: Waiting 
47c1d360e988: Waiting 
7c5eb227dc0a: Waiting 
4b017a36fd9c: Waiting 
20a9b386e10e: Waiting 
f8217d7865d2: Waiting 
01c9a2a5f237: Waiting 
denied: requested access to the resource is denied

OS:Ubuntu 22.04
docker version:Docker version 28.0.0, build f9ced58

Just to be sure: you have seen and understood that DOCKER_USERNAME is just a placeholder for your actuall username, right?

Instead of directly applying the first command with the placeholder, the example replaces it with the username mobydock.

Yes, I know, I have replaced the “DOCKER_USERNAME” with my real docker user name.

And I google and some mention" before pushing, remember to log out , then log in from the command line to your docker hub account"
https://stackoverflow.com/questions/41984399/docker-push-error-denied-requested-access-to-the-resource-is-denied

But then I face another problem when login.
It always return

unauthorized: incorrect username or password

I will create another post for this error.

After logout and login again in ubuntu terminal, I can push the image to docker hub now.
the flow is:
follow this link https://docs.docker.com/get-started/introduction/build-and-push-first-image/
In Build and push the image CLI tab, after step 3, logout and login again first as follow

docker logout
docker login --username=<DOCKER_USERNAME>

then can continue step 4

docker push <DOCKER_USERNAME>/getting-started-todo-app
1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.