title: Not able to connect a rabbitmq docker with appl docker
body: <p>I have a simple app (simple.js), written in nodejs, </p>
  
  <pre><code>var amqp = require('amqplib/callback_api');
  amqp.connect('amqp://localhost', function(err, conn) {
    conn.createChannel(function(err, ch) {
      var q = 'hello';
  
      ch.assertQueue(q, {durable: false});
      // Note: on Node 6 Buffer.from(msg) should be used
      ch.sendToQueue(q, new Buffer('Hello World!'));
      console.log(" [x] Sent 'Hello World!'");
    });
  setTimeout(function() { conn.close(); process.exit(0) }, 500);
  });
  </code></pre>
  
  <p>And I have dockerized it (simple-app). Then I pulled rabbitmq docker from docker hub.
  When I try to link these in following manner :</p>
  
  <pre><code>docker run -d --name rabbitmq-server rabbitmq:latest
  docker build -t simple-app .
  docker run -d -P --name myapp --link rabbitmq-server:rabbitmq-server simple-app
  docker logs a8789193af523b
  </code></pre>
  
  <p>I get the below mentioned error :</p>
  
  <pre><code>/usr/src/server/simple.js:3
    conn.createChannel(function(err, ch) {
        ^
  
  TypeError: Cannot read property 'createChannel' of undefined
      at /usr/src/server/simple.js:3:7
      at /usr/src/server/node_modules/amqplib/callback_api.js:16:10
      at Socket.&lt;anonymous&gt; (/usr/src/server/node_modules/amqplib/lib/connect.js:167:18)
      at Socket.g (events.js:292:16)
      at emitOne (events.js:96:13)
      at Socket.emit (events.js:188:7)
      at emitErrorNT (net.js:1277:8)
      at _combinedTickCallback (internal/process/next_tick.js:80:11)
      at process._tickCallback (internal/process/next_tick.js:104:9)
  </code></pre>
  
  <p>I have tried many ways in order to resolve :
  1. Exposed all ports with -P option using --links
  2. Did mapping of specific ports with -p option --links
  3. created network with bridge as driver and used that n/w for starting all my dockers.</p>
  
  <p>None of the above methods seem to work, I am continuosly getting same error.
  I am trying this on AWS (EC2) .. amazon linux.</p>
  
  <p>Also, if I try to run the simple.js directly on linux, it is successfully connecting to my rabbitmq server (which is dockerized).</p>
  
  <p>Please help me out here !!</p>