Hello.
I’m using consul in docker-compose, which looks like this. Before, I created my own network:
docker network create -d bridge --subnet 172.25.0.0/16 mynetwork
consul_master:
image: consul:1.8.0-beta2
container_name: containerConsul
network_mode: mynetwork
command: [
"agent",
"-dev",
"-http-port=8000",
]
ms_auth:
image: <someimage>
container_name: containerMS
network_mode: mynetwork
this is ms_auth - nodejs app
import * as consul from 'consul';
const consulApp = consul({
host: 'containerConsul',
port: 8000,
});
consulApp.catalog.node.list((err, result) => {
// Here I have an error
});
Error: connect ECONNREFUSED 172.25.0.2:8000
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16) {
errno: -111,
code: 'ECONNREFUSED',
syscall: 'connect',
address: '172.25.0.2',
port: 8000
}
But when I’m changing network_mode: to host for both consul and my app, everything is working as expected. Could you please help me what to do to work consul with ms in one network without host mode