title: Unable to connect to my Docker RabbitMQ using Node.js
body: <p>I have installed a RabbitMQ docker image and have it up and running.
  My docker management console is also running on port 8080.</p>
  
  <p>I run the docker with <code>docker run -d --hostname my-rabbit --name some-rabbit rabbitmq:3</code></p>
  
  <p>I am trying to run the following node code;</p>
  
  <pre><code>var amqp = require('amqplib/callback_api');
  
  var connection = amqp.connect('amqp://localhost:5672',function(err,conn){
      console.log(conn); });
  </code></pre>
  
  <p>However, conn is always undefined.</p>
  
  <p>I have tried;</p>
  
  <pre><code>amqp://localhost:5672
  amqp://localhost:15672
  amqp://localhost
  amqp://localhost:8080
  </code></pre>
  
  <p>but none of them work.</p>
  
  <p>My rabbitmq manager says amqp is listening on 5672.</p>
  
  <p>I have not got any other accounts other than the default guest account.</p>
  
  <p>I'm not running visual studio code in admin mode.</p>
  
  <p>The error I am getting is;</p>
  
  <blockquote>
    <p>Error: Socket closed abruptly during opening handshake
        at Socket.endWhileOpening (C:\Users\sgrieger\Documents\Development\rabbitmq\node_modules\amqplib\lib\connection.js:259:17)
        at emitNone (events.js:111:20)
        at Socket.emit (events.js:208:7)
        at endReadableNT (_stream_readable.js:1064:12)
        at _combinedTickCallback (internal/process/next_tick.js:138:11)
        at process._tickCallback (internal/process/next_tick.js:180:9)</p>
  </blockquote>