Docker images 命令

发布于 2022-07-18 11:26:39 更新于 2022-07-18 11:26:39

作用

images 命令专门用于操作 Docker 镜像。

使用方法

docker images [OPTIONS] [REPOSITORY]

List images

 -a, --all=false      Show all images (default hides intermediate images)
  --digests=false      Show digests
  -f, --filter=[]      Filter output based on conditions provided
  --help=false         Print usage
  --no-trunc=false     Don't truncate output
  -q, --quiet=false    Only show numeric IDs

示例

查看本机已下载的镜像:

$ sudo docker imgaes
REPOSITORY           TAG       IMAGE ID        CREATED      VIRTUAL SIZE
docker.io/ubuntu     latest    63e3c10217b8    7 days ago    188.3 MB
docker.google/etcd   2.1.1     2c319269dd15    8 days ago    23.32 MB
docker.io/postgres   latest    730d1d72bda2    2 weeks ago   265.3 MB
centos               latest    770327a1e9e7    2 weeks ago   418.9 MB
…

将 ID 完整展现:

$ sudo docker images --no-trunc
REPOSITORY                  TAG                 IMAGE ID                                                           CREATED             VIRTUAL SIZE
scratch1                    latest              dc869bfd3085af05a1a070c7409193e8be88de00ff4560e2e9af80ffa9d2041d   58 minutes ago      0 B
registry.liugang/centos     latest              770327a1e9e746cf8d4449a7134e87917982b33c7f5cea584d941350f5ead7ac   4 weeks ago         418.9 MB
registry.liugang/busybox    latest              8c2e06607696bd4afb3d03b687e361cc43cf8ec1a4a725bc96e39f05ba97dd55   4 months ago        2.43 MB
docker.io/scratch           latest              511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158   2 years ago         0 B

展现没有 tag 的镜像:

$ sudo docker images --filter "dangling=true"
REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
<none>              <none>              b133995b6291        About an hour ago   0 B
<none>              <none>              6fae83243a01        About an hour ago   0 B
<none>              <none>              4c6412305cfa        About an hour ago   0 B