Reputation: 11
In my Docker Instance, I created a volume called jokes
. I'm trying to build out my service now with docker-compose up
but I keep getting this error message:
ERROR: The Compose file './docker-compose.yml' is invalid because:
services.db.volumes contains an invalid type, it should be an array
Here is my docker-compose.yml
file:
version: '3.6'
services:
web:
build: .
command: puma
depends_on:
- db
environment:
DATABASE_URL: "postgres://postgres@db"
ports:
- "3000:3000"
volumes:
- "./:/app"
working_dir: /app
db:
image: "postgres:10.3-alpine"
volumes: "-jokes: /var/lib/postgresql/data"
volumes:
jokes: ~
How should I fix this?
Upvotes: 1
Views: 1649
Reputation: 6673
How should I fix this?
As detailed in the official documentation you are required to give a list there (hence complaint about list), so move hyphen outside the quotes like so:
volumes:
- "jokes:/var/lib/postgresql/data"
Upvotes: 4