Docker Hub Container Image Library

Welcome readers, in this tutorial, we will understand the basis of the Docker and Docker hub container repository.

1. What is Docker?

In the present world, Docker is an important term –

  • Often used in CI/CD platform that packages and runs the application with its dependencies inside a container
  • Is a standard for Linux Containers
  • A Container is a runtime that runs under any Linux kernel and provides a private machine-like space under Linux

It is used for –

  • For environment replication, while the code runs locally on the machine
  • For numerous deployment phases i.e. Dev/Test/QA
  • For version control and distributing the application’s OS within a team

1.1 Docker Terminology

  • Image: Representation of Docker container i.e. a JAR or WAR file in Java
  • Container: Runtime of Docker i.e. a deployed and running Docker image. For example, an executable Spring Boot jar
  • Engine: The code that manages, creates, and runs the Docker containers
  • Hub: A public developers registry to distribute their code
  • Repository: A collection of Docker related images i.e. different versions of the same application

1.1.1 Docker Command Basics

Here is an example command.

Basic structure - docker hub
Fig. 1: Basic structure

1.2 Setting up Docker

If someone needs to go through the Docker installation, please watch this video.

1.3 What is a Docker hub?

Docker hub is a gold mine for the developer community. It is a service provided by Docker for finding the image of almost any software or operating system and running it locally without installing it with the help of a docker run command. It is a cloud-based repository that lets you create, test, store, and deploy the container images that can be used across the developer communities. It offers features like –

  • Lets you store images and share containers with your team or via open source community
  • Lets you to create private or public repositories
  • Provides automated build that lets the developers automatically create images from the source code present in the repository
  • Provide webhooks to trigger an action in other components when the image is pushed to the docker hub repository
  • Provides official images for operating systems, software, and programming language runtimes

1.4 How to use Docker hub?

Using the docker hub is easy as one will need to do the following i.e. –

  • Creating a free account by signing up here
  • Running docker desktop locally by following the 1.2 section

1.5 Creating repositories

Creating the repositories in the docker hub is very easy. Just after you log in to the docker hub account you will be shown the dashboard as in Fig. 2.

Fig. 2: Docker hub dashboard

Click on the Create Repository button. Provide the required details like – Name, Description, and the visibility of the repositories such as private or public as in Fig. 3 and click on Create. Remember that the docker repository name should be unique in the namespace and can only contain lowercase, number, and special characters.

  • Public repository in docker hub is free to use
  • Private repository in docker hub is a paid service and let you keep the container images private either to the self account or within a company
Fig. 3: Creating a repository

Once created the repository will be shown and will be available for use via the docker cli.

1.6 Pushing a docker container to the hub

Pushing a bundled image to the docker hub is an easy process. Open the terminal on your machine and follow the below steps –

  • Login to the docker environment using docker login command
  • Create a Dockerfile responsible to create the image of the bundled application code and packages
  • Build the image using the docker build -t docker_user/repo_name:tag_name
  • Re tag the created local image using the command docker tag local_image_name docker_user/repo_name:tag_name
  • Now push the image docker the docker hub using the command – docker push docker_user/repo_name:tag_name

Once all the steps are done the image will be pushed to the docker repository as shown in Fig. 4.

Fig. 4: Pushed docker image

1.7 Collaborators and their role

A collaborator is someone whom you would give access to your private repositories hosted in the docker hub. Once any user is given as the collaborator access she or he can pull or push to your repositories. Though they are still not allowed to do any administrative tasks on your repositories such as deleting any repository or changing its status from private to public.

1.8 Searching for repositories

Search for any image in the docker hub is easy as there are two options available i.e. –

  • Either search directly in the Docker hub repository from the GUI or
  • Use the docker search image_name command to check for the docker image via the cli

That is all for this tutorial and I hope the article served you with whatever you were looking for. Happy Learning and do not forget to share! Happy learning and do not forget to share!


An experience full-stack engineer well versed with Core Java, Spring/Springboot, MVC, Security, AOP, Frontend (Angular & React), and cloud technologies (such as AWS, GCP, Jenkins, Docker, K8).
Notify of

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Inline Feedbacks
View all comments
Back to top button