docker:images:remove_old_and_unused_images
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 (docker SDK API).
The currently supported filters are:
- until (<timestamp>) - only remove containers, images, and networks created before given timestamp
- label (label=<key>, label=<key>=<value>, label!=<key>, or label!=<key>=<value>) - only remove containers, images, networks, and volumes with (or without, in case label!=… is used) the specified labels.
See Prune images for an example.
docker/images/remove_old_and_unused_images.txt · Last modified: 2020/07/15 09:30 by 127.0.0.1