what is docker hub

Docker Hub is a service provided by Docker for hosting, searching, and sharing container images. In DevOps, the deployment of any application in Docker begins with a Docker image. These Docker images are placed in Docker Hub or any third-party registry like AWS ECR, GitHub, or IBM registries. Just like git repo hosting services, a Docker repository can be public or private. Docker Hub is the world’s largest repository of container images. Not only that, Docker Hub also provides major features like Repositories, official and publisher images, builds, web hooks, teams, and organization. 

If you want to know more about Docker, go through the following articles:

Let’s take a deep dive and explore more about Docker Hub.

1. Registry vs Repository

We will use these terms extensively in our tutorials and upcoming guides. Therefore, it is necessary to understand the key differences between a registry and a repository.

The simplest difference is:

registry stores a collection of repositories.

A repository contains images with different tags.

So, the Docker Hub is a registry where you will create a repository to store the images.

You can even host a registry by yourself. Also, it could be hosted by a third-party registry provider like:

It’s your choice to host images wherever you want. There would be a difference between the repository and tags but you can pull the images with the same command. 

2. Docker Hub Official Images

There are over 100K container images on Docker Hub from open-source projects, software vendors, and the community. These images serve as the starting point for the users to build customized images. You’ll find every official image here like Ubuntu, MySQL, NGINX, Alpine, CentOS, etc. There is a dedicated team that is responsible for reviewing and publishing all content in the Official Images. These images are scanned and safe to pull and run.

docker hub official images

Since we are new to Docker, it is strongly recommended to use the official images to learn about Docker. We’ll also build the images with customizations with the help of Dockerfile but it is for advanced users. As a beginner, we will use these official images to build, run and deploy the applications.

3. Sign up for a Docker account

Open hub.docker.com to sign up on Docker Hub. You need to put the following 3 credentials:

  • Docker ID
  • Email
  • Password

Check the captcha and hit the sign-up button. 

setup a docker hub account

You’ll receive an email to activate the account. Click on the verify email address button to verify the account.

verify the email address from docker hub

In the next step, Docker Hub will ask us to choose the plan. There are currently three plans, Free, Pro, and Team. Choose the Free plan and click on continue with the free plan.

choose the free plan on hub.docker.com

4. How to Create a Public Repository on Docker Hub?

On the Docker Hub dashboard, you can see we don’t have any repositories created yet. So, we are going to create the first repository and that would be public. We can create unlimited repositories in the free plan. 

Click on Repositories ==> Create Repository

repositories on docker hub

Creating a public repository on Docker Hub is simple and easy. Follow the below steps.

  1. Write the repository name, the name will be used in the image.
  2. Write the description for your convenience.
  3. Check on the Public button to make the repo public.
  4. Hit create to create the repository.
how to create a public repository in docker hub

The public repository has been created. You can see the public view button which means the images in this repository can be pulled from anyone in the world using the below command.

docker pull softwarespice/devimages

We’ll discuss pulling a docker image in detail, so there is nothing to worry about.

public repository on docker hub has been created

5. How to Create a Private Repository on Docker Hub?

We can only create ONE private repository in the free plan on hub.docker.com. If you want more, you need to choose the Pro or Team plan. By the way, a single private repository is enough to learn how private repositories work and we can push images to them. 

Images in the private repository can only be pulled or pushed by you or the person whom you have shared the credentials with. 

There are no big differences while creating a private repository. We need to check the private button instead of the public. Here are the steps:

  1. Write the repository name, the name will be used in the image.
  2. Write the description for your convenience.
  3. Check on the Private button to make the repo private.
  4. Hit create to create the repository.
how to create a private repository on docker hub

We have created our private repository. As I said earlier, we can create only one repository in the free plan.

docker hub private repo

Finally, you can see both repositories under Repositories. There are no pushes or pulls since we didn’t push or pull any image yet. 

docker hub repos

The repositories will be updated when we’ll start the pushing and pulling drills.

Stay tuned and Happy Docking!

Leave a Comment

Recent Posts

how to stop a docker container
How to Run a Docker Container
How to Push a Docker Image to a Private Repository
How to push a docker image
How to Tag a Docker Image
Software Spice
Share via
Copy link
Powered by Social Snap