Created
April 6, 2016 19:33
-
-
Save IcaroBichir/06c99e87f7baffcdbf5af0f0ba66fb9a to your computer and use it in GitHub Desktop.
Add this functions on your bash_profile to clean containers and images
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function docker_clean_containers() { | |
docker ps -a | awk '{print $1}' | grep -v CONTAINER | while read container_id; do | |
docker kill ${container_id} | |
docker rm ${container_id} | |
done | |
} | |
function docker_clean_images() { | |
docker images | awk '{print $3}' | grep -v IMAGE | while read container_image; do | |
docker rmi ${container_image} | |
done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment