Article directory
Preface
This article mainly introduces some commands related to mirroring in docker. It is a summary of the Kuangshen course . It serves as a manual to help bloggers and students who use docker find and recall.
Experimental environment: Xshell+CentOS+docker
1. Introduction to docker commands
1. Help command
docker version #查看docker的版本信息
docker info #显示docker的系统信息,包括镜像和容器的数量
docker 命令 --help
The first two commands will not be described in detail here. We will mainly demonstrate the usage of the last help command:
when we are not clear about the options of a certain command in docker and the use of the command, for example, we want to view docker images option, we can use this help command.
As shown in the figure above, we can view the introduction of the docker images command and the options available for this command.
2. Display mirror
docker images [可选项]#查看所有本地的主机上的镜像
As shown in the figure above, we can view relevant information about the image on our local host such as:
name | introduce |
---|---|
REPOSITORY | Mirrored warehouse source |
TAG | Image tag (image version number) |
IMAGE ID | Image ID |
CREATED | Image creation time |
SIZE | Image size |
Options introduction:
-
-a – all
Function: List all images -
-q --quiet
only lists the image ID
3. Search for images
Ps: There are many images for us to use in dockerhub. We use this command to have the same effect as searching for images in dockerhub.
docker search [可选项]#搜索镜像
As shown in the figure below, we search for the mysql mirror:
option introduction:
- –filter
usage: The optional option is used to filter and filter the images you want to find.
As shown in the figure above, the MySQL images with more than 3,000 likes are searched.
4. Download the image
docker pull 镜像名[:tag]#tag是版本号可以在dockerhub上查看,如果不加tag那就是默认latest
As shown below, we directly download a centos image:
5. Delete the image
docker rmi -f 镜像名或镜像ID #删除单个镜像
docker rmi -f 镜像ID 镜像ID ... #删除多个镜像
docker rmi -f $(docker images -aq)#删除所有镜像
As shown below we delete the centos image we just downloaded:
Summarize
The above is the main content of this article, I hope it can be helpful to you.