I have a container running on a docker-host, the docker-host has a host entry like:
externalServiceHostEntry <external_service_IP>
I want the service inside my container to be able to talk to the externalService, and I want that service to use an alias hostname (because the container may be deployed in different docker-hosts with different host entries). As such i'd like to do something like this when I run the container:
docker run --add-host <alias>:<external_service_IP> ...
However, I can't do this as the external_service_IP may be changed by our infrastructure team at any point, and they only want to maintain the docker-host's etc/hosts file. So i want to do something like:
docker run --add-host <alias>:externalServiceHostEntry ...
Though i know this won't work for the obvious reason that the docker-host's externalServiceHostEntry hostname will have no meaning in the container /etc/hosts.
How can I achieve a setup, so that our infrastructure team can change the docker-hosts' etc/hosts file at will, and yet the service running in my container will still be able to communicate with the external service via a constant alias?