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.

  • docker create service unavailable
  • Running httpd in docker container requires restart after updating the services in other containers
  • mongodump in mongodb container
  • Is it possible for a the host to authenticate to a KDC running on a Docker container?
  • How can I find public images (like ubuntu) in Docker-Hub, using REST API?
  • What is the default working directory when running a mesos chronos command
  • // some images omitted

    $ docker ps -a
    0.0.0.0:49157->27017/tcp
    0.0.0.0:49156->27017/tcp
    0.0.0.0:49155->27017/tcp
    

    then, on my PRIMARY, i tried adding something

    PRIMARY> rs.add("172.17.0.141:27017")                                                                                                                                  
    {
            "ok" : 0,
            "errmsg" : "need most members up to reconfigure, not ok : 172.17.0.141:27017",
            "code" : 13144
    }
    
    //===============
    
    PRIMARY> rs.add("0.0.0.0:27017")                                                                                                                                  
    {
            "ok" : 0,
            "errmsg" : "need most members up to reconfigure, not ok : 0.0.0.0:27017",
            "code" : 13144
    }
    

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

  • Docker - Local Development on container
  • Docker CLI in Freestyle Build Shell
  • Gcloud and Docker: Pushing images is failing because of insufficient space
  • How to connect to a Postgres server in a Docker (1.12.0) container on a Mac?
  • Multiple vhosts on one and the same docker container
  • docker call program (nodejs) from another container (supervisor)
  • One Solution collect form web for “docker mongodb replication on same server”

    nvm, i solved my question.

    from this post, http://version2beta.com/articles/mongod-replica-set-slave/, i give credit to the author.

    i have disabled my journal to my slaves

    storage:
       smallFiles: true
       journal:
       enabled: false
    

    then get the IP from container

    $ docker inspect e123
    

    then in mongo-cli

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