What is Docker Registry? What is Docker Hub?

Updated: Sep 11, 2021



  1. What is Docker Registry?

  2. What is Docker Hub?

  3. Can I have my private Docker Registry?


So we have created a Docker image for our cloud native micro service, and we want to keep this image in a place so that we can get it from there any time we want. We also want to share this image with others. Today I will explain how we can do that using Docker Registry.

What is Docker Registry?

A Docker registry is a library to store Docker images. We can create several versions of a containerized application in the form of Docker images. While creating Docker images we can attach a tag element to assign a human readable name for the image. Using the same tag we can specify the version of the image. A tag can contain the name and version. A default version name latest is added when a version is not explicitly provided. Docker Images can be uploaded to Docker registry using the docker push command. We can download the images to the local machine using docker pull command. When we want to run Docker containers from an Image we issue the docker run command. When a docker run command is issued, if the docker image is not present in the local machine, it is downloaded from the registry. The download is performed layer by layer, you can see this also in the console as part of the command log. When a base or intermediate layer already exists in the local machine it is not downloaded again. The docker search command searches and lists all images that match the search string in the Docker Registry.

What is Docker Hub?

The Docker Hub is a public Docker registry that can be used by anyone. Docker is configured to look for images on Docker Hub by default. This service is provided by Docker to keep and find Docker images. Other than being a repository for all private, official and vendor specific Docker images, docker Hub can be used to automatically build images from GitHub and Bitbucket and push those images to Docker Hub. To integrate Docker Hub with other services we can create actions that are triggered when an image is pushed successfully into Docker Hub. First, we need to sign up to Docker Hub and create a dockerID. DockerID enables you to access all images that reside on the public repositories created by others as well as images from verified image publishers and official images. We can create our own repository and upload Docker images. We can make the repository public or private. Docker Hub can be accessed through the web UI, also we can install Docker Desktop, which is a Desktop application for Docker Hub. Anyone from developers to software vendors and companies can use this registry.

You can read the Docker documentation to know more on Docker Hub.

Can I have my private Docker Registry?

Yes, it is possible. We can run our own private registry and configure Docker to work with the private registry.

Docker Registry is an open source project and a server side application that lets you share Docker Images. It's highly scalable. When you want complete ownership on whom to share your repository images and want to manage it with a higher degree of control it's better that you set up and host your private Docker registry. In the docker pull and docker push commands we need to specify the private registry name and port along with the image name and version. You also need to specify the path of the sub folder where the image resides. For example

docker pull myRegistryDomain:myPort/path/imageName:version

You can deploy your registry server using the below command

docker run -d -p 5000:5000 --restart=always --name registry registry:2

We are using the port mapping similar to when we run a docker container

Have a look into the Docker documentation for details on how to setup a private Docker Registry.

In this blog you have learned about Docker Registry and Docker Hub as a private Docker Registry. You have also seen the possibility to create your private Docker Registry.

6 views0 comments

Recent Posts

See All