I’m currently running a PoC of a product which uses Docker-CE 18.06.1 to pull down 2 images from Docker registry and run on two containers within an isolated_nw. Creation of the containers and the network is done via Docker-compose (v1.22)
The host is a Linux VM (Red Hat Enterprise Linux Server release 7.5 (Maipo))
I’ve been struggling for around 6 weeks now with a really frustrustrating issue where one container (sk4_tomcat_1) can’t communicate to the other container (sk4_postgres_1) via DNS name but can ping the other container via it’s virtual network IP (172.18.0.2).
Ultimately though this results in UnknownHostException: sk4_postgres each time the sk4compose.service is started.
I can see from the docker network inspect that both containers have joined and Aliases have been correctly set up for container name and sk4_postgres but for some reason DNS doesn’t seem to be working.
I have also created a daemon.json file which contains our local DNS nameservers as public DNS servers are unreachable.
I can get around the issue by changing the name sk4_postgres to the containers IP in my applications persistence.xml but this only causes the application to fail at the next stage where it needs to resolve a public DNS name which then fails again with UnknownHostException.
It looks like i’m really struggling with DNS at the moment within my companies network but everyone has drawn a blank at the moment.
Thanks very much.