Created
September 18, 2019 19:17
-
-
Save eacmen/ba627031c635878b55266cb778eb5e9b to your computer and use it in GitHub Desktop.
wipe a container state from existence
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/bash | |
SERVICE=$1 | |
read -r -p "This will completely wipe the ${SERVICE} database and restart the service. Are you sure? [y/N] " response | |
if [[ "$response" =~ ^([yY][eE][sS]|[yY])+$ ]] | |
then | |
docker-compose stop ${SERVICE} | |
docker-compose rm ${SERVICE} | |
VOLUME=`docker volume ls | grep ${SERVICE} | tr -s ' ' | cut -d' ' -f2` | |
docker volume rm -f ${VOLUME} | |
docker-compose create ${SERVICE} && docker-compose start ${SERVICE} | |
else | |
echo "Ok I didn't think so" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment