Skip to content

Instantly share code, notes, and snippets.

@mihow
Last active January 28, 2019 20:04
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 mihow/1788e8c64f3c8f24abee853533cb5e68 to your computer and use it in GitHub Desktop.
Save mihow/1788e8c64f3c8f24abee853533cb5e68 to your computer and use it in GitHub Desktop.
Remove named docker volume in docker-compose project
#! /bin/sh
set -e
DOCKER_COMPOSE_SERVICE_NAME=db
CONTAINER_ID=`docker-compose ps -q $DOCKER_COMPOSE_SERVICE_NAME`
FULL_VOLUME_NAME=`docker inspect --format='{{range .Mounts}}{{.Name}} {{end}}' $CONTAINER_ID`
docker volume rm $FULL_VOLUME_NAME
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment