Skip to content

Instantly share code, notes, and snippets.

@wyllie
Created November 16, 2018 16:47
Show Gist options
  • Save wyllie/b0f7e61fe5ccbaa2b47e5d0355d584d4 to your computer and use it in GitHub Desktop.
Save wyllie/b0f7e61fe5ccbaa2b47e5d0355d584d4 to your computer and use it in GitHub Desktop.
#!/bin/bash
# remove containers that have exited
docker rm -v $(docker ps -a -q -f status=exited)
# remove images that are not being used
docker rmi -f $(docker images -a "dangling=true" -q)
# remove volumes that are not being used
docker volume rm $(docker volume ls -qf dangling=true)
# Delete all containers
###docker rm $(docker ps -a -q)
# Delete all images
###docker rmi $(docker images -q)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment