I've learned something as straightforward as adding a Docker image to a repository can be somewhat frustrating. When I say private repository I mean a private repository hosted on Docker Hub.
Here are the steps I had to take to successfully push a Docker image:
- If you recently created a private repo, log out of Docker and then login back in by running
docker logincommands. The reason behind this is to make sure Docker is aware that the private repo exists.
- This is very important. The Docker image has to be named exactly the same as the private repo. If it is not named the same, you will get a
requested access to the resource is deniederror. To change the Docker image name, run 'docker tag [current image name] [dockerhub username/private repo name:tag]. You can add whatever you want for the tag, I added '1.0'.
- Now with the Docker image having the correct name, you can add it to the private repository. Run
docker push [username/private repo name:tag]. For example
docker push johnsmith/demorepo:1.0.
Top comments (0)