📝 Edit page
➕ Add page
Prune
Remove unused data
Related
- Delete cheatsheet
Help
$ docker system prune [OPTIONS]
Options | Description |
---|---|
--all , -a |
Remove all unused images not just dangling ones. |
--force , -f |
Do not prompt for confirmation |
Remove all unused - containers, networks, images, and cache
$ docker system prune
With no options, you will get a confirmation prompt and told that these will be removed:
- All stopped containers
- All networks not used by at least one container
- All dangling images
- All build cache
Remove unused containers
$ docker container prune
Or based on docs for rm. Remove stopped containers.
$ docker rm $(docker ps --filter status=exited -q)
Remove unused images
$ docker image prune
Or
$ docker rmi $(docker images -a -q)
Remove volumes
Remove dangling
$ docker volume rm $(docker volume ls -qf dangling=true)
Remove all volumes
Use quiet mode for ls
to get just the volume ID.
$ docker volume rm $(docker volume ls -q)