Skip to main content

Pushing to your Repository

Once you have your repository created in hub.docker.com, you can begin tagging and uploading your created docker images.

For instance, assuming we have a container called myrepo/myimage, you may want to build a version of your image tagged with the correct version number you want to use (such as 1.1.2) using docker build -t "myrepo/myimage:tagname" .. Or, if you don't want to re-create the image with a tag, you can simply run docker tag myrepo/myimage myrepo/myimage:tagname to add a tag to the image.

Now that you have a finished image with a version number, you can run the same command as above, but this time have the source image be the tagged version number, and the created image be tagged as latest. For example, you may run docker tag myrepo/myimage:versionnumber myrepo/myimage:latest , replacing "versionnumber" with the version number of the image you created and intend to upload, and keeping the word "latest" the same.

Now that you have two identical docker images, one tagged with a version number, and one tagged with "latest", you can push both images to your repository in Docker Hub with the following two commands:

docker push myrepo/myimage:versionnumber
docker push myrepo/myimage:latest

Here's a real-world example:

docker push zeppelinsforever/music-downloader:0.0.2
docker push zeppelinsforever/music-downloader:latest

If this is your first time pushing an image to your repository, you may have to create an account in Docker Desktop, then generate a PGP key and pass it to Docker Desktop to ensure secure pushes. More information can be found in the Docker docs: https://docs.docker.com/desktop/setup/sign-in/