title: Docker image for Spring/RabbitMQ tutorial results in connection refused
body: <p>I'm working through the Spring tutorial here;</p>
  
  <p><a href="https://spring.io/guides/gs/messaging-rabbitmq/" rel="nofollow noreferrer">Messaging with RabbitMQ</a></p>
  
  <p>I found this question but it did not address my query regarding the <code>docker-compose.yml</code> file found in the tutorial;</p>
  
  <p><a href="https://stackoverflow.com/questions/30223203/spring-rabbitmq-tutorial-results-in-connection-refused-error">Spring RabbitMQ tutorial results in Connection Refused error</a></p>
  
  <p>I've completed all necessary steps up until the actual running of the application, at which point I'm getting <code>ConnectException</code> exceptions suggesting that the server is not running or not running correctly.</p>
  
  <p>The docker-compose.yml file specified in the tutorial is as follows;</p>
  
  <pre><code>rabbitmq:
  image: rabbitmq:management
  ports:
    - "5672:5672"
    - "15672:15672"
  </code></pre>
  
  <p>Basically I am unsure what this docker-compose file actually does, because it doesn't seem to set up the RabbitMQ server as the tutorial suggests (or at least not in the way the tutorial expects). I'm quite new to Docker also so perhaps I am mistaken in thinking this file would run a new instance of the RabbitMQ server.</p>
  
  <p>When I run <code>docker-compose up</code> I get the following console output;</p>
  
  <pre><code>rabbitmq_1  |
  rabbitmq_1  | =INFO REPORT==== 28-Jun-2017::13:27:26 ===
  rabbitmq_1  | Starting RabbitMQ 3.6.10 on Erlang 20.0-rc2
  rabbitmq_1  | Copyright (C) 2007-2017 Pivotal Software, Inc.
  rabbitmq_1  | Licensed under the MPL.  See http://www.rabbitmq.com/
  rabbitmq_1  |
  rabbitmq_1  |               RabbitMQ 3.6.10. Copyright (C) 2007-2017            Pivotal Software, Inc.
  rabbitmq_1  |   ##  ##      Licensed under the MPL.  See  http://www.rabbitmq.com/
  rabbitmq_1  |   ##  ##
  rabbitmq_1  |   ##########  Logs: tty
  rabbitmq_1  |   ######  ##        tty
  rabbitmq_1  |   ##########
  rabbitmq_1  |               Starting broker...
  rabbitmq_1  |
  rabbitmq_1  | =INFO REPORT==== 28-Jun-2017::13:27:26 ===
  rabbitmq_1  | node           : rabbit@bd20dc3d3d2a
  rabbitmq_1  | home dir       : /var/lib/rabbitmq
  rabbitmq_1  | config file(s) : /etc/rabbitmq/rabbitmq.config
  rabbitmq_1  | cookie hash    : DTVsmjdKvD5KtH0o/OLVJA==
  rabbitmq_1  | log            : tty
  rabbitmq_1  | sasl log       : tty
  rabbitmq_1  | database dir   : /var/lib/rabbitmq/mnesia/rabbit@bd20dc3d3d2a
  </code></pre>
  
  <p>...plus a load of INFO reports. This led me to believe that the RabbitMQ server was up and running, but apparently not as I cannot connect.</p>
  
  <p>The only way I have gotten this to work is by manually installing Erlang and RabbitMQ (on a Windows system here) which does appear to let me complete the tutorial.</p>
  
  <p>Why is Docker even mentioned in this tutorial though? The <code>docker-compose.yml</code> does not appear to do what the tutorial suggests. </p>
  
  <p>What is this file actually doing here and how would one run RabbitMQ in a docker container for the purposes of this tutorial? Is this an issue with port numbers?</p>