mongodb/mongodb-atlas-local configure replica set

Hi, I am using the mongodb/mongodb-atlas-local docker image in docker-compose to run atlas deployment in local development with this configuration:

  mongodb_node1:
    image: mongodb/mongodb-atlas-local:7.0.15
    hostname: mongodb-node1
    ports:
      - 27017:27017
    volumes:
      - ./data/mongodb-atlas:/data/db:cached,z
      - ./data/mongodb-config:/data/configdb

The issue I have is that the replica set name is get from hostname or (if hostname is not defined) it’s random. Also the members in replica set have this hostname.

I can’t connect the replicaset using connection string mongodb://127.0.0.1:27017
It’s possible using the directConnection=true but I don’t want to use this.

Also it would be useful to be able to change the default port from 27017 to something different. I tried for example ovveride the etc/mongod.conf file of docker image, but it haven’t any impact.

1 Like