Concept of public repositories in Docker

Last updated on Sep 16 2022
Neha Warghade

Table of Contents

Concept of public repositories in Docker

Docker – Public Repositories

Public repositories can be employed to host Docker images which can be employed by everyone else. An example is the images which are available in Docker Hub. Most of the images such as Centos, Ubuntu, and Jenkins are all publicly available for all. We can also make our images available by publishing it to the public repository on Docker Hub.

For our example, we will use the myimage repository built within the “Building Docker Files” chapter and upload that image to Docker Hub. Let’s primary review the images on our Docker host to see what we can push to the Docker registry.

doc 21 1

Here, we have our myimage:0.1 image which was created as a part of the “Building Docker Files” chapter. Let’s use this to upload to the Docker public repository.

The subsequent steps explain how you can upload an image to public repository.

Step 1 − Log into Docker Hub and create your repository. This is the repository where your image will be stored. Go to https://hub.docker.com/ and log in with your credentials.

doc 22 1

Step 2 − Click the button “Create Repository” on the above screen and create a repository with the name demorep. Make sure that the visibility of the repository is public.

doc 23 1

Once the repository is created, make a note of the pull command which is attached to the repository.

doc 24 1

The pull command which will be employed in our repository is as follows −

docker pull demousr/demorep

Step 3 − Now go back to the Docker Host. Here we need to tag our myimage to the new repository created in Docker Hub. We can do this via the Docker tag command.

We will learn more about this tag command later in this chapter.

Step 4 − Issue the Docker login command to login into the Docker Hub repository from the command prompt. The Docker login command will prompt you for the username and password to the Docker Hub repository.

doc 25 1

Step 5 − Once the image has been tagged, it’s now time to push the image to the Docker Hub repository. We can do this via the Docker push command. We will learn more about this command later in this chapter.

docker tag

This method allows one to tag an image to the relevant repository.

Syntax

docker tag imageID Repositoryname

Options

  • imageID − This is the ImageID which needs to be tagged to the repository.
  • Repositoryname − This is the repository name to which the ImageID needs to be tagged to.

Return Value

None

Example

sudo docker tag ab0c1d3744dd demousr/demorep:1.0

Output

A sample output of the above example is given below.

doc 26 1

docker push

This method allows one to push images to the Docker Hub.

Syntax

docker push Repositoryname

Options

  • Repositoryname − This is the repository name which needs to be pushed to the Docker Hub.

Return Value

The long ID of the repository pushed to Docker Hub.

Example

sudo docker push demousr/demorep:1.0

Output

doc 27

If you go back to the Docker Hub page and go to your repository, you’ll see the tag name within the repository.

doc 28

Now let’s try to pull the repository we uploaded onto our Docker host. Let’s primary delete the images, myimage:0.1 and demousr/demorep:1.0, from the local Docker host. Let’s use the Docker pull command to pull the repository from the Docker Hub.

doc 29

From the above screenshot, you can see that the Docker pull command has taken our new repository from the Docker Hub and placed it on our machine.

So, this brings us to the end of blog. This Tecklearn ‘Concept of public repositories in Docker’ blog helps you with commonly asked questions if you are looking out for a job in DevOps. If you wish to learn Docker and build a career in DevOps domain, then check out our interactive, Containerization using Docker Training, that comes with 24*7 support to guide you throughout your learning period. Please find the link for course details:

https://www.tecklearn.com/course/containerization-using-docker/

Containerization using Docker Training

About the Course

Tecklearn has specially designed this Containerization using Docker Training Course to advance your skills for a successful career in this domain. his Docker training online course will help you learn Docker containerization, running Docker containers, Docker image creation, Dockerfile, Docker orchestration, security best practices and more through hands-on projects and case studies. Upon completion of this online training, you will hold a solid understanding and hands-on experience with Docker.

Why Should you take Containerization using Docker Training?

  • Average salary of Docker Expert is $110k – Indeed.com
  • According to Grand View Research, the DevOps market size is estimated to be worth $12.85 billion by 2025. DevOps professionals are highly paid and in-demand throughout industries including retail, eCommerce, finance, and technology.
  • Intuit, PayPal, Splunk, Uber & many other MNC’s worldwide use Docker across industries

What you will Learn in this Course?

Introduction to DevOps

  • What is Software Development
  • Software Development Life Cycle
  • Why DevOps?
  • What is DevOps?
  • DevOps Lifecycle
  • DevOps Tools
  • Benefits of DevOps
  • How DevOps is related to Agile Delivery
  • DevOps Implementation

Containerization using Docker – Part 1

  • Introduction to Docker
  • Understanding Docker Lifecycle
  • Docker Architecture
  • Components of Docker Ecosystem
  • Common Docker Operations
  • Committing changes in a Container
  • Hands On

Containerization using Docker – Part 2

  • Building Custom Docker Images
  • Docker Image
  • Introduction to Docker Swarm
  • Deploying a 2-Node Cluster using Docker Swarm
  • Hands on

 

0 responses on "Concept of public repositories in Docker"

Leave a Message

Your email address will not be published. Required fields are marked *