Skip to content

Instantly share code, notes, and snippets.

@eacmen
Created September 18, 2019 19:17
Show Gist options
  • Save eacmen/ba627031c635878b55266cb778eb5e9b to your computer and use it in GitHub Desktop.
Save eacmen/ba627031c635878b55266cb778eb5e9b to your computer and use it in GitHub Desktop.
wipe a container state from existence
#!/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