Thanks to palimpestor’s answer I figured it out:
Instead of --net="host", use --add-host="localhost:10.0.2.2"
Indeed:
- 10.0.2.2 is the default gateway defined for the guest network interface in NAT mode (reference).
Read: it’s your host, seen from boot2docker. --add-host...is addinglocalhost 10.0.2.2in /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).