Skip to content

Instantly share code, notes, and snippets.



Last active Jul 18, 2018
What would you like to do?
Quick alias to remove and clean untagged docker images and stopped containers.
# Credit to
# Add this to your bash profile.
clean_docker () {
# Remove stopped containers
docker rm $(docker ps -a -q);
# Remove untagged images
docker rmi $(docker images | grep "^<none>" | awk "{print $3}");
# Remove dangling volumes
docker volume rm $(docker volume ls -qf dangling=true)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment