Suppose I have a server running on port 8000 on OSX. How can my Docker container access it via localhost:8000? I can\'t change the hostname too as the app in th
Thanks to palimpestor's answer I figured it out:
Instead of --net="host", use --add-host="localhost:10.0.2.2"
Indeed:
--add-host... is adding localhost 10.0.2.2 in /etc/hosts (reference)Note: you need to have set up a NAT adapter in your boot2docker VM VirtualBox settings (I did it through the GUI, don't know the CLI).