1 Pull the mirror

The syntax is docker pull {image_repository_name}. {image_repository_name} is the repository name of the image. Remember to configure the image accelerator to speed up the image pulling speed.

2 Lists the existing mirrors

docker images

The existing image list is a table. The meanings of each field are as follows:

Field | instructions – | – REPOSITORY | mirror name TAG | mirror label, usually version name; Latest said the latest version of the IMAGE ID | mirror ID CREATED | IMAGE creation time. How long time from now as format description SIZE | image SIZE

The IMAGE ID is obtained by sha256 algorithm based on the metadata configuration file of the IMAGE. The actual display is the first 12 bits of the sha256 algorithm.

–no-trunc docker images –no-trunc

No-trunc is a short form of non-truncated.

Truncated / ˈ tr ʌ ŋ ke ɪ t /

To shorten by or as if by cutting off.

3 Querying a Mirror

In addition to querying images on the Docker Hub website, you can also use the command line directly to query images. Syntax: docker search {image_name_key} {image_name_key} is the image name keyword. For example, query a mirror whose keyword is “python” :

The result of the query is also a list, where each field has the following meanings:

Field | instructions – | – NAME | mirror NAME; Generally take / / said released from unofficial warehouse DESCRIPTION | image shows that the default display only sections describe STARS | mirror rating star number, can be used as a mirror to choose a dimension of OFFICIAL | whether is the OFFICIAL version, in general, If the official version is more stable AUTOMATED | an AUTOMATED build

Users can bind their Docker Hub to Github or Bitbucket accounts, and when the code is submitted, the image repository can be built automatically. In other words, it is bound with the code version control system to realize the function of automatically building the mirror for code changes, similar to Jenkins, which can detect code changes and then automatically build the project.

Docker Hub allows you to give your favorite image a star rating, which is a bit like GitHub’s star rating.

The Search command is powerful enough to filter and print out a complete image description. For example, if we want to search for a Python image with a number of stars ≥ 30 and print a complete image description, we can type docker search –filter=stars=30 –no-trunc Python.

4 Deleting a Mirror

docker rmi [REPOSITORY]:[TAG]

REPOSITORY refers to the image name; TAG refers to the mirror TAG.

For instance to remove called 192.168.33.10:50000 / ms/app – config and tag for the latest image. We can perform the docker rmi 192.168.33.10:50000 / ms/app – config: latest command:

5 Import and export images

The test environment is usually on the Intranet. If it is not convenient to directly connect to the test environment, the image import and export commands are used.

(1) Export the image

docker save [REPOSITORY:TAG] > xxx.tar

Like:

Docker save 191.168.10. XXX: 8083 / ms/app - config: latest > app - config. The tar

You can also specify the location of the image package:

docker save [REPOSITORY:TAG] > [path][xxx.tar]

Like:

CD docker save 191.168.10. XXX: 8083 / ms/app - config: latest > / host_data/images/app - config. The tarCopy the code

(2) Import an image

Tar docker load < app-config.tar docker load < app-config.tar