fnichol / dvm

An on demand Docker virtual machine, thanks to Vagrant and boot2docker. Works great on Macs and other platforms that don't natively support the Docker daemon. Support VirtualBox, VMware, and Parallels.
http://fnichol.github.io/dvm
Apache License 2.0
458 stars 71 forks source link

Add snag-port... #23

Closed ericfode closed 10 years ago

ericfode commented 10 years ago

You know for lazy people who don't like chanting long SSH incantations about port tunneling.

Credit where credit is due http://lalyos.github.io/blog/2013/10/06/access-docker-containers-via-internal-ip/ https://github.com/couchbaselabs/cbbb/blob/master/README.md

ericfode commented 10 years ago

Be warned it will leave ssh sessions open... This is not by any means optimal but it is better.

c10l commented 10 years ago

I would really like to see a more transparent solution in place. I'm looking into using docker-provider. :)

ericfode commented 10 years ago

That seems to be a vastly superior solution, I just pushed this along because there was nothing available at the moment. :)

c10l commented 10 years ago

Hmm.. I think I might have expressed myself wrong.

What I meant is that I was trying to use a dvm docker server along with the docker-provisioner (I develop on a Mac). That's currently not possible because the provisioner depends on having access to the container's network, which, as you already know, doesn't happen by default.

I'm wondering whether there's a way to implement something on the VirtualBox network that would make the containers' networks apparent to the main workstation...

ericfode commented 10 years ago

@cassianoleal I apparently can't read docs :P ... So let me make sure I grok what your getting at. You would like to use docker-provisioner with vagrant by setting up a virtual-box with a docker server running on it then doing some voodoo to automagically get ports forwarded to your machine as it's running so that it can access them while it is running?

(A bit of context) I am also developing on a mac, currently I am working on using fig (http://orchardup.github.io/fig/) for managing my development environments. What advantages do you see to using vagrant? ( I am still evaluating technologies and it sounds like you have used it much more throughly then I have) Thanks!

c10l commented 10 years ago

Ok, so here's my setup. I have dvm installed. That means I only need to dvm up and I can run docker commands directly from OSX. dvm exposes a remote docker port that I have setup on my .zshrc to use by default.

Next step is to use Vagrant with the docker provider. The idea is that Vagrant creates my containers and configures them using Chef or Puppet or whatever. I have this setup working on VirtualBox, but as you probably know, that's quite time consuming, and docker is a great alternative that would work fine on Linux.

The problem is that for Vagrant to work, it has to be able to SSH into the container, and it does so from the main workstation (in this case, the Mac), which doesn't work because the container's network is only exposed to the dvm machine.

I'm not sure I've made myself clear.. :)