title: Accessing host machine as localhost from a Docker container that's also inside a boot2docker vm
body: <p>Suppose I have a server running on port 8000 on OSX. How can my Docker container access it via <code>localhost:8000</code>? I can't change the hostname too as the app in the container is not in my control.</p>
  
  <p>I've read this previous discussion on using <code>--net="host"</code> for a container to access the host machine's network. However, I'm on OSX and Docker runs inside a VM so <em>localhost</em> from the Docker container with <code>--net="host"</code> goes to the VM and not my real machine.</p>
  
  <p>Then I tried <a href="https://github.com/boot2docker/boot2docker/blob/master/doc/WORKAROUNDS.md">port forwarding workaround</a> like so: <code>VBoxManage modifyvm "boot2docker-vm" --natpf1 "tcp-port8000,tcp,,8000,,8000";</code> to no avail.</p>
  
  <p>Any suggestion would be greatly appreciated.</p>