Resolve containers using consul DNS on host Resolve containers using consul DNS on host docker docker

Resolve containers using consul DNS on host


The container 4 is not using the same network as the other ones (the --net=host) so your DNS can't work in all cases.

Either:

  • You are on the physical machine network and you have to address the node-web-app using it's container IP
  • You are inside a docker network and you have to get the routable IP of your machine.

The fact that dig returns 127.0.0.1 is completely normal, because that's what you told him, but your node-web-app is not accessible at 127.0.0.1 (Which is, in this case, the local IP of this particular docker container) from the dig container.