I have multiple networks attached to a service (–network name=private,alias=private --network name=public,alias=public) and need a way to resolve the “public” and “private” ip’s assigned to the container from within the container. Resolving using the alias “public” or “private” will return all A records for all tasks in a service. I just need the ip’s for the current container.
My app needs to listen on different ports for both networks but NOT on all networks (no 0.0.0.0).
I can’t figure out how to assign an env variable or hostname per interface. Whether or not I used --hostname with service create it puts the same hostname for both ip’s in /etc/hosts.
Thank you in advance!