Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

Docker Hub


May 22, 2021 Docker From entry to practice



Docker currently officially maintains a public repository, Docker Hub, which already includes more than 15,000 images. Most of the requirements can be achieved by downloading the image directly in Docker Hub.

Login

Registration and login can be done by executing the docker login command to enter a user name, password, and mailbox. After successful registration, the user's authentication information .dockercfg of the local user directory.

Basic operations

Users do not need to sign docker search in the official repository with the docker search command and use the docker pull command to download it locally.

For example, search with centos as a keyword:

$ sudo docker search centos
NAME                                            DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
centos                                          The official build of CentOS.                   465       [OK]
tianon/centos                                   CentOS 5 and 6, created using rinse instea...   28
blalor/centos                                   Bare-bones base CentOS 6.5 image                6                    [OK]
saltstack/centos-6-minimal                                                                      6                    [OK]
tutum/centos-6.4                                DEPRECATED. Use tutum/centos:6.4 instead. ...   5                    [OK]
...

You can see that you have returned a number of images that contain keywords, including the mirror name, description, star rating (which indicates the popularity of the image), whether the image was officially created, and whether it was created automatically. The official mirror description is created and maintained by the official project team, and the automated resource allows the user to verify the source and content of the image.

Mirroring resources can be divided into two categories, depending on whether they are officially available. O ne is a base mirror like centos, called a base or root mirror. T hese underlying images are created, validated, supported, and provided by Docker. S uch images often use a single word as a name. T here is also a type, such tianon/centos which is created and maintained by Docker's users and often comes with a user name prefix. You can specify the user_name/ such as a tianon user, by using the prefix "a user/."

In addition, the -s N parameter -s N that only images rated above N stars are N when looking.

Download the official centos mirror to the local.

$ sudo docker pull centos
Pulling repository centos
0b443ba03958: Download complete
539c0211cd76: Download complete
511136ea3c5a: Download complete
7064731afe90: Download complete

Users can also push the image to docker push via the docker push command after logging in.

Auto-create

Automated Builds is convenient for those who need to upgrade in-mirror programs frequently. Sometimes, the user creates a mirror, installs a software, and manually updates the mirror if the software releases a new version.

Automatic creation, on the other hand, allows users to track items on a target site (currently supported by GitHub or BitBucket) through Docker Hub, and automatically executes creation once a new commit occurs.

To configure auto-creation, include the following steps:

  • Create and log in to Docker Hub, as well as the target site;
  • Connect your account to Docker Hub in the destination site;
  • Configure an auto-create in Docker Hub;
  • Select an item (with Dockerfile) and branch in a target site;
  • Specify the location of Dockerfile and submit the creation.

After that, you can track the status of each creation in The AutoCreated page of Docker Hub.