Skip to content

Instantly share code, notes, and snippets.

@jeffesp
Last active September 11, 2018 12:53
Show Gist options
  • Save jeffesp/99936794f55ec38e4276311fc024140f to your computer and use it in GitHub Desktop.
Save jeffesp/99936794f55ec38e4276311fc024140f to your computer and use it in GitHub Desktop.
Docker Cleanup

Not knowing that docker rm would just skip running containers I came up with the following:

docker ps -a | grep -v "Up" | cut -f 1 -d ' ' | tail -n +2 | xargs docker rm

but the docker docs say:

docker rm $(docker ps -a -q)

which is probably better as it doesn't depend on inverse grepping for "Up".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment