Docker Community Forums

Share and learn in the Docker community.

How to make inter-container communication using host name


(Sakthivel021) #1

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.


(Bryce Ryan) #2

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.


(Sakthivel021) #3

Thanks. I will try them.