Answer the question
In order to leave comments, you need to log in
Is it possible to run local mongo in parallel with mongo launched via docker-compose?
There is a project built from containers and run via docker-compose. One container there is mongodb. Basically, everything works. But the tech lead asked to make this whole system start painlessly, even if a local monga is installed and running on the system.
I decided to do it through an override in the docker-compose.override file. I'm not a docker expert and thought that if you specify other ports than the default mongi port, it will all work. It turned out that ports, instead of rewriting, are concatenated. That is, the conflict remains, the project does not start. But everything works fine if you turn off the local mongo.
Here is docker-compose.yml
version: '3'
services:
# тут другие контейнеры
mongo:
image: mongo:latest
container_name: 'mongodb'
environment:
- MONGO_DATA_DIR=/data/db
volumes:
- ./data/db:/data/db
ports:
- 27017:27017
command: mongod --smallfiles --logpath=/dev/null
version: '3'
services:
mongo:
ports:
- 27001:27017
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question