title: How to connect to Mongo DB which is in remote server to my Docker?
body: <p>Hi I have an application where I am using docker-compose. I have large amount of data in the remote mongo DB server which is running on port 28107. How can I connect from my docker-compose to this remote server?</p>
  
  <p>Below is my docker-compose.yml file:</p>
  
  <pre><code>version: '3'
  services:
    myapp:
      # container_name: myapp
      restart: always
      build: .
      ports:
        - '52000:52000'
        # - '8080:8080'
      #   - '4300:4300'
      #   - '4301:4301'
      environment:
        - MONGO_URL=mongodb://test:test@ip_address:28107/test
      # command: ["./wait-for-it.sh", "mongo:28107", "--", "npm", "start"]
      links:
        - redis
        - mongo
    mongo:
      # container_name: myapp-mongo
      image: 'mongo:latest'
      ports:
        - '28107:28107'
        # - '27017:27017'
      volumes:
        # - ~/Downloads/db_dump_09_01_2020:/data/db
        - /data/db
        # - /data/configdb
      # command: mongod --auth
    redis:
      # container_name: myapp-redis
      restart: always
      image: 'redis:4.0.11'
      # command: ["redis-server", "--appendonly", "yes"]
      depends_on:
        - helper
      sysctls:
        - net.core.somaxconn=511
      ports:
        - '6379:6379'
    helper:
      image: alpine
      command: sh -c "echo never &gt; /sys/kernel/mm/transparent_hugepage/enabled"
      privileged: true
  </code></pre>
  
  <p>In the above code, in the environment parameter, I have mentioned the remote mongo DB server url. I have all the data in that url. I don't want to export that data in my localhost and mount it in my docker container but instead, I would like to directly link my docker container to that remote mongo DB server.</p>
  
  <p>How can I do it ? I am new to the docker concepts.</p>