Hi there,
Well, i’'m facing a mystery that make me crazy since more than 1 year…
I have a docker-compose with a MongoDb container, i’m instanciating in différent environnements.
As exemples i may have :
- Multiple WSL instance, each with an instance on this same docker-compose.yml
- or 1 WSL instance and an Oracle VMbox, still with this same docker-compose.yml
And most of the time, only the 1st MongoDB container instance work while the others instances in the other virtual environnements doesn’t respond on the exposed port in the docker-compose network.
Here the mongo definition ( this is obviously not a configuration problem as it’s working when there only 1 virtual environnement using it )
mongodb:
image: mongo:latest
restart: unless-stopped
environment:
- MONGO_DATA_DIR=/data/mongodb
- MONGO_INITDB_ROOT_USERNAME=admin
- MONGO_INITDB_ROOT_PASSWORD=admin
volumes:
- ${DOCKER_DATA_DIR}/mongo-data:/data
expose:
- 27017
networks:
- prod_network
Weird things are :
- How a MongoDb in a WSL instances can impact others MongoDb in other WSL instance or even weirder in a VMBox ???
- If i add the “ports” directive to directly bind the 27017 port of theses container to the host machine, MongoDB work & respond ( on the host machine, not from the compose network )…
I’ve tried to connect to theses Mongo containers from others containers in the same network, using theirs aliases and IP; But nothing work…
I’ll inspected the instances, d-c says they have IP and the exposed port on these network…
I just have no more idea
Is there anybody with some clues on this ?