Skip to content

Instantly share code, notes, and snippets.

@etiennemarais

etiennemarais/.zshrc

Last active Jul 18, 2018
Embed
What would you like to do?
Quick alias to remove and clean untagged docker images and stopped containers.
#
# Credit to http://jimhoskins.com/2013/07/27/remove-untagged-docker-images.html
#
# 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