title: How do I connect a Docker container running in boot2docker to a network service running on another host?
body: <p>I am using the latest version of boot2docker version 1.3.2, 495c19a on a windows 7 (SP1) 64 bit machine.</p>
  
  <p>My docker container is running a celery process which attempts to connect to a rabbitMQ service running on the same machine that boot2docker is running on.</p>
  
  <p>The Celery process running within the docker container cannot connect to RabbitMQ and reports the following :</p>
  
  <blockquote>
    <p>[2014-12-02 10:28:41,141: ERROR/MainProcess] consumer: Cannot connect
    to amqp:// guest:**@127.0.0.1:5672//: [Errno 111] Connection refused.
    Trying again in 2.00 seconds...</p>
  </blockquote>
  
  <p>I have reason to believe this is a network related issue, associated with routing from the container, to the VirtualBox host, and from the host to the RabbitMQ service running on the local machine; I do not know how to configure this and I was wondering if anyone can advise me how to proceed?</p>
  
  <p>I tried setting up port 5672 in port forwarding but it didn't work (but I believe this is for incoming traffic to the VM, like boot2docker ssh).</p>
  
  <p>I am running the container as docker run -i -t tagname</p>
  
  <p>I am not specifying a host with -h when I run the container.</p>
  
  <p>I'm sorry if this question appears rather clueless or if the answer appears obvious ... I appreciate any help!</p>
  
  <hr>
  
  <p>Some additional information :</p>
  
  <p>The routing table of the host VM is what boot2docker configured during installation as follows :</p>
  
  <p><img src="https://i.stack.imgur.com/WPfRd.png" alt="enter image description here"></p>
  
  <ul>
  <li><p>docker0 IP Address is 172.17.42.1</p></li>
  <li><p>eth0 IP Address is 10.0.2.15</p></li>
  <li><p>eth1 IP Address is 192.168.59.103</p></li>
  <li><p>eth0 is attached to NAT (Adapter 1) in the VirtualBox VM network configuration.</p></li>
  <li><p>Adapter 1 has port forwarding setup for ssh; default setting of host IP 127.0.0.1, host port 2022, guest port 22.</p></li>
  <li><p>eth1 is attached to Host-only adapter (Adapter 2).</p></li>
  <li><p>Both adapters are set to promiscuous mode (allow all).</p></li>
  <li><p>The IP Address of the docker container is 172.17.0.33.</p></li>
  </ul>