Hacker News new | ask | show | jobs
by zyang 4432 days ago
Vagrant was a huge step forward for managing vm environments, but I'm afraid its integration with Docker is forced and misguided.

For instance, the idea of ssh provisioner does not jive with Docker. The better approach is run the container with shared volume, and run another bash container to access the shared volume. If you are just starting to look at Docker, I would recommend to use Vagrant to provision the base image, and leave the heavy lifting to Docker itself.

2 comments

What you described is actually the default way the Docker provider works, which aligns with the best-practice of how Docker is used: you can launch a set of single-process containers that don't support SSH, but have volumes mounted, links, etc. Then you use `vagrant docker-run` to launch one-off containers with bash, or run scripts, etc. The first two videos and examples show this.

To be clear: see the first example Vagrantfile that is in the blog post. Then read down further and see `docker-run`. You can use that to launch another container to get a bash prompt. This is _exactly_ the workflow you describe.

We built exactly for this. :)

We also support SSH-based containers, but you can see that it is explicitly opt-in (you must set "has_ssh" to "true"), also showing that it really isn't the normal way things are done.

Vagrant is about flexibility, and we surface both use-cases.

Yeah, part of me was thinking that too. Use container volumes. Use dockerfiles. And don't all containers support lxc-attach (as opposed to SSH?).

I didn't want to be negative -- it'd be great to be able to have an environment set up in 10 seconds with vagrantfiles -- so until then I'm trying to see the positives.