Skip to content

Instantly share code, notes, and snippets.

@dpetersen
Created January 18, 2016 00:27
Show Gist options
  • Save dpetersen/a9d40017168f755aff26 to your computer and use it in GitHub Desktop.
Save dpetersen/a9d40017168f755aff26 to your computer and use it in GitHub Desktop.
Hopefully a safe way to clean up stopped containers and orphaned images from Docker. Gee, maybe there should be a way to do this that doesn't involve googling for it every time. http://stackoverflow.com/questions/17236796/how-to-remove-old-docker-containers
#!/bin/bash
docker rm -v $(docker ps -q -f status=exited)
docker rmi $(docker images -q -f "dangling=true")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment