I need to know the hostnames (or ip addresses) of some container running on the same machine.
As I already commented here (but with no answer yet), I use docker-compose
. The documentation says, compose will automatically create a hostname entry for all container defined in the same docker-compose.yml
file:
Each container for a service joins the default network and is both reachable by other containers on that network, and discoverable by them at a hostname identical to the container name.
But I can't see any host entry via docker exec -it my_container tail -20 /etc/hosts
.
I also tried to add links
to my container, but nothing changed.