Question: I have to link two containers so they can see each other. Of course the following...

```
docker run -i -t --name container1 --link container2:container2 ubuntu:trusty /bin/bash
docker run -i -t --name container2 --link container1:container1 ubuntu:trusty /bin/bash

```

...fails at line 1 because a container needs to be up and running in order to be a link target:

```
2014/08/15 03:20:27 Error response from daemon: Could not find entity for container2

```

What is the simplest way to create a bidirectional link?

Answer: 
Since there is no bidirectional link I solved this issue with the [--net](https://docs.docker.com/reference/commandline/cli/#run) argument. That way they are using the same network stack and can therefore access each other over the loopback device (localhost).

```
docker run -d --name web me/myserver
docker run -d --name selenium --net container:web me/myotherserver

```

So I can access from web the selenium server (port 4444) and my selenium server can access my web server (port 80).
I solved this by appending an ip-table into /etc/hosts of each container, for 
[example](https://github.com/Wei1234c/dockerfiles/blob/master/ARMv7/hadoop/cluster/start.sh)