Five, common commands
5.1 Help command
-
docker version //验证:是否安装成功
-
docker info //对docker安装信息的描述
-
docker --help //docker命令提示(可以查询docker的所有操作命令)
5.2 Mirroring commands
5.2.1 docker images list local images
docker images //列出 *本地* 主机上的镜像
Attributes | Function |
---|---|
REPOSITORY | Indicates the mirror warehouse source |
TAG | Indicates the label of the mirror (personally understood as a version label) |
IMAGE ID | Indicates the image ID |
CREATED | Indicates when the image was created |
SIZE | Indicates the size of the image |
Note: 1. The same repository can have multiple TAGs, which represent different versions of the repository. We use REPOSITORY:TAG to define different images;
2. If you do not specify a tag for the image, for example, if you use hello-world, docker will use it by default hello-world:latest latest version image.
docker images -a //列出*本地所有*的镜像(含中间映像层)镜像是分层的
docker images -q //显示当前镜像的IMAGE ID
docker images -qa //显示当前镜像的所有分支镜像
docker images --digests //显示镜像的摘要信息
docker images --no-trunc //显示完整镜像信息
5.1.2 docker search + image name
docker search tomcat(可任意更换) //查看这个镜像名的所有版本
docker search -s 40 tomcat //-s表示这个镜像的点赞数,这条命令表示罗列出tomcat镜像点赞数超过40的tomcat镜像
已废弃
docker search --filter=stars=40 tomcat //代替上方已弃用的命令,查看点赞数超过40的tomcat的镜像
docker search --filter=stars=40 --no-trunc tomcat //查看完整镜像描述且点赞数超过给定值的tomcat的镜像
docker search --automated tomcat //查询自动构建的tomcat版本
已弃用
docker search --filter=is-automated=true tomcat //代替上方已弃用命令
5.1.3 docker pull + image name (pull [download] image)
docker pull tomcat //拉取所需镜像,后不加版本号默认为最新版本
5.1.4 docker rmi + image name
Delete a single mirror
docker rmi -f mirror name
docker rmi hello-world //删除hello-world镜像【如镜像正在使用则提示删除失败此时需要加 '-f' 进行强制删除】
Delete multiple images at the same time
docker rmi + image name 1:TAG image name 2:TAGdocker rmi -f hello-world nginx //同时删除hello-world和nginx镜像
Delete all images
docker rmi -f $(docker images -qa)
Note: "-f" in the delete command means forced deletion
I don't want to download those images repeatedly, so I leave it to everyone to test