Skip to content

Instantly share code, notes, and snippets.

@mattak
Last active August 29, 2015 13:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattak/10436012 to your computer and use it in GitHub Desktop.
Save mattak/10436012 to your computer and use it in GitHub Desktop.
docker stop container & remove container by grepping
#!/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