Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- I would like my docker containers connect and use databases in remote host in different machine. I am not using any orchestration tool like docker swarm or kubernetes. Instead, I am simply using docker-compose becuase I don't have many containers. Here is an example of docker-compose I am using:
- version: "3.7"
- services:
- core:
- image: myrepo/core:latest
- ports:
- - 8080:8080
- networks:
- - backend
- restart: always
- extra_hosts:
- - 'mongodb: 192.168.2.50'
- - 'postgresdb:192.168.2.50'
- depends_on:
- - mongodb
- - postgresdb
- event:
- image: myrepo/event:latest
- ports:
- - 8081:8081
- networks:
- - backend
- restart: always
- extra_hosts:
- - 'mongodb: 192.168.2.50'
- - 'postgresdb:192.168.2.50'
- depends_on:
- - mongodb
- - postgresdb
- IP of remote server: 192.168.2.50
- I tried using extra_hosts option but this doesn't solve my problem. What other options are available to make this work? IP of the docker host has been whitelisted and necessary ports are open in the database server firewall to give access to the docker host.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement