docker images
最后更新于:2022-04-02 03:03:44
[TOC]
## docker images
列出本地镜像
## 语法
```
docker images [OPTIONS] [REPOSITORY[:TAG]]
options
-a :列出本地所有的镜像(含中间映像层,默认情况下,过滤掉中间映像层);
--digests :显示镜像的摘要信息;
-f :显示满足条件的镜像;
--format :指定返回值的模板文件;
--no-trunc:显示完整的镜像信息;
-q :只显示镜像ID
-f,--filter : 过滤条件
```
## 示例
### 列出镜像
```
> docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
mymysql v1 37af1236adef 5 minutes ago 329 MB
runoob/ubuntu v4 1c06aa18edee 2 days ago 142.1 MB
```
### 通过名字过滤
```
> docker images java
REPOSITORY TAG IMAGE ID CREATED SIZE
java 8 308e519aac60 6 days ago 824.5 MB
java 7 493d82594c15 3 months ago 656.3 MB
java latest 2711b1d6f3aa 5 months ago 603.9 MB
```
### 搜索悬挂的镜像并删除
```
> docker images --filter "dangling=true"
REPOSITORY TAG IMAGE ID CREATED SIZE
8abc22fbb042 4 weeks ago 0 B
48e5f45168b9 4 weeks ago 2.489 MB
bf747efa0e2f 4 weeks ago 0 B
> docker rmi $(docker images -f "dangling=true" -q)
8abc22fbb042
48e5f45168b9
bf747efa0e2f
```
';