-
-
Save mattak/10436012 to your computer and use it in GitHub Desktop.
docker stop container & remove container by grepping
This file contains 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/sh | |
# docker stop & remove | |
if [ $# -lt 1 ]; then | |
echo "usage: dsr <grep word>" | |
exit 0 | |
fi | |
grepword=$1 | |
process=$(sudo docker ps | grep $grepword | awk '{print $1}') | |
sudo docker stop $process | |
sudo docker rm $process |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment