Skip to main content

Push images to the Docker/Harbor Registry:

After authenticating yourself with the Harbor Image Registry, you will now learn how to push/upload an image to your Harbor Image Registry using the Docker CLI.

Before you begin, execute the following Docker command to download the latest version of the "nginx:alpine" image.

docker pull nginx:alpine

Now, verify the list of images with the following Docker command. You should see that the "nginx:alpine" image has been downloaded.

docker images

List of images:

REPOSITORY   TAG      IMAGE ID       CREATED       SIZE
nginx        alpine   4bb46517cac3   2 weeks ago   22.5MB

To transfer the custom images to the Harbor Image Registry, you can change the tag of the current image to the format "harbor-domain.com/project/image:version".

So, execute the following command to change the default tag "nginx:alpine" to "registry.hwdomain.io/library/nginx:alpine".

docker tag nginx:alpine registry.hwdomain.io/library/nginx:alpine

Then, upload the image to the Harbor Image Registry and push it with the following command. This command uploads the image with the project name "library" to the image registry "repo.j551n.com".

docker push repo.j551n.com/library/nginx:alpine

Below is the output while uploading the image to the Harbor Image Registry:

The push refers to repository [repo.j551n.com/library/nginx]
14282f7560a8: Pushed
alpine: digest: sha256:765b97f216d8229b908ba9e523efc735e06ee0bda3e208a0f756693f06b95e5a size: 528

By following these steps, you have successfully uploaded an image to the Harbor Image Registry. You can now be assured that your image is secure and accessible, ready for use in your projects.