News for hackers. Stuff that matters.
Re:Toward Vagrant 3.0 by andrewmcwatters on Friday June 11, 2021 @02:46PM (#27477060)
I'm late to using Vagrant, hands-on. I used it years ago, but didn't build my own Vagrantfiles. It seems to be a very nice programmatic wrapper around using, primarily, VirtualBox's Unattended Guest Installation[1], though it can use other providers, too.

But I've noticed that it seems like you can skip straight to using docker containers for development environments as well. I'm wondering what other people's experience here is with both or either software.

In my opinion, both still seem like relevant software. When I need an Ubuntu development environment on my Mac, I don't turn to Docker. I think of Vagrant right now, because that's what it was built for. Vagrant is a tool for managing virtual machines and development environments.[2]

[1]: https://www.virtualbox.org/manual/UserManual.html#basic-unat...

[2]: https://www.vagrantup.com/intro/vs/docker

Edit: Thank you for the excellent insights!

Re:Toward Vagrant 3.0 by woodruffw on Friday June 11, 2021 @02:52PM (#27477124)
I've used both extensively. At least in my case, my uses are slightly different:

* Docker is nice for consistent development and deployment environments, particularly when I'm on a macOS host and I'm doing userspace programming.

* Vagrant is nice for creating a completely hermetic development environment, both on macOS and Linux hosts. My particular use case has been kernelspace programming: it's nice to not have to worry about accidentally taking my host down. Docker can't provide that kind of isolation, since it's still running on the host (or host VM) kernel at the end of the day.

Re:Toward Vagrant 3.0 by nonameiguess on Friday June 11, 2021 @03:04PM (#27477252)
A VM can still use systemd as init rather than an entrypoint script, so if you're developing systemd units, you need a VM. There is also the issue of running your application in a container in the first place. Docker in Docker is possible, but cumbersome. Redhat has certainly made it easier with Podman, but Docker still dominates developer mindshare. It's also quite a bit easier to persist changes in a VM, so rather than rearchitecting the OS or toolchain secrets management, user-specific configuration in a VM can just be done by the user after first launch and it sticks around. Simpler to do that than providing instructions and capability to mount git credentials store and gpg trust dbs into a container, then worrying about making sure you have the same UID in the container and out of it, so you don't mess up permissions.

Containers are largely just not a great medium for interactive work, i.e. development. They're great for resident applications that use a single process run via a service account.

Re:Toward Vagrant 3.0 by gscho on Friday June 11, 2021 @06:38PM (#27479363)
Any development of config management (ie: chef, ansible, etc) benefits from vagrant as well for the same reasons.
Re:Toward Vagrant 3.0 by carlosf on Friday June 11, 2021 @03:41PM (#27477575)
Docker is much faster than Vagrant and allows reproducible envs.

I've been using VS Code + its Remote-Containers extension + docker-compose (when needed) and it's absolutely brilliant compared to other options.

I will use Vagrant when I want to avoid Docker in Docker, but I try to stay away from it as much as I can (for local app development).

That said Vagrant is really useful for testing infra, stuff like clusters etc.

Re:Toward Vagrant 3.0 by qxmat on Friday June 11, 2021 @06:35PM (#27479335)
If you export your docker socket to the container you can avoid the poor performance of docker-in-docker
Re:Toward Vagrant 3.0 by carlosf on Friday June 11, 2021 @07:35PM (#27479806)
DinD has many gotchas and I dislike it in general.
Re:Toward Vagrant 3.0 by porker on Saturday June 12, 2021 @03:05AM (#27482281)
> Docker is much faster than Vagrant

On some host operating systems. On others it's a similar speed.

Re:Toward Vagrant 3.0 by TheGuyWhoCodes on Friday June 11, 2021 @03:13PM (#27477316)
I used to run Vagrant for python development back in 2015 it "worked" but was extremally slow and would break at least once a month. Not to mention Ubuntu suddenly removing the Vagrant user breaking more things. How much was VirtualBox or Vagrant fault, I'm not sure but it wasn't a happy experience. It took like an hour minimum to even setup an environment and everyone dreaded the day when they need to recreate their machine.

Once WSL came into being we moved everything to docker containers and never looked back.

Re:Toward Vagrant 3.0 by aidos on Friday June 11, 2021 @03:18PM (#27477363)
As a counterpoint, vagrant has never broken on me, nor been slow. It’s mostly a configuration system for VM providers, so I don’t even see how that makes sense.
Re:Toward Vagrant 3.0 by andrewmcwatters on Friday June 11, 2021 @03:20PM (#27477385)
I agree, this seems more like a provisioning issue, as Vagrant and VirtualBox aren't going to do anything too different than what you would normally do setting up your own native development environment.
Re:Toward Vagrant 3.0 by 8bitbuddhist on Friday June 11, 2021 @03:01PM (#27477219)
The way I see it, Vagrant does for VMs what Docker does for containers: provides a way to build, deploy, manage, and teardown VMs consistently and without much manual effort. For example, I used Vagrant when learning to use Kubernetes, because I could quickly spin up a 3 node cluster on my laptop and destroy it if I messed up.

If you can use containers for local dev, great, but not everyone can or wants to migrate to containers. Vagrant still solves a very important use case.

Re:Toward Vagrant 3.0 by mshekow on Saturday June 12, 2021 @02:22AM (#27482077)
I've found Vagrant very useful to test (or develop) GUI-based applications, especially on platforms which Docker cannot run as container, such as macOS. I've also collected further thoughts on when to choose which (and how they can be combined) here: https://www.augmentedmind.de/2020/08/02/vagrant-vs-docker/
Re:Toward Vagrant 3.0 by dharmab on Friday June 11, 2021 @03:52PM (#27477673)
I used Vagrant extensively when I managed infrastructure at a company that was almost entirely private cloud based. I would create Linux VMs in Vagrant to test our infrastructure automation. The automation would then be deployed into VMware to create the platform used by the developers.
Re:Toward Vagrant 3.0 by hedwall on Friday June 11, 2021 @03:51PM (#27477671)
The VMWare plugin for Vagrant is now OSS and free as well.