How to make inter-container communication using host name

Hi,

I am building a hadoop based image using docker-compose. I plan to deploy them on a single docker host without using swarm.

I am able to do ssh between containers using ip address. I want to do it through host name.

How to make it. please note that I am not using any static ip address.

how to make dynamic ip entries of each containers into /etc/hosts of all containers.

It might be helpful to look at the service discovery tutorial on play with docker. You could also look at the service discovery reference architecture for some additional ideas on how to use DNS to address services.

By creating your applications as services in compose, you may be able to address them via DNS.

You might also be able to use an overlay network to allow inter-container communication.

1 Like

Thanks. I will try them.