dockerhub - How do docker containers resolve hostname of other docker containers running on the same machine? -


I started using the docker and liked it because the dock containers are light weight VMs. But I can not understand how the Docker Containers may be able to solve each other's hostnames. They can connect each other via IPS, but they are not using their hostnames, I can not edit / etc / hosts in containers so that anyone can do makeup. When I restart the containers, they get different IPs and so I want to use the hostnames instead of the IP to communicate with each other. Let us say that I want to run the zookeeper zookeeper in the containers, and I want to name the ZooKee server hostname in the config (Z.C.G.G.) files.

It may be worth checking the Docker links (). When you link to the running container, the host entry is added to join the container

in their example they show

  $ sudo docker run -t -i --rm --link db: db training / webapp / bin / bash root @ aed84ee21bde: / opt / webapp # cat / etc / host 172.17.0.7 aed84ee21bde. . . 172.17.0.5 dB   

As you see here, they link to that application, which they add to the name by a name called db , and after A host entry is added to DB with that container's IP address.

As an example of running Zucceper, you can add only containers by simply connecting the zookeeper, I hope it helps!

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -