Skip to content
Related Articles

Related Articles

How to tag an image and push that image to Dockerhub ?
  • Last Updated : 23 Sep, 2020

By pushing an image to the Docker hub registry, we can create an instance of an image in which a particular type of software and applications are pre-installed and can be pulled again whenever you want to work on that particular type of image or applications and run that kind of virtual machine. In the docker hub, there are millions of images you can also pull the default images which are created by the particular organizations for example you can pull the Ubuntu image which is uploaded by Linux and then install any software or application into that image like curl command, Jenkins, etc and then push that image to your docker hub registry. 


  • A docker hub account.
  • Installed docker software in your respective operating system.
  • A pulled image in your docker container which you want to pull in docker hub repository.

Follow the below steps to achieve so:

Step 1: The first step is to give a tag to your docker image which is a reference to your docker image ID which conveys the information regarding the image version. If you login to your docker hub account and search for a standard image of MySQL, HTTP, etc there you notice these tags.


If you do not mention the tag then the default tag is the latest. For example,

docker image tag ubuntu:14.04 XYZ/ubuntu:2.0

Command to tag an image

Ubuntu is a source image in our docker container 14.04 is the tag to that source image.XYZ in the target image name has to be similar to your docker hub account username and the tag is 2.0.     

Step 2: Now if you try to push the image then it will give an error:

denied: requested access to the resource is denied

The reason is that for pushing the image in your docker hub account first you have to log in.   So the second step is to log in to your docker hub account. To login, the command is      

docker login
Docker login

Docker login


Now write your respective username and password you give while creating a docker hub account.             

Note: If you are a Mac user after pushing your image do not forget to logout because the authentication key is written to a file to remember you as user of that docker hub account in the future if it is your personal device no need to do this.

docker logout

docker logout

Step 3: Now after you login you are able to push the image the command is:

docker image push [OPTIONS] NAME[:TAG]

 For example,

docker image push XYZ/ubuntu:2.0
Push command

Push command

After running this command your image will be pulled to the docker hub repository.

docker hub repositry

Note: Write sudo before every command if your image is in the root account and XYZ is your username of docker hub account.

My Personal Notes arrow_drop_up
Recommended Articles
Page :