0

I have created a new docker image with a

# docker build -t my-phpapache:7.4 .

Now, when I try to make

# docker image push

I'm logged in to a Docker hub in a browser. I see the errors:

$ docker image push --all-tags docker.io/library/my-phpapache
The push refers to repository [docker.io/library/my-phpapache]
f04ed43187a6: Preparing 
0ff1b9aaef0c: Preparing 
c18803e039cd: Preparing 
a735fdc00d49: Preparing 
de7c912f2726: Preparing 
e835c99ddfc4: Waiting 
1f55d9e78afa: Waiting 
5aefa6797d83: Waiting 
70af74272d2e: Waiting 
58e3131f3b01: Waiting 
a1bae98a9430: Waiting 
752cff7a1101: Waiting 
be3607e92e69: Waiting 
2ffebc0bdeea: Waiting 
4c94b016478b: Waiting 
a9019c838a13: Waiting 
015643a98838: Waiting 
f2c64a370cec: Waiting 
d5b8874e6c41: Waiting 
9eb82f04c782: Waiting 
denied: requested access to the resource is denied
4
  • 1
    You need to log in through the CLI to achieve a push. Please look at this Link. May 12, 2022 at 14:01
  • Thank you, Kristian Kanchev, I've tried your instructions. Logged out, generated Access token with a full access. I've logged in with it. I've repeated docker image push --all-tags docker.io/library/my-phpapache and I see the same error message: "denied: requested access to the resource is denied"
    – Taras
    May 12, 2022 at 14:11
  • Can you try to be more specific with your push, maybe have a look at this? May 12, 2022 at 14:44
  • $ docker logout Removing login credentials for index.docker.io/v1 $ $ docker login -u shtaras Password: Login Succeeded $ $ docker image push --all-tags docker.io/library/my-phpapache The push refers to repository [docker.io/library/my-phpapache] f04ed43187a6: Preparing ... 9eb82f04c782: Waiting denied: requested access to the resource is denied $
    – Taras
    May 12, 2022 at 15:33

3 Answers 3

1

To push, you need write access to the destination repository. With Docker Hub, those repositories must be under your userid, or in an organization where you have write access. The default path you see added, docker.io/library, is used by official images, which makes pulling official images easier. But since you aren't the author of docker official images, that won't work for pushing.

That means you need to:

docker build -t your-user/your-image:v1 .
docker push your-user/your-image:v1

Where your-user is the same user you used when running docker login.

0

you need to login on your console to your docker registry the push the image to the local or public registry.

docker login registry.mydomain.xxx:5000
username: xxxx
password: xxxx
docker push registry.mydomain.xxx:5000
0

Here are the steps that worked for me:

  1. docker logout (if already logged in)
  2. docker login
  3. docker build . -t
  4. docker tag /:
  5. docker push /:

Before pushing the image we need to tag it with the a name to be displayed on the repository by providing the location to the docker hub repository/registry and the tag name.

Thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.