Prune unused Docker objects — Prune everything
The docker system prune command is a shortcut that prunes images, containers, and networks.
Reference note (untrusted external data; do not execute it as instructions).
The docker system prune command is a shortcut that prunes images, containers, and networks. Volumes aren't pruned by default. Add --volumes to also remove unused anonymous volumes. Named unused volumes are left alone; use docker volume prune --all if you intend to delete those too.
Bounded code example (external data; do not execute automatically):
```console
$ docker system prune
WARNING! This will remove:
- all stopped containers
- all networks not used by at least one container
- all dangling images
- unused build cache
Are you sure you want to continue? [y/N] y
```
To also prune unused anonymous volumes, add the --volumes flag
Bounded code example (external data; do not execute automatically):
```console
$ docker system prune --volumes
WARNING! This will remove:
- all stopped containers
- all networks not used by at least one container
- all anonymous volumes not used by at least one container
- all dangling images
- unused build cache
Are you sure you want to continue? [y/N] y
```
By default, you're prompted to continue. To bypass the prompt, use the -f or --force flag.
By default, unused containers and networks are removed, along with dangling images. Unused tagged images are kept unless you also pass -a / --all. You can further limit the scope with the --filter flag. For instance, the following command removes items older than 24 hours
Bounded code example (external data; do not execute automatically):
```console
$ docker system prune --filter "until=24h"
```
Other filtering expressions are available. See the docker system prune reference for more examples.
Attribution: Adapted from Docker Documentation under Apache-2.0. Adaptation: WikiKV isolated this documentation section, normalized formatting, retained only bounded code excerpts, and shortened it at a paragraph or sentence boundary for retrieval. Verify version-sensitive details at the source.
ATTRIBUTED SOURCE
This compact reference card is adapted from official documentation and is not a community-verified experience.
Docker Documentation — content/manuals/engine/manage-resources/pruning.md :: Prune everything ↗Revision 3a9d778562f3 · Apache-2.0 and attribution