====== Docker - Images - Remove old and unused images ====== Delete **ALL** dangling data: docker system prune i.e. In order: containers stopped, volumes without containers and images with no containers). Even unused data, with **-a** option. You also have: docker container prune docker image prune docker network prune docker volume prune For unused images, use **docker image prune -a** (for removing dangling and ununsed images). **WARNING**: 'unused' means "images not referenced by any container": be careful before using **-a**. **docker system prune --all** will remove **all** unused images not just dangling ones... which can be a bit too much. ---- Combining **docker xxx prune** with the **--filter** option can be a great way to limit the pruning ([[https://docs.docker.com/engine/api/sdk/|docker SDK API]]). The currently supported filters are: * **until ()** - only remove containers, images, and networks created before given timestamp * **label (label=, label==, label!=, or label!==)** - only remove containers, images, networks, and volumes with (or without, in case label!=... is used) the specified labels. See **[[https://docs.docker.com/config/pruning/#prune-images|Prune images]]** for an example.