Skip to content

Instantly share code, notes, and snippets.

@IcaroBichir
Created April 6, 2016 19:33
Show Gist options
  • Save IcaroBichir/06c99e87f7baffcdbf5af0f0ba66fb9a to your computer and use it in GitHub Desktop.
Save IcaroBichir/06c99e87f7baffcdbf5af0f0ba66fb9a to your computer and use it in GitHub Desktop.
Add this functions on your bash_profile to clean containers and images
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