Please indicate the source of the reprint: http://blog.csdn.net/zhaoyanjun6/article/details/130260521
This article comes from [Zhao Yanjun's blog]
Article directory
Official warehouse Docker Hub
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 login
the command and interactively entering the user name and password.
You can docker logout
log out .
view mirror
View the official image provided by Explore
search mirror
You can use docker search
the command to find the image in the official warehouse, and use docker pull
the command to download it locally.
For example, to search centos
for 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 push
the command Docker Hub
.
In the following commands, username
please 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 Hub
specify 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 Hub
to .
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
After login, visit https://c.163yun.com/hub#/home