Skip to content

Instantly share code, notes, and snippets.

@dnephin
Created August 17, 2017 21:58
Show Gist options
  • Save dnephin/0aa8e8962ebcdcebff1cec7315a224dd to your computer and use it in GitHub Desktop.
Save dnephin/0aa8e8962ebcdcebff1cec7315a224dd to your computer and use it in GitHub Desktop.
Show docker-compose down -v removes anonymous volumes from the Dockerfile
version: '2'
services:
web:
build: .
FROM alpine:3.6
RUN mkdir /foo
VOLUME /foo
$ docker volume ls
DRIVER VOLUME NAME
$ docker-compose up -d
Building web
Step 1/3 : FROM alpine:3.6
---> 7328f6f8b418
Step 2/3 : RUN mkdir /foo
---> Running in eb658aaf06b8
---> cd9da49cdafe
Removing intermediate container eb658aaf06b8
Step 3/3 : VOLUME /foo
---> Running in 71008c613b97
---> a644a350204b
Removing intermediate container 71008c613b97
Successfully built a644a350204b
Successfully tagged tmp_web:latest
WARNING: Image for service web was built because it did not already exist. To rebuild this image you must use `docker-compose build` or `docker-compose up --build`.
Creating tmp_web_1 ...
Creating tmp_web_1 ... done
$ docker volume ls
DRIVER VOLUME NAME
local d699f740385d7656088fcfb9a4f3700dc8ecc555c7de616e06e24f25bb3aca38
$ docker-compose -f /tmp/dc.yml down -v
Removing tmp_web_1 ... done
Removing network tmp_default
$ docker volume ls
DRIVER VOLUME NAME
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment