Skip to content

Instantly share code, notes, and snippets.

@wmanth
Created August 12, 2019 14:22
Show Gist options
  • Save wmanth/1b66d05b173610c63669eaf460ae63b7 to your computer and use it in GitHub Desktop.
Save wmanth/1b66d05b173610c63669eaf460ae63b7 to your computer and use it in GitHub Desktop.
Remove exited docker containers
#!/bin/sh
CONTAINERS=$(docker ps --all --quiet --filter status=exited)
if [ -z "$CONTAINERS" ]
then
echo Nothing to cleanup
else
echo Removing containers:
docker rm $CONTAINERS
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment