5 ms·
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, pr
by andrewmcwatters 5y ago
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-unattended https://www.virtualbox.org/manual/UserManual.html#basic-unat...
[2]: https://www.vagrantup.com/intro/vs/docker https://www.vagrantup.com/intro/vs/docker
Edit: Thank you for the excellent insights!
- deleted 5y ago[deleted]
- woodruffw 5y agoI'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.
- 8bitbuddhist 5y agoThe 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.
- nonameiguess 5y agoA 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.
- gscho 5y agoAny development of config management (ie: chef, ansible, etc) benefits from vagrant as well for the same reasons.
- TheGuyWhoCodes 5y agoI 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.
- aidos 5y agoAs 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.
- andrewmcwatters 5y agoI 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.
- deleted 5y ago[deleted]
- carlosf 5y agoDocker 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.
- hedwall 5y agoThe VMWare plugin for Vagrant is now OSS and free as well.
- dharmab 5y agoI 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.
- mshekow 5y agoI'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/ https://www.augmentedmind.de/2020/08/02/vagrant-vs-docker/