Within a service started as part of a Docker Compose stack of services I would like to be able to find out/know both the IPv4 and IPv6 address of the container the service is running in.
One way to find out is via the shell command
hostname -i, but this only gives the IPv4 address. I’d also prefer one way to get both, if possible. Is there a way that Compose can pass the service its IPv4/6 addresses during startup? If not, can the service determine these from the Docker runtime after startup?
Source: Docker Questions