Skip to content

Instantly share code, notes, and snippets.

@hnakamur
Created March 19, 2016 09:19
Show Gist options
  • Save hnakamur/b99af9e17e372aaa12c7 to your computer and use it in GitHub Desktop.
Save hnakamur/b99af9e17e372aaa12c7 to your computer and use it in GitHub Desktop.
Clean docker exited processes and dangling images
#!/bin/bash
eval `docker-machine env default`
processes=`docker ps -q -f status=exited`
if [ -n "$processes" ]; then
docker rm $processes
fi
images=`docker images -q -f dangling=true`
if [ -n "$images" ]; then
docker rmi $images
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment