Brief introduction
Relationship is very similar to Git and Github, the Docker and Docker Hub is true, Docker Hub is a public official Docker warehouse maintenance, where users can register an account, push their own local mirroring to a remote warehouse. Currently, the vast majority of demand required image can be found on the Docker Hub.
Docker Hub Register
Click on the official website link to register to the specific fill as shown below, click Sign up registration will ask for personal information, and then confirm your registration e-mail to the mailbox to log normal Docker Hub. Note, remember your user name ID and password is required to log in Docker on the local machine.
Log on locally
docker login
Command is used to log Docker Hub account, execute the command prompts for username and password, you can log in successfully verified.
docker logout
Docker Hub account logout command, the command is executed on behalf of Docker logs out the current account.
After following figure successful login, you can push (push) or pull (pull) mirror under their own account, the previous blog mentioned use docker search
command to find public mirrored in the official image library, use the docker pull
command to the remote public image pull locally, these two operations are not required to log Docker hub account .
Mirroring Push
Below the hello-world image modification, for example, demonstrates how to push and pull their own image.
First, tag
create a hello-world modeled to a mirror command, can also be a mirror image from any source, (such as DockerFile built Docker hub or pull revised), here is a demonstration of personal image only.
Sure you are logged in Docker hub account as it appears on one of the following, the command docker push username/appname:tag
push their own personal image to the remote repository. Here is the image name must be standardized username/appname:tag
and must be the username of the user currently logged on, otherwise it will push failed.
When the push-command results in the following figure, showing the success of the push (network format specification substantially no problem will succeed).
At this point, log Docker Hub account, view your warehouse, you can see the push content, specifically as shown. Pushed to mirror their own accounts are public by default, others can be accessed on the Docker hub, docker search
the command will search mirrored in Docker official warehouse, you can not find personal disclosure.
At this time, delete the local mirror, pulling back from the local Docker Hub. Here we must note, pulling their image using standard image name, if the public image (the default is to push public), without logging pull success. Specific presentations shown below.
Finally, add that personal image can be private, need to change in the repository set up in the following figure, but there are use restrictions, needs more private warehouse purchase, unrestricted public warehouse.
Supplement
This paper describes the use of the remote mirror Docker Hub warehouse, primarily push and pull operations. Article if imperfect, comments are welcome correction.