deleting all the stopped containers
docker rm `docker ps -a -q`
deleting all the stopped containers except for recent 5 containers
docker ps -a -q | sed 1,5d | awk '{print $1}' | xargs --no-run-if-empty docker rm
deleting all the containers used more than 1 week ago
docker ps -a | grep -v 'hours ago' | grep -v 'days ago' | awk '{print $1}' | xargs --no-run-if-empty docker rm
deleting docker images which REPOSITORY and TAG is none
docker images | grep none | awk '{print $3}' | xargs docker rmi
Top comments (0)