Communication between two docker container

I started to use docker in my dev environment.

On my laptop are two containers, where on one is a java process running and on the second is a tomcat active, which offers the java process services
as WebServices.

On the WebService-Container I have to have the dynamic IP-Address of the
container, but this changes on every start.


The solution is to add the --link Option on starting the WebService Container.

This option sets some Environment variables, but what is much more of
use for me is the entry in the /etc/hosts filewith the name I can set in the --link option.

Now the WebService Container only needs to reference the hostname and
on every start with the --link Option, the new IP is inserted into the /etc/hosts.