Docker Publishing Images to Docker Hub (original) (raw)

Last Updated : 1 Sep, 2025

Docker is a container platform that facilitates creating and managing containers. Here, we will see how docker stores the docker images in some popular registries like Dockerhub and 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.

Create 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/sign up to docker hub and register an account.

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

Navigate to Repositories

**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.

docker build -t username/repository_name .

**Command:

docker build -t arunbang/geeksforgeeks .

Building Docker Image

Pushing Docker Image to a Registry

**Step 5: Pushing docker image to docker hub

docker login

Docker Login

docker push arunbang/geeksforgeeks

Pushing Docker Image

repository in docker hub

repository in docker hub

Run the Docker Image On a Docker Container

**Step 6: Creating a Run Container

docker run -dit --name mycontainer ubuntu:latest

Step 7: Verify the Container Status

On running the following command we can list the status of the container. The following command is used to known the status of the container.

docker ps -a

How to push Docker image to Dockerhub Private Registry? A Step-By-Step Guide

The following are the steps that help you to push the docker image to the Dockerhub private Registry:

Step 1: Create a Private Repository on Dockerhub

Step 2: Tag your Docker Image

Now, Come back to the console where docker server is running. Use the docker tag command to tag your local docker image with the repository name that you created in dockerhub.

Use the docker tag command and provide Dockerhub Username, the Repository Name and the Desired Tag. The command looks as follows:

docker tag /:

**Example

docker tag bnvschaitanya/my-private-img:v1

Step 3: Login to Dockerhub

docker login -u -p

Step 4: Push Your Image to Dockerhub

docker push bnvschaitanya/my-private-img:v1

Step 5: Verify the Upload

How to Use Docker Full Tag Name and Push the Docker Image to Docker Hub?

In the above implementation, we have already done this part, for better understanding this section effectively here. The following are the steps for used for assigning full tag name and push the docker image to the docker hub.

Step 1: Full Tag Name to Your Docker Image

docker tag : /:

Step 2: Login In to Dockerhub

docker login

docker login -u -p

Step 3: Push Your Image to Dockerhub

docker push /:

Docker Push Image Example

Here, we are the building your custom docker image into the dockerhub, while practising make sure to you use your credentials and push to your docker hub registry.

Step 1: List the Docker Image

Step 2: Login in to Dockerhub from Console

docker login

Step 3: Push the Docker Image

docker push /:

Generally we use tag version to the same image when we doing some changes to the image we building with different version, so that if error raise we can revert to the previous image with the version. The following are the steps to guide you how to push all the tags of an image into the dockerhub.

Step 1: Tag Your Docker Image

docker tag /:
docker tag /:

Step 2: Log in to Dockerhub

docker login

Step 3: Push all tags of the Image

docker push -a /