title: Why does boot2docker, and port forwarding to my docker instances, periodically hang?
body: <p>I have run the following command to forward sinatra and redis ports to my docker instance running in virtualbox on OSX:</p>
  
  <pre><code>ports=( 4567 6379 )
  for port in "${ports[@]}"
  do
  echo "Forwarding $port"
  VBoxManage modifyvm "boot2docker-vm" --natpf1 "tcpport$port,tcp,,$port,,$port"
  done
  </code></pre>
  
  <p>However, periodically (like every 60 seconds) requests to either of these docker instances over my machine's public IP, originating from my machine, will hang for 40-60 seconds. However, my docker instance is healthy and I can connect directly via 192.168.59.103. </p>
  
  <p>Thus, why would a connection such as:</p>
  
  <pre><code>redis-cli -h 192.168.1.1 PING
  </code></pre>
  
  <p>Periodically hang, but</p>
  
  <pre><code>redis-cli -h 192.168.59.103 PING
  </code></pre>
  
  <p>Always work? Is there some kind of bug in VirtualBox or boot2docker? </p>
  
  <p>Moreover, during the periods where these requests hang, I have noticed that calls to </p>
  
  <pre><code>boot2docker ip
  </code></pre>
  
  <p>and </p>
  
  <pre><code>boot2docker ssh
  </code></pre>
  
  <p>Themselves both hang. I am running boot2docker 1.6.2 and VirtualBox 4.3.28 on OSX 10.10.3.</p>
  
  <p>Additional debugging reveals that inter-instance connectivity is now impaired as well. I have linked two containers, and periodically HTTP requests between them will hang. I went so far as to run <code>telnet container_name 4567</code>, then I typed</p>
  
  <pre><code>GET /
  </code></pre>
  
  <p>Which, of course, is the most basic way to test a webserver. From inside of container_name, I ran <code>curl http://localhost:4567/</code>. The telnet request hung, but the <code>curl http://localhost:4567/</code> returned immediately.</p>