Created
July 10, 2019 17:11
-
-
Save maik-s/6feb4b1f86a97a12d00f6afbe5d26272 to your computer and use it in GitHub Desktop.
command to kill exited docker containers easily
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
# 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