...

Cloud Computing - Docker

Back to Course

Lesson Description


Lession - #1120 Docker Public Repositories


Docker Public Repositories

    Public repositories can be used to host Docker images which can be used by everyone else. An example is the images which are available in Docker Hub. Most of the images like Centos, Ubuntu, and Jenkins are largely publicly 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 in the "Building Docker Files" chapter and upload that image to Docker Hub. How about we first review the images on our Docker host to see what we can push to the Docker registry.


Here, we have our myimage:0.1 image which was created as a part of the "Building Docker Files" section. We should use this to upload to the Docker public repository.
    The following steps explain how you can upload an image to public repository.
Step 1 − Log into Docker Hub and create your repository. Here your picture will bestored. Go to https://hub.docker.com/ and sign in with your credentials.


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


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


    The pull command which will be used in our repository is as follows −
docker pull demousr/demorep

Step 3 − Now return to the Docker Host. Here we really want to tag our myimage to the new repository created in Docker Hub. We can do this through the Docker tag command.
We will learn more deeply about tag command later in this part.
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.


Step 5 − Once the picture has been tagged, it's now time to push the image to the Docker Hub repository. We can do this by means of the Docker push command. We will look further into this command later in this chapter.