Skip to content

Instantly share code, notes, and snippets.

@biggora
Created February 12, 2016 18:25
Show Gist options
  • Save biggora/08247b19856e2c5d4132 to your computer and use it in GitHub Desktop.
Save biggora/08247b19856e2c5d4132 to your computer and use it in GitHub Desktop.
How to remove unused Docker containers and images
#!/bin/bash
# Delete all containers
docker rm $(docker ps -a -q) # or docker ps -q -a | xargs docker rm
# Delete all images
docker rmi $(docker images -q)
# delete all untagged images
docker rmi $(docker images | grep “^<none>” | awk ‘{print $3}’)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment