You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 1, 2021. It is now read-only.
Repository navigation
This repository was archived by the owner on Jan 1, 2021. It is now read-only.
I see some work has been done to automatically forward dynamically assigned ports in #73, but when doing development work I want my server to be at a predictable address (so, for example, I could always go to http://boot2docker:8000 in my web browser).
I see some work has been done to automatically forward dynamically assigned ports in #73, but when doing development work I want my server to be at a predictable address (so, for example, I could always go to http://boot2docker:8000 in my web browser).
Reply to this email directly or view it on GitHub: #85
the current setup uses NAT and port forwarding - you have a predictable name wich is always "localhost" or the name you gave your host which runs the VM. Use my patch to forward the dynamical created ports to your local ip and you can access your container similar to a setup without a VM.
with docker it is up to you what you get - you can specify it e.g.: docker run -p 127.0.0.1:80:8080 ubuntu bash
This binds port 8080 of the container to port 80 on 127.0.0.1 of the host inside the vm machine. Now you need have a virtual box port forwarding setting which does bind 8080 to 8080 on your host running the VM.
Maybe I'm not explaining myself properly – I'm thinking of this in context of development environments, where stuff needs to be available on a predictable host and a predictable IP without without any of the hassle of port forwarding, etc.
I do understand what you want as I have similar requirements.
Option 1) As long as the docker client is not integrated with the vm and does this manipulation for you, you have to write a wrapper script which will do the dynamic port forward changes for you and then calls the docker client.
Option 2) you need to use a host only or bridged setup to get direct access to the host running the docker vm
I am planning to setup this:
Dnsmasq on my host running the VM to allow multiple virtual domains for development e.g. "*.dev"
a container with pound (reverse proxy) on port 80 exposed to my host
a container per project which will registere its dynamic port and domain at the reverse proxy
This is now much more plausible, so I added it during some refactoring - not sure if it'll get commited for 1.2.0 - depends on how much time is left to debug.
Is this still on the roadmap? I'm trying to use boot2docker for testing service discovery locally with fig. One container I use (https://github.com/progrium/registrator) uses the IP address of the resolved hostname when I run the container with --net host. On most hosts, this is usually the first assigned IP address. But on boot2docker it is 127.0.0.1. Would be nice to map it to the hostonly or NAT private interface instead.
Activity
aheissenberger commentedon Jan 16, 2014
Just add a host only interface to your vm setup. Look at my fork for some fixes to get this setup running
On Thu, Jan 16, 2014 at 8:29 PM, Ben Firshman [email protected]
wrote:
moul commentedon Jan 22, 2014
👍
bfirsh commentedon Jan 22, 2014
@aheissenberger As well as having a predictable IP address, it's also useful to have the VM on a memorable domain name.
aheissenberger commentedon Jan 22, 2014
the current setup uses NAT and port forwarding - you have a predictable name wich is always "localhost" or the name you gave your host which runs the VM. Use my patch to forward the dynamical created ports to your local ip and you can access your container similar to a setup without a VM.
bfirsh commentedon Jan 22, 2014
Then, unfortunately, you get unpredictable port numbers, which is almost as bad as having to remember an IP address.
aheissenberger commentedon Jan 22, 2014
with docker it is up to you what you get - you can specify it e.g.:
docker run -p 127.0.0.1:80:8080 ubuntu bashThis binds port 8080 of the container to port 80 on 127.0.0.1 of the host inside the vm machine. Now you need have a virtual box port forwarding setting which does bind 8080 to 8080 on your host running the VM.
more info: http://docs.docker.io/en/latest/use/port_redirection/#port-redirection
If you use dynamic binding, the port number can be accessed by this:
docker port 4c01 80bfirsh commentedon Jan 22, 2014
"Now you need have a virtual box port forwarding setting which does bind 8080 to 8080 on your host running the VM." – that's the problem.
With docker-py, you don't need to do any manual work to get that. If I expose port 8080 to the Docker VM, then I can just type http://localdocker:8080 into my browser to access it.
Maybe I'm not explaining myself properly – I'm thinking of this in context of development environments, where stuff needs to be available on a predictable host and a predictable IP without without any of the hassle of port forwarding, etc.
aheissenberger commentedon Jan 22, 2014
I do understand what you want as I have similar requirements.
Option 1) As long as the docker client is not integrated with the vm and does this manipulation for you, you have to write a wrapper script which will do the dynamic port forward changes for you and then calls the docker client.
Option 2) you need to use a host only or bridged setup to get direct access to the host running the docker vm
I am planning to setup this:
SvenDowideit commentedon Aug 21, 2014
This is now much more plausible, so I added it during some refactoring - not sure if it'll get commited for 1.2.0 - depends on how much time is left to debug.
andyshinn commentedon Dec 31, 2014
Is this still on the roadmap? I'm trying to use boot2docker for testing service discovery locally with fig. One container I use (https://github.com/progrium/registrator) uses the IP address of the resolved hostname when I run the container with
--net host. On most hosts, this is usually the first assigned IP address. But on boot2docker it is 127.0.0.1. Would be nice to map it to the hostonly or NAT private interface instead.SvenDowideit commentedon Jan 2, 2015
I just reviewed and found some solveable problems in the pre-req to that PR, so its possible that we might get there.