Open In App
Related Articles

Docker – Publishing Images to Docker Hub

Like Article
Save Article
Report issue

In this post, we will see how to publish the Docker images to Docker Hub. By publishing the images to the docker hub and making it public it gives users more flexibility in creating earlier versions of Docker images. The prerequisites of moving further are you should know how to create a docker file which can be referred to in this post.

The docker file used for this post can be referred to here.

Creating a repository on Docker Hub

Step 1: Now we have our docker file so let’s create a repository within the docker hub before we push our image into an online repository. So first login/signup to docker hub and register an account.

Step 2: After signing up click on the repositories tab in the navbar as shown below:


Step 3: Create a repository called geeksforgeeks as an example that we will be used as shown below.

creating repository

Step 4: Now let us create an image from docker and push it to geeksforgeeks repository.

To build an image the syntax is shown below.

docker build -t username/repository_name .

The username is the docker hub name and the repository_name is geeksforgeeks that we created above.


docker build -t arunbang/geeksforgeeks .

creating image

Step 5: Pushing docker image to docker hub

So before we push our image we need to log in to the Docker hub using the command given below:

docker login


Once we are logged in we can push our container to the Docker hub. To push our container to the Docker hub, we use the following command:

docker push arunbang/geeksforgeeks

push command

Now our Docker image is now available in Docker Hub. You can see it by visiting your repository.

repository in docker hub

repository in docker hub

So, these were 5 simple steps for publishing images to Docker Hub.

Last Updated : 30 Mar, 2023
Like Article
Save Article
Share your thoughts in the comments
Similar Reads