I've asked a similar question on the docker forum...
https://forums.docker.com/t/access-service-on-host-machine-from-docker-container/45117
...but I'm not getting any joy and this should not be difficult. However when I google about it seems that it is difficult which seems crazy to me. So I'll ask the question in a different way...
Host A running docker container A
Host B running a legacy service exposed on port 1234
container A can access the legacy service on host B on port 1234 (no problems)
Now I decide to run container A on host B. The crazy thing is container A can no longer access the legacy service provided by host B no matter what I try!
There must be a way to do this reliably?
Container A can ping host B fine when running on host A or B but when container A tries to connect to the legacy service I always get the error
No route to host
There is no firewalls (they have been disabled) and dns works fine within container A and resolves host B to the correct IP no matter what host it is running on.