docker-scripts/docker-clean-all

10 lines
282 B
Bash
Executable File

#!/bin/bash
# remove exited containers:
docker ps --filter status=dead --filter status=exited -aq | xargs -r docker rm -v
# remove unused images
docker images --no-trunc | grep '<none>' | awk '{ print $3 }' | xargs -r docker rmi -f
# remove unused volumes:
docker volume prune -f