问题
My docker-compose.yml, among other images, uses official mongo docker image:
mongodb:
container_name: mongodb
image: mongo:3.2
volumes:
- mongo_data:/data/db
ports:
- "57017:27017"
restart: always
The problem is that I need mongo deamon to run with --httpinterface option. How can I change my docker-compose.yml to pass this parameter to the final CMD ["mongod"]?
Is it possible without touching the mongo image? Forking this image to only add one parameter would be an overkill.
回答1:
You can use command option of docker-compose.yml
mongodb:
container_name: mongodb
image: mongo:3.2
command: mongod --httpinterface
volumes:
- mongo_data:/data/db
ports:
- "57017:27017"
restart: always
来源:https://stackoverflow.com/questions/46401794/how-to-pass-a-parameter-from-docker-compose-to-service-runned-in-docker-image