怎么列出docker镜像

2023-04-14 00:06:00 docker 镜像 列出

如何列出docker镜像

要列出所有本地镜像,使用以下命令:

# docker images

REPOSITORY TAG IMAGE ID CREATED SIZE

my_image latest fce289e99eb9 2 weeks ago 1.84 GB

hello-world latest 690ed74de00f 2 weeks ago 1.84 kB

如果要列出所有镜像,包括中间层,请使用以下命令:

# docker images -a

REPOSITORY TAG IMAGE ID CREATED SIZE

my_image latest fce289e99eb9 2 weeks ago 1.84 GB

d64d6da5b304 2 weeks ago 1.84 GB

hello-world latest 690ed74de00f 2 weeks ago 1.84 kB

要列出特定镜像的标签,请使用以下命令:

# docker images my_image

REPOSITORY TAG IMAGE ID CREATED SIZE

my_image latest fce289e99eb9 2 weeks ago 1.84 GB

要从镜像列表中删除某个镜像,请使用以下命令:

# docker rmi my_image

Untagged: my_image:latest

Deleted: sha256:fce289e99eb9bca977dae136fbe2a82b6b7d4c372474c9235adc1741675f587e

Deleted: sha256:8c2e0f35e3cda113908027c9a6f7425e0f5cb7ecccb8a6535a9b4ba4dde4b4a8

Deleted: sha256:af0b15c8625bb1938f1d7b17081031f649fd14e6b233688eea3c5483994a17eb

Deleted: sha256:7f0a9f93b4aa3022c3a4c6d8b08e5a0f3dd4f5ebb0f2840f799170a5ba4c1e7b

如果要删除所有镜像,包括中间层,请使用以下命令:

# docker rmi $(docker images -a -q)

相关文章