问题
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?
回答1:
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
回答2:
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
来源:https://stackoverflow.com/questions/56097915/equivalent-of-docker-option-config-in-docker-compose