codingstuff.io
ExploreTutorialsProblemsCS Subjects
Get Started
ExploreTutorialsProblemsCS Subjects
Get Started
codingstuff.io

Master the art of building software through interactive tutorials, real-world problems, and guided projects.

Pune, Maharashtra, India

codingstuffmail@gmail.com

Product

  • Explore
  • Tutorials
  • Problems
  • CS Subjects

Company

  • About
  • Contact
  • Privacy Policy
  • Terms & Conditions
  • Sitemap

© 2026 codingstuff.io. All rights reserved.

Built with ❤️ for developers everywhere

/
/
All Tutorials
🐳

Docker

22 / 60 topics
22Docker Hub23Private Registries38Docker Hub Advanced39Private Registries Advanced54Docker Hub Advanced Topics55Private Registries Advanced Topics
Tutorials/Docker/Docker Hub
🐳Docker

Docker Hub

Updated 2026-05-15
10 min read

Docker Hub

Introduction

Docker Hub is a cloud-based registry service provided by Docker for building, storing, and distributing container images. It serves as a central place where developers can store their Docker images and share them with others. This tutorial will guide you through the basics of using Docker Hub to store and manage your Docker images.

Concept

Docker Hub allows users to create repositories to store their Docker images. These repositories can be either public, meaning anyone can access them, or private, where only authorized users have access. Docker Hub also provides features like automated builds from source code repositories (GitHub, GitLab, etc.) and webhooks for integration with other services.

Examples

1. Creating a Docker Account

First, you need to create an account on Docker Hub if you don't already have one. You can sign up at Docker Hub.

2. Logging In to Docker Hub

Once you have an account, you can log in to Docker Hub from your terminal using the following command:

Terminal
{`$ docker login`}

You will be prompted to enter your Docker ID and password.

Output
{`Username: your_docker_id
Password:
Login Succeeded`}

3. Creating a Repository

After logging in, you can create a new repository on Docker Hub. You can do this through the web interface or by using the Docker CLI.

Using the Web Interface

  1. Go to Docker Hub.
  2. Click on "Create Repository".
  3. Fill in the details: name, description, and choose between public or private.
  4. Click "Create".

Using the Docker CLI

You can create a repository using the Docker CLI with the following command:

Terminal
{`$ docker repo create your_docker_id/your_repo_name`}

4. Tagging and Pushing an Image

To push an image to Docker Hub, you first need to tag it with your Docker ID and repository name.

Terminal
{`$ docker pull ubuntu:latest
$ docker tag ubuntu:latest your_docker_id/your_repo_name:tag_name`}

Replace your_docker_id, your_repo_name, and tag_name with your actual Docker ID, repository name, and desired tag.

Now, you can push the image to Docker Hub:

Terminal
{`$ docker push your_docker_id/your_repo_name:tag_name`}

5. Pulling an Image

To pull an image from Docker Hub, use the following command:

Terminal
{`$ docker pull your_docker_id/your_repo_name:tag_name`}

6. Automating Builds

Docker Hub supports automated builds from source code repositories like GitHub or GitLab. You can set up a webhook to trigger builds automatically whenever you push changes to your repository.

  1. Go to your Docker Hub repository.
  2. Click on "Builds" and then "Link to GitHub".
  3. Authorize Docker Hub to access your GitHub account.
  4. Select the repository and branch you want to link.
  5. Configure build rules as needed.

What's Next?

In this tutorial, we covered how to use Docker Hub for storing and sharing images. In the next section, we will explore private registries and how to set them up for more secure image storage.


PreviousDocker MachineNext Private Registries

Recommended Gear

Docker MachinePrivate Registries