Hacker News new | ask | show | jobs
by sneak 1313 days ago
AFAIK you can use the libvirt provider for Vagrant that will use qemu VMs (via libvirtd management) from the standard Vagrant workflow, presumably solving the performance problems he mentioned.

TBH I miss Vagrant. I wish there were a Dockerfile, but for VMs.

3 comments

FWIW it's not too difficult to convert a docker image to a VM rootfs. See rootfs_builder[0] for example.

I'm currently working on a wrapper for QEMU that has docker-like semantics for pull/run/start/stop/exec/etc, but it will pull docker images from docker registries and convert them to qcow2 for you and run them in QEMU. It works on Linux and Windows and should run on MacOS and BSD eventually.

[0]: https://github.com/ForAllSecure/rootfs_builder

EDIT: Also see https://iximiuz.com/en/posts/from-docker-container-to-bootab...

Why not look at Packer? I use it quite significantly for creating base VMs.

Provisioner scripts can effectively be broken down from the Dockerfile RUN layers as Bash or Powershell scripts. Then output as a vagrant box or hypervisor VM export VM of choice. For exposing ports, just run an iptables or powershell New-NetFirewallRule.

Whilst you can't get volume mounts can use the file provisioner to embed local files on build.

Then import it and create a default snapshot. Want it back to its original state? Revert snapshot and done!

Yeah, I think I stumbled across using the libvirt provider, however libvirt is just another abstraction (a very useful one) over multiple virtualization technologies. I much prefer working directly with QEMU for local dev environments since I only need a one and done machine.