# Docker清理悬空镜像(空(none)镜像)

### 有用镜像

通过docker images -a 命令才会显示的none镜像，这些镜像是镜像分层的中间镜像，同时这些镜像不会造成空间损耗

### 无用镜像

通过docker images 命令显示的none镜像，这些镜像是由于新加镜像占用了原有镜像的标签，原有镜像就变成了none镜像。\
这些none镜像有一个好听的名字：空悬镜像（dangling images）,同时docker并没有自动删除这些镜像的机制。\
那么如何删除这些无用镜像呢？

### 删除无用镜像

```shell
docker rmi $(docker images -f "dangling=true" -q)
或
docker image prune
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://tuonioooo-notebook.gitbook.io/docker/advanced/docker-none-image.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
