Giter Club home page Giter Club logo

Comments (4)

senssei avatar senssei commented on July 17, 2024

You will probably need user define bridge/ host only network to achieve that, depending on configuration of your network.

I would start with this piece of documentation https://blog.docker.com/2016/12/understanding-docker-networking-drivers-use-cases/ and

sudo docker network ls

to determine ids of configuration of bridge and host network

sudo docker network inspect <your id>

to confirm network configuration. Then you can reconfigure / create new it accordingly and then update my docker-compose.

https://docs.docker.com/compose/networking/#configure-the-default-network

BTW What operating system and docker version ?

from mongo-cluster-docker.

sinalkar avatar sinalkar commented on July 17, 2024

Thanks for quick response
following is my docker-compose file

version: '2'
services:
    mongo-cnf-2:
        container_name: "mongo-cnf-2"
        image: mongo:3.4.14
        ports:
            - "30002:27017"
        volumes:
            - ./mongodb.key:/data/mongodb.key
            - /mnt/mongo-data-2:/data/db/
            - /etc/localtime:/etc/localtime:ro 
        command: mongod  --replSet testreplica  --rest --httpinterface --port 27017 --oplogSize 16 --smallfiles
        restart: always
        networks:
        - mongodb-network 
    mongo-cnf-3:
        container_name: "mongo-cnf-3"
        image: mongo:3.4.14
        ports:
            - "30003:27017"
        volumes:
            - ./mongodb.key:/data/mongodb.key  
            - /mnt/mongo-data-3:/data/db/
            - /etc/localtime:/etc/localtime:ro   
        command: mongod  --replSet testreplica  --rest --httpinterface --port 27017 --oplogSize 16 --smallfiles
        restart: always 
        networks:
        - mongodb-network 
    mongo-cnf-1:
        container_name: "mongo-cnf-1"
        image: mongo:3.4.14
        ports:
            - "30001:27017"
        volumes:
            - ./mongodb.key:/data/mongodb.key 
            - /mnt/mongo-data-1:/data/db/ 
            - /etc/localtime:/etc/localtime:ro   
        command: mongod  --replSet testreplica  --rest --httpinterface --port 27017 --oplogSize 16 --smallfiles
        links:
            - mongo-cnf-2:mongo-cnf-2
            - mongo-cnf-3:mongo-cnf-3
        restart: always
        networks:
        - mongodb-network 
    mongo-cnf-setup:
        container_name: "mongo-cnf-setup"
        image: mongo:3.4.14
        depends_on:
            - "mongo-cnf-1"
            - "mongo-cnf-2"
            - "mongo-cnf-3"
        links:
            - mongo-cnf-1:mongo-cnf-1
            - mongo-cnf-2:mongo-cnf-2
            - mongo-cnf-3:mongo-cnf-3
        volumes:
            - ./scripts:/scripts 
            - ./mongodb.key:/data/mongodb.key
            - /mnt/mongo-data-setup:/data/db/ 
            - /etc/localtime:/etc/localtime:ro 
        env_file:
        - ./.env
        networks:
        - mongodb-network          
        environment: 
            - MONGO1=mongo-cnf-1
            - MONGO2=mongo-cnf-2
            - MONGO3=mongo-cnf-3
            - RS=testreplica
            - PORT=27017
        entrypoint: [ "/scripts/setup-cnf.sh" ]
networks:
    mongodb-network:
      driver: bridge

Yes i use User Define bridge network only

[
{
"Name": "project_testprod_mongodb-network",
"Id": "417fe3379bed74b29707b8671b350021ce11305217b602d2e09d60c17e40e2b4",
"Created": "2018-04-20T16:36:08.325559369+05:30",
"Scope": "local",
"Driver": "bridge",
"EnableIPv6": false,
"IPAM": {
"Driver": "default",
"Options": null,
"Config": [
{
"Subnet": "172.19.0.0/16",
"Gateway": "172.19.0.1"
}
]
},
"Internal": false,
"Attachable": false,
"Ingress": false,
"ConfigFrom": {
"Network": ""
},
"ConfigOnly": false,
"Containers": {
"433ba4e1bf5d1ec03769a6281263a3f776e9760a00d502e679cbb25497552446": {
"Name": "mongo-cnf-3",
"EndpointID": "87581398921f1aeecae3ca828a1ada34d95b868475aad19d3cad41b2d21a933b",
"MacAddress": "02:42:ac:13:00:02",
"IPv4Address": "172.19.0.2/16",
"IPv6Address": ""
},
"5f565964391abd1ecbee317135ac770378fb7ade0d0dc27cb89d6ac214ecc438": {
"Name": "mongo-cnf-1",
"EndpointID": "83f92afa5e6af23dd4243da355354c059cf1891fa4e589fe05b9215c6598b57c",
"MacAddress": "02:42:ac:13:00:04",
"IPv4Address": "172.19.0.4/16",
"IPv6Address": ""
},
"f46ddc963727e53d556bf1ec1c0529a7acb07b60cec10405549066d818e56591": {
"Name": "mongo-cnf-2",
"EndpointID": "b25394139a9238fecd4148c5932571912589d7d4a74c6845484feea86d5364f6",
"MacAddress": "02:42:ac:13:00:03",
"IPv4Address": "172.19.0.3/16",
"IPv6Address": ""
}
},
"Options": {},
"Labels": {}
}
]

BTW What operating system and docker version ?
OS : Centos 7 x64bit

Docker Version :
Client:
Version: 18.04.0-ce
API version: 1.37
Go version: go1.9.4
Git commit: 3d479c0
Built: Tue Apr 10 18:21:36 2018
OS/Arch: linux/amd64
Experimental: false
Orchestrator: swarm

Server:
Engine:
Version: 18.04.0-ce
API version: 1.37 (minimum version 1.12)
Go version: go1.9.4
Git commit: 3d479c0
Built: Tue Apr 10 18:25:25 2018
OS/Arch: linux/amd64
Experimental: false

from mongo-cluster-docker.

senssei avatar senssei commented on July 17, 2024

@sinalkar Recently we will get fixed some issues occurring on latest mongodb version (4.x)

One of which is related on mongos binding configuration options like --bindIpAll and --ipv6

https://docs.mongodb.com/manual/reference/configuration-options/

from mongo-cluster-docker.

senssei avatar senssei commented on July 17, 2024

Closing the issue. Please drop me a not if you want to reopen.

from mongo-cluster-docker.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.