title: Docker and Rabbitmq: ECONNREFUSED between containers
body: <p>I am trying to setup separate docker containers for rabbitmq and the consumer for the container, i.e., the process that would listen on the queue and perform the necessary tasks.  I created the yml file, and the docker file.  </p>
  
  <p>I am able to run the yml file, however when I check the docker-compose logs I see where there are ECONNREFUSED errors.  </p>
  
  <p><strong>NewUserNotification.js:</strong></p>
  
  <pre><code>require('seneca')()
      .use('seneca-amqp-transport')
      .add('action:new_user_notification’, function(message, done) {
          … 
  
          return done(null, {
          pid: process.pid,
          status: `Process ${process.pid} status: OK`
      })
      .listen({
          type: 'amqp',
          pin: ['action:new_user_notification’],
          name: 'seneca.new_user_notification.queue',
          url: process.env.AMQP_RECEIVE_URL,
          timeout: 99999
      });
  </code></pre>
  
  <p><strong>error message in docker-compose log:</strong></p>
  
  <pre><code>    {"notice":"seneca: Action hook:listen,role:transport,type:amqp failed: connect ECONNREFUSED 127.0.0.1:5672.","code":
      "act_execute","err":{"cause":{"errno":"ECONNREFUSED","code":"ECONNREFUSED","syscall":"connect","address":"127.0.0.1",
      "port":5672},"isOperational":true,"errno":"ECONNREFUSED","code":"act_execute","syscall":"connect","address":"127.0.0.1",
      "port":5672,"eraro":true,"orig":{"cause":{"errno":"ECONNREFUSED","code":"ECONNREFUSED","syscall":"connect","address":"127.0.0.1",
      "port":5672},"isOperational":true,"errno":"ECONNREFUSED","code":"ECONNREFUSED","syscall":"connect","address":"127.0.0.1","port":5672},
      "seneca":true,"package":"seneca","msg":"seneca: Action hook:listen,role:transport,type:amqp failed: connect ECONNREFUSED 127.0.0.1:5672.",
      "details":{"message":"connect ECONNREFUSED 127.0.0.1:5672","pattern":"hook:listen,role:transport,type:amqp","instance":"Seneca/…………/…………/1/3.4.3/-“,
      ”orig$":{"cause":{"errno":"ECONNREFUSED","code":"ECONNREFUSED","syscall":"connect","address":"127.0.0.1","port":5672},"isOperational":true,
  "errno":"ECONNREFUSED","code":"ECONNREFUSED","syscall":"connect","address":"127.0.0.1","port":5672}
  </code></pre>
  
  <p><strong>sample docker-compose.yml file:</strong></p>
  
  <pre><code>version: '2.1'
  services:
   rabbitmq:
      container_name: "4340_rabbitmq"
      tty: true
      image: rabbitmq:management
      ports:
        - 15672:15672
        - 15671:15671
        - 5672:5672
      volumes:
        - /rabbitmq/lib:/var/lib/rabbitmq
        - /rabbitmq/log:/var/log/rabbitmq
        - /rabbitmq/conf:/etc/rabbitmq/
  account:
      container_name: "account"
      build:
        context: .
        dockerfile: ./Account/Dockerfile
      ports:
        - 3000:3000
      links:
        - "mongo"
        - "rabbitmq"
      depends_on:
        - "mongo"
        - "rabbitmq"
  new_user_notification:
      container_name: "app_new_user_notification"
      build:
        context: .
        dockerfile: ./Account/dev.newusernotification.Dockerfile
      links:
        - "mongo"
        - "rabbitmq"
      depends_on:
        - "mongo"
        - "rabbitmq"
      command: ["./wait-for-it.sh", "rabbitmq:5672", "-t", "90", "--", "node", “newusernotification.js"]
  </code></pre>
  
  <p><strong>amqp connection string:</strong> 
  (I tried both ways, with and without a user/pass)
  amqp://username:password@rabbitmq:5672</p>
  
  <p>I added the link attribute to the docker-compose file and referenced the name in the .env file(rabbitmq).  I tried to run the NewUserNotification.js file from outside the container and it started fine.  What could be causing this problem?  Connection string issue?  Docker-Compose.yml configuration issue?  Other?</p>