Skip to content
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

need a section on port forwarding in instructions #10

Closed
corporate-gadfly opened this issue Jan 16, 2014 · 8 comments
Closed

need a section on port forwarding in instructions #10

corporate-gadfly opened this issue Jan 16, 2014 · 8 comments

Comments

@corporate-gadfly
Copy link

Instructions about port forwarding should be added.

Typical scenario:

Container Ports -> Docker Host Ports

dvm scenario:

Container Ports -> Docker Host Ports (on Virtualbox) -> Docker Client Ports (on OSX)

The Vagrantfile does not setup any forwarded ports.

So, if you are using dvm and you want to browse to a network port from your OSX browser (e.g., 8080), then unless a forwarded port is setup manually in Virtualbox or by the Vagrantfile (not done at the moment), the connection will be refused from OSX.

Another caveat is that ports < 1024 cannot be forwarded. You can get around it by using ipfw but I haven't looked into it.

@amaltson
Copy link

amaltson commented Feb 2, 2014

Indeed, dvm is really cool but without port forwarding I can't access any of the running docker images from OS X.

@drnic
Copy link

drnic commented Feb 13, 2014

Perhaps it'd be nice to manage these via the dvm client. dvm add-port 5000 would update the internal Vagrantfile and run vagrant reload.

@amaltson
Copy link

👍 to @drnic's idea, I like it.

@lalyos
Copy link

lalyos commented Feb 25, 2014

My workaround to access any port used by a container (even the ones not forwarded) is to use good old ssh as a socks proxy.

  • You can ssh into docker and from docker you can ssh into the container.
  • So you can set up ssh to do it in one step via proxy command. Now you can ssh directly to the container
  • add a -D 1099 parameter to ssh, and you reach any ports of the container via ssh provided proxy listening on the port 1099

detailed description is here : http://lalyos.github.io/blog/2013/10/06/access-docker-containers-via-internal-ip/

@drewcrawford
Copy link

IMHO dvm should be assigned a private network address. That way all ports are reachable on the private network without having to manage any forwarding. Only 1 LOC.

@fnichol
Copy link
Owner

fnichol commented Apr 10, 2014

There isn't really a need for Vagrant port forwarding in this project, or at least that wasn't the initial goal. While boot2docker is kickass awesome, it currently forwards the Docker daemon port (TCP/4243) back to your localhost. In other words docker -h tcp://127.0.0.1:4243.

The driving need I had for something like dvm was for running infrastructure testing, like Test Kitchen using the kitchen-docker driver. For the driver to work we needed access to all the dynamically assigned ports, not just the Docker daemon port. That's why it uses a private network segment and address (192.168.42.43 by default). Once Docker supported the DOCKER_HOST environment variable, the actual IP address was less important and consequently makes the docker command on non-Linux distros feel almost native.

Additionally, I wanted something slightly more convenient than cd <some-vagrant-project-dir>; vagrant up every time I needed "dockers". dvm is a glorified shell wrapper around a slightly crazy Vagrantfile and passes most of its commands, magic, and awesome directly down to Vagrant.

Does that help clear up the confusion a little?

@fnichol
Copy link
Owner

fnichol commented Apr 11, 2014

Hopefully the commit above in the README helps to clarify things a bit better for future new users. Thanks all!

@stevepereira
Copy link

I think I'm missing something that could keep me from dvm - is there a possibility I could have a docker container port (for a webserver) available to my host mac @ localhost:8080 for instance using dvm? Do people do this with some other mechanism? Is 'export FORWARD_DOCKER_PORTS=1' related? I feel very noob asking, but I haven't been able to figure this out...

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

No branches or pull requests

7 participants