Docker
57
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.
Once 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
Docker
58
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.
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