/    /  Docker – Push Repository

Docker Push Repository

 

Our Docker image can be pushed to the global repository. It’s a public repository provided by Docker. It lets us put our Docker images on the server so we can access them from the global. Here’s how to push a custom image to Docker Hub.

login to https://hub.docker.com/

Log into your Docker Hub account. If you don’t have one, create one.

$ docker login  

p1

The user name will be asked for. Press enter after entering the dockerid.

p

Enter your password after you provide your username, and it’ll show you your login status as successful.

Tag Docker Image

After logging in, we need to tag our docker image that we want to push. The following command does that.

$ docker tag image-name username/image-name   

username is our dockerid or the username we use to log in.

image-name refers to the name of the docker image we’re using.

Here’s a screenshot of the above command.

p3

The above command tags docker image centos. Now we need to push it to the repository. Let’s see how.

Push Docker Image

You can push Docker images to Docker Hub with this command.

$ docker push username/image-name  

Here is a screen shot of the above command.

p

We can see that the docker image was pushed successfully in the above screenshot.

Check our dashboard at hub.docker.com. You’ll see a new docker image named suryadocker22/centos.

p

On the screen shot, you can see the newest docker image that has just been pushed. At the top is the newest image.