title: docker rabbitmq how to expose port and reuse container with a docker file
body: <p>Hi I am finding it very confusing how I can create a docker file that would run a rabbitmq container, where I can expose the port so I can navigate to the management console via localhost and a port number.</p>
  
  <p>I see someone has provided this dockerfile example, but unsure how to run it?</p>
  
  <pre><code>version: "3"
  services:
   rabbitmq:
      image: "rabbitmq:3-management"
      ports:
        - "5672:5672"
        - "15672:15672"
       volumes:
        - "rabbitmq_data:/data"
       volumes:
        rabbitmq_data:
  </code></pre>
  
  <p>I have got rabbit working locally fine, but everyone tells me docker is the future, at this rate I dont get it.</p>
  
  <p>Does the above look like a valid way to run a rabbitmq container? where can I find a full understandable example?</p>
  
  <ol>
  <li>Do I need a docker file or am I misunderstanding it?</li>
  <li>How can I specify the port? in the example above what are first numbers 5672:5672 and what are the last ones?</li>
  <li>How can I be sure that when I run the container again, say after a machine restart that I get the same container?</li>
  </ol>
  
  <p>Many thanks</p>
  
  <p>Andrew</p>