Docker Practical Notes 3 - Warehouse

Please indicate the source of the reprint: http://blog.csdn.net/zhaoyanjun6/article/details/130260521
This article comes from [Zhao Yanjun's blog]

Official warehouse Docker Hub

https://hub.docker.com/

At present, Docker officially maintains a public warehouse Docker Hub, which already includes more than 2,650,000 images. Most of the requirements can be achieved by directly downloading images in Docker Hub.

register

You can sign up for a Docker account for free at https://hub.docker.com.

Log in

You can log in to Docker Hub on the command line interface by executing docker loginthe command and interactively entering the user name and password.

You can docker logoutlog out .

view mirror

View the official image provided by Explore
insert image description here

search mirror

You can use docker searchthe command to find the image in the official warehouse, and use docker pull the command to download it locally.
For example, to search centosfor keywords:

$ docker search centos
NAME                               DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
centos                             The official build of CentOS.                   6449      [OK]
ansible/centos7-ansible            Ansible on Centos7                              132                  [OK]
consol/centos-xfce-vnc             Centos container with "headless" VNC session…   126                  [OK]
jdeathe/centos-ssh                 OpenSSH / Supervisor / EPEL/IUS/SCL Repos -117                  [OK]
centos/systemd                     systemd enabled base container.                 96                   [OK]

It can be seen that many images containing keywords are returned, including the image name, description, number of favorites (indicating the degree of attention of the image), whether it is officially created (OFFICIAL), whether it is automatically built (AUTOMATED).

According to whether it is officially provided, the image can be divided into two categories.

One is a mirror like centos, called a base mirror or root mirror. These base images are created, validated, supported, and provided by the Docker company. Such images often use single-word names.

There is also a type, such as the ansible/centos7-ansible image, which is created and maintained by registered users of Docker Hub, often with a username prefix. You can use the prefix username/ to specify the image provided by a user, such as the ansible user.

In addition, when searching, you can use the --filter=stars=N parameter to specify that only images with a collection number of N or more are displayed.

Command: Find mirrors with more than 100 favorites

docker search --filter=stars=100 tomcat

Download the official centos mirror to the local.

$ docker pull centos
Using default tag: latest
latest: Pulling from library/centos
7a0437f04f83: Pull complete
Digest: sha256:5528e8b1b1719d34604c87e11dcd1c0a20bedf46e83b5632cdeac91b8c04efc1
Status: Downloaded newer image for centos:latest
docker.io/library/centos:latest

push image

Users can also use docker pushthe command Docker Hub.
In the following commands, usernameplease replace with your Docker account username.

$ docker tag ubuntu:18.04 username/ubuntu:18.04

$ docker image ls

REPOSITORY                                               TAG                    IMAGE ID            CREATED             SIZE
ubuntu                                                   18.04                  275d79972a86        6 days ago          94.6MB
username/ubuntu                                          18.04                  275d79972a86        6 days ago          94.6MB

$ docker push username/ubuntu:18.04

$ docker search username

NAME                      DESCRIPTION                                     STARS               OFFICIAL            AUTOMATED
username/ubuntu

automatic build

After July 26, 2021, this feature will only be available to paid users.

Automatic build ( Automated Builds) can automatically trigger the construction of the image, which is convenient for upgrading the image.

Sometimes, the user builds a mirror and installs a certain software. When the software releases a new version, the mirror needs to be manually updated.

The automatic build allows users to Docker Hubspecify to track a project on a target website (support GitHub or BitBucket), once a new submission ( commit) or a new tag ( tag) occurs in the project, Docker Hub will automatically build the image and push it Docker Hubto .

To configure automatic builds, include the following steps:

  • Log in to Docker Hub;
  • Click the avatar in the upper right corner of Docker Hub, and link (Linked Accounts) the target website in Account Settings (Account Settings);
  • Create a new or select an existing warehouse in Docker Hub, and select Configure Automated Builds in the Builds tab;
  • Select a project (need to contain Dockerfile) and branch in a target website;
  • Specify the location of the Dockerfile and save it.

Afterwards, the status of each build can be viewed in the Timeline tab of the Docker Hub's repository page.

Netease mirror

https://sf.163.com/product/repo

insert image description here
After login, visit https://c.163yun.com/hub#/home

insert image description here

Guess you like

Origin blog.csdn.net/zhaoyanjun6/article/details/130260521