Skip to content

Instantly share code, notes, and snippets.

@vitaly
Created May 28, 2015 14:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vitaly/9aeeba4cd2024b4580ae to your computer and use it in GitHub Desktop.
Save vitaly/9aeeba4cd2024b4580ae to your computer and use it in GitHub Desktop.
#!/bin/bash
# cleanup all stopped containers
# except for those that have 'data' in the name
echo Removing all stopped non-data containers
docker ps --filter "status=exited" \
| grep -v data \
| grep -v ^CONTAINER \
| awk '{print $1}' \
| xargs docker rm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment