-
Notifications
You must be signed in to change notification settings - Fork 18.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Port forwarding when using boot2docker on OSX #4007
Comments
I lost some time on this. The port is exposed in the VBox VM, not on the host. I forward ports too. |
This works perfectly. Thank you. |
To add port forwards from the command line to a running boot2docker VM use: VBoxManage controlvm boot2docker-vm natpf1 "name,tcp,127.0.0.1,1234,,1234" Where 'name' is the unique name for your rule, and '1234' is the port you wish to forward. So for the original Sinatra example: VBoxManage controlvm boot2docker-vm natpf1 "sinatra-hello,tcp,127.0.0.1,5000,,5000" |
Nice one, no need to shut down boot2docker-vm. Thanks. |
I wrote a wrapper script to manage this. It sounds from boot2docker/boot2docker#93 like it might not be needed for long though. |
It seems as if you don't have that problem any longer, when using boot2docker-cli 0.8 |
@leifhanack I still seem to have this issue with 0.8. I see two interfaces created by boot2docker. Using this example -- http://docs.docker.io/en/latest/examples/postgresql_service/ -- I am still unable to connect to the Postgresql server using either address. This is using boot2docker from Homebrew on OS X and I confirmed it's 0.8. |
ping @SvenDowideit @ostezer |
@matthughes If you installed boot2docker 0.8 with homebrew it is NOT boot2docker-cli 0.8! Homebrew integration is ongoing, see boot2docker/boot2docker-cli#90 |
I tried boot2docker-cli 0.8 but creating a host-only network interface failed. I'm using the newest VirtualBox 4.3.10.
|
I had same error as @leifhanack with the pre-built binary. I built from source and it successfully inited a boot2docker-vm with the host-only network. |
We're working to move from the boot2dockerbash script to https://github.com/boot2docker/boot2docker-cli/releases - and that sets up a second host-only network interface that gets used - so port forwarding won't be needed anymore. that said - I'm working on linux and windows most of the time, and so its tested there - and I would love some more help testing, especially on OSX I too got the failure @leifhanack and @michaelpigg - can we move this to boot2docker/boot2docker-cli#93 please? |
What kind of help do you need? Do you have a test suite which can be run on OSX? Regards Leif |
@leifhanack that would be loverly - yes, if someone were to write a test suite that would be awesome. I wonder if the docker cli tests could be extracted into a standalone 'test-it' tool that could be run from any OS we can build on - and if it could test both API and by shelling out to the natively built client. This API version would be test that the remote server works as it should (and might reveal the NAT portforwarding issue we have with b2d atm) whereas the shell out version would show that the native client works correctly. nice. |
So right now there is nothing which I can run easily in order to help? (sent from my mobile)
|
Since boot2docker-cli v0.11.1-pre1 host-only network interface including port forwarding works for me. Installed with:
|
@leifhanack could you please show your commands that works for you? It doesn't work for me.
What should I do to make it work? |
And by the way, port forwarding doesn't help either!
Help! |
I've created new issue, so let's not discuss it here. |
boot2docker 1.0 provides a host only network interface -please do not use port forwarding in virtualbox, it is unreliable. |
Exposing ports does not work for me in OSX.
|
Please don't append to a closed task - I only just saw this in an old browser tab. It also belongs in the boot2docker-cli repo tasks... @c4milo you really need to tell us more than that - which network interface are you expecting the port to be exposed on, and what commands are you running? |
Just for the history, maybe others will run into this issue. This didn't work for me on Mac: |
Forwarding almost 2,000 ports like above worked out pretty terrible for me - on my (admittedly resource constrained) laptop, performance crawled to a halt trying to forward that many ports. Here's how to undo this command if anybody else comes across the same issue - instead, I'd suggest picking the ports you need forwarded!:
|
https://github.com/boot2docker/boot2docker/blob/master/doc/WORKAROUNDS.md (for others stumbling on this page) |
and much more importantly, only do this if someone else needs access to those ports - your OSX box can access all container ports without the above steps. |
@SvenDowideit Hmm I don't understand, when I needed to ssh into a container, i had to do the port forwarding. |
if you are sshing into a container from your OSX box, then no, you do not need to do port forwarding. there is a second network interface which does that job better. See https://github.com/boot2docker/boot2docker#container-port-redirection mmm, its a badly named heading, but tells you the normal poerating mode. |
As an update to @SvenDowideit's answer, |
I am encountering the same problem using docker-machine installed with Docker Toolbox 1.9
resulting in
|
@cmcconomy you should probably open a new issue and reference this one like so... |
@cmcconomy I have the same issue when I exposed port 27017 in my container (-p 27017:27017) |
@cmcconomy @ystreibel is the process in the container also listening on port 8080, and does it listen on 0.0.0.0, not on "localhost" or 127.0.0.1? |
@funkytaco #4007 (comment) Thank you 👍 |
I installed Spark using docker on MAC. I ran into the same issue , but resolved after doing: for i in {10000..10999}; do But I have another issue: In the web ui for spark , there is another link: application tracker - but I am not able to access it. Any help with this ? |
I followed the official guide for installing docker on OSX with boot2docker. Everything seems to be working fine except I'm unable to access any exposed ports.
For example:
Doing
curl http://localhost:5000
givescurl: (7) Failed connect to localhost:5000; Connection refused
.I have to manually forward the port in VirtualBox for it to work. I haven't seen any mention of having to do this anywhere though, which suggests either I'm doing something stupid or there's something missing from the install instructions.
Is it expected behaviour that you need to manually forward ports from VirtualBox for docker port forwarding to work?
The text was updated successfully, but these errors were encountered: