How to use Docker Hub and Registry

The Registry is a server-side application that stores and distributes Docker images. It is stateless and extremely scalable. The Registry is open-source and licenced under the Apache permissive licence.

Some of the alternative of DockerHub are ECR (Elastic Container Registry), JFrog Artifactory and Azure Container.

Docker Hub is a Docker service that allows you to search and share container images with your team. It is the largest library of container images in the world, including material from a variety of sources, including container community developers, open source projects, and independent software vendors (ISVs) that build and distribute their code in containers.

Create Account on Docker Hub

  1. Go to https://hub.docker.com/
  2. Click on Signup if you don’t have account created
  3. Signup with registered email id and verify it.

Note – Remember the username and password, as you will be requiring it for further steps.

How to Push Docker Image on Docker Hub

Our previous tutorial – Docker Common Commands.

Create a image with custom name from your existing local docker image. Bellow is command for it

docker tag existing_image docker_username/custom_image_name

Please replace username with your username, existing_image name is the docker image which is present on your system for what you want to create image, custom_image_name is image name which you want to create.

docker tag custom-image docker_username/custom-ubuntu-nginx-image

Now if you type bellow command, you will find your image which you created.

docker images

Now login into docker using bellow command, it will ask for username and password.

docker login

Once your login succeeded, type bellow command to push your custom docker image on docker hub. Properly type the name which you have created.

docker push docker_username/custom_image_name
docker push docker_username/custom-ubuntu-nginx-image

Now you create docker repositories, you will find your image, if everything successful.

How to Pull Docker Image from Docker Hub

Now the docker image, which you have pushed has a unique name. You can pull your docker image which you have pushed by using bellow command.

docker pull docker_username/custom-ubuntu-nginx-image

Useful commands tutorial – Docker Common Commands.