I'm trying to run mongo with docker-compose. From the docker mongo page I have the following command

$> docker run --name some-mongo -v /my/custom:/etc/mongo -d mongo --config /etc/mongo/mongod.conf

version: '3'
services:
  db:
    image: mongo:4
    ports: 
      - "27017:27017"
    volumes:
      - ./storage/mongo:/data/db:rw

Now I would also like to define the mongod.conf; --config /etc/mongo/mongod.conf but how can you do that inside docker-compose?

2 Answers

0
MouTen On

The --config is part of mongo, not docker. You may still use it with docker-compose like

docker-compose run db --config /etc/mongo/mongod.conf
0
matanper On

You can use command

services:
  db:
    image: mongo:4
    command: "mongo --config /etc/mongo/mongod.conf" 
    ports: 
      - "27017:27017"
    volumes:
      - ./storage/mongo:/data/db:rw