Clean Up

Volumes

docker volume prune

Remove all volumes not used by at least one container

Images

Remove all dangling (not tagged and is not associated with a container) images:

docker image prune

Remove all images which are not used by existing containers

docker image prune -a

Containers

Stop all running containers

docker stop $(docker ps -a -q)

Delete stopped containers

docker container prune

Clean All

Cleans up dangling images, containers, volumes, and networks (ie, not associated with a container)

docker system prune

Additionally, remove any stopped containers and all unused images (not just dangling images)

docker system prune -a
Comments