Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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