命令
docker images
描述
docker images
的核心功能是输出当前宿主机上的image镜像列表。
镜像是容器的只读层,docker使用镜像来创建容器,新的数据在只读层上添加一个读写层,来组成可运行的容器,该容器也可以commit新的镜像。
帮助
[root@ceph0 ~]# docker images --help
Usage: docker images [OPTIONS] [REPOSITORY[:TAG]]
List images
Options:
-a, --all Show all images (default hides intermediate images)
--digests Show digests
-f, --filter filter Filter output based on conditions provided
--format string Pretty-print images using a Go template
--no-trunc Don't truncate output
-q, --quiet Only show numeric IDs
选项
- -a, –all=false 列出所有镜像包含父镜像
–digests 显示完成的64位的sha256 images ID,默认只显示前12位
- -f, –filter=[]
设置输出结果过滤条件,格式是“key=value”形式。如果有多个条件,可以多次指定,例如:–filter “foo=bar” –filter “bif=baz”。
当前支持的过滤条件如下
- dangling (boolean - true or false)
- label (label=
or label= = ) - before (
[: ], or <image@digest>) 在给定镜像创建之前创建的镜像 - since (
[: ], or <image@digest>) - 在给定镜像创建之后创建的镜像 - reference (pattern of an image reference) - 使用正则进行匹配
–format string 显示信息指定格式,可以输出json格式的信息
-
–no-trunc=false 显示所有因内容过长而省略的部分
-
-q, –quiet 只显示镜像的ID一列信息
示例
- 显示镜像列表 ``` $ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE