Skip to content
This repository has been archived by the owner on Sep 26, 2021. It is now read-only.

Question: How do you forward ports with Virtualbox to boot2docker? #710

Closed
florentvaldelievre opened this issue Mar 4, 2015 · 3 comments

Comments

@florentvaldelievre
Copy link

Hello,

I have created a VM using docker-machine create --driver virtualbox dev
I have a container running on 8500:8500 on this dev vm and boot2docker

I would like to forward my port from the Host -> virtualbox -> boot2docker so i can target my container from my host : curl localhost:8500
Can anyone point me to the right direction ?

Thank you

@ghost
Copy link

ghost commented Mar 4, 2015

You can run

vboxmanage controlvm dev natpf1 "8050,tcp,127.0.0.1,8050,,8050"

@SvenDowideit
Copy link
Contributor

the best thing to do is not port forward. instead, use the second network attached to your machine

get it using docker-machine ip - the mapped container ports will be there already.

The only reason to port forward to the host's network is to allow other computers on your network to access the container's port.

but specifically for your curl localhost:8500 example

replace it with curl $(docker-machine ip):8500

@florentvaldelievre
Copy link
Author

Thank you very much for the answers, appreciated !
@SvenDowideit : It makes sense, thanks

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants