Every time I run docker-compose up, it creates an additional volume that won’t be in use the next time when running the command. It seems like it is a temporary volume or something that doesn’t get deleted when running docker-compose down.
Any idea why and how to avoid it?
Did you name your volumes?
Yes, I call it vidly and Docker gets that name from the last line of the docker-compose.yml file.
version: "3.8"
services:
frontend:
depends_on:
- backend
build: ./frontend
ports:
- 3000:3000
backend:
depends_on:
- db
build: ./backend
ports:
- 3001:3001
environment:
DB_URL: mongodb://db/vidly
command: ["sh", "docker-entrypoint.sh"]
db:
image: mongo:4.0-xenial
ports:
- 27017:27017
volumes:
- vidly:/data/db
volumes:
vidly: