Docker compose Unsupported config option for service volume mongodb

That’s a small mistake on your part, the volumes section of the docker-compose.yaml file is related to all services and not one in particular, because of how yaml files are formatted the indentation level matters a lot, in your example you didn’t use the volumes parameter, instead you defined a service called volumes and services don’t have a parameter called mongodb.

You have to simply decrease the identation level on the last 3 lines and it will work just fine.

version: '3.8'

services:
  mongo:
    image: mongo:4.2.8
    ports:
      - 27017:27017
    volumes:
      - mongodb:/data/db
      - mongodb_config:/data/configdb
volumes:
  mongodb:
  mongodb_config:

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top