- Snippet Path
Remove old/extra docker resources
- Authors
- ← Back to snippet list
- Name
- Aryan Ebrahimpour
- GitHub
- @avestura
- Snippet
Containers
Prune unused containers
shell
docker rm $(docker ps -f "status=exited" -aq)
Prune dangling containers created after an specific container
shell
docker rm $(docker ps -f "status=exited" -f "since=node:16-alpine" -aq)
Prune dangling containers created before an specific container
shell
docker rm $(docker ps -f "status=exited" -f "before=node:16-alpine" -aq)
Images
Prune dangling images
shell
docker rmi $(docker images -f "dangling=true" -q)
Prune dangling images created after an specific container
shell
docker rmi $(docker images -f "dangling=true" -f "since=node:16-alpine" -q)
Prune dangling images created before an specific container
shell
docker rmi $(docker images -f "dangling=true" -f "before=node:16-alpine" -q)
Prune images before a timestamp
shell
docker image prune -a --filter "until=24h"
Volumes
Prune dangling volumes
shell
docker volume rm $(docker volume ls -qf dangling=true)