title: How to link containers in docker?
body: <p>Here's the result when I type <code>docker ps</code> :
  <img src="https://i.stack.imgur.com/gD2jR.jpg" alt="here is the image when i type docker ps" /></p>
  <p>I have 3 docker containers: webapps, redis and rabbitmq. I want to link container webapps to container redis and rabbitmq container. In non docker apps, mywebapps can send message to rabbitmq and write/read redis.</p>
  <p>I tried using command like this</p>
  <pre><code>docker run --name rabbitmq -p 8080:80 --link webapps:nimmis/apache-php7 -d rabbitmq
  </code></pre>
  <p>but it does not work.</p>
  <p>Here is my config.php on webapps where I am trying to send messages via rabbitmq:</p>
  <pre><code>define('HOST', 'localhost');
  define('PORT', 5672);
  </code></pre>
  <p>I tried to change localhost with hostname</p>
  <pre><code>define('HOST', 'rabbitmq');
  define('PORT', 5672);
  </code></pre>
  <p>Error message says <code>connection refused</code>.</p>
  <p>It seems that in my three containers needs to be configured in the same network namespace.</p>