docker mongodb replication on same server

I want to setup on my dev machine a mongodb replication, same machine running mongodb instances on docker.

so i have docker containers running mongodb instances on them, working, fine and setup.

  • Connect to Remote MSSQL db from Linux Docker container
  • Bitbucket Pipelines. Cannot specify windowsservercore docker image
  • Restarting host from docker container
  • Docker compose version 3 doesn't work as I expected
  • creating a docker image with the same name
  • accessing a docker container's file system through terminal
  • // some images omitted

    $ docker ps -a>27017/tcp>27017/tcp>27017/tcp

    then, on my PRIMARY, i tried adding something

    PRIMARY> rs.add("")                                                                                                                                  
            "ok" : 0,
            "errmsg" : "need most members up to reconfigure, not ok :",
            "code" : 13144
    PRIMARY> rs.add("")                                                                                                                                  
            "ok" : 0,
            "errmsg" : "need most members up to reconfigure, not ok :",
            "code" : 13144

    how do i add mongodb instances inside containers to replication using docker?

  • Docker (compose) fails to build container when mounting single file from official Wordpress image
  • Gracefully Stopping Docker Containers
  • Is it feasible to control Docker from inside a container?
  • Wildfly standalone file not being added in dockerfile
  • Build docker image with jetty - when should I build?
  • Node http request to Docker Remote API - No response
  • One Solution collect form web for “docker mongodb replication on same server”

    nvm, i solved my question.

    from this post,, i give credit to the author.

    i have disabled my journal to my slaves

       smallFiles: true
       enabled: false

    then get the IP from container

    $ docker inspect e123

    then in mongo-cli

    PRIMARY> rs.add("") 
    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.