# Prune dangling and unused images

To remove dangling or unused images from an environment, navigate to **Images** in your environment menu and click **Prune** from the **Images** list.

<figure><img src="/files/Kr4C5D7DdWicryG5GBts" alt=""><figcaption></figcaption></figure>

You can identify dangling images by the **dangling** tag, and unused images by the **unused** label displayed next to the image ID.

<figure><img src="/files/5Il0ai6BtDVkqEt3AONe" alt=""><figcaption></figcaption></figure>

On selecting **Prune**, Portainer will by default delete all untagged (dangling) images, equivalent to running `docker image prune`. To also remove tagged images that are not in use by any container, select **Delete all unused images** in the confirmation dialog - this is the equivalent to running `docker image prune -a`. To also remove cached build layers that are no longer in use, select **Clear Docker build cache**.

<figure><img src="/files/z8ndIyh56Z8g3f1Nvjyv" alt=""><figcaption></figcaption></figure>

Press **Continue** to complete the prune. On success, a confirmation dialog will show how much disk space was reclaimed.

{% hint style="info" %}
If a prune operation reports 0B reclaimed, this is likely because the image layers are still referenced by existing images, or are being retained in the Docker build cache. Select **Clear Docker build cache** to address this. See this [Docker forum discussion](https://forums.docker.com/t/cant-delete-images-with-docker-prune-but-with-docker-system-prune-and-docker-builder-prune/139267/8) for more detail on this behaviour.
{% endhint %}


---

# 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://docs.portainer.io/sts/user/docker/images/prune-dangling-and-unused-images.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.
