Created
November 24, 2014 16:09
-
-
Save bdw/eb22c70c797d124493a9 to your computer and use it in GitHub Desktop.
docker remove images and containers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
for id in `docker ps -a | cut -c 1-20 | grep -v 'CONTAINER ID'`; do docker rm -f $id; done | |
if [ "$1" = "-a" ]; then | |
for id in `docker images | cut -c 41-60 | grep -v 'IMAGE ID'`; do docker rmi -f $id; done | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment