Skip to content

Instantly share code, notes, and snippets.

@maik-s
Created July 10, 2019 17:11
Show Gist options
  • Save maik-s/6feb4b1f86a97a12d00f6afbe5d26272 to your computer and use it in GitHub Desktop.
Save maik-s/6feb4b1f86a97a12d00f6afbe5d26272 to your computer and use it in GitHub Desktop.
command to kill exited docker containers easily
# Add this command to your ~/.bashrc
killdockercontainers() {
docker container ls --all | grep "Exited" | grep -Eo "^[a-z0-9]{12}" | xargs -I ID docker stop ID | xargs -I ID docker rm ID
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment