BiteSize notes
This project is maintained by gwynevans
Vagrant is a tool focused on providing a consistent development environment workflow across multiple operation systems.
Docker is a container management that can consistently run software as long as a containerization system exists.
They solve two different problems. Vagrant provisions hosts on which to run things, whether it be a local vm or a remote host. Docker creates containers on a host, but doesn’t provision hosts. Docker is an application that runs things (containers) and exposes them on a network, whether it is on one or many hosts.
“It isn’t correct to directly compare Vagrant to Docker. In some scenarios, they do overlap, and in the vast majority, they don’t. Actually, the more apt comparison would be Vagrant versus something like Boot2Docker (minimal OS that can run Docker). Vagrant is a level above Docker in terms of abstractions, so it isn’t a fair comparison in most cases.
Vagrant launches things to run apps/services for the purpose of development. This can be on VirtualBox, VMware. It can be remote like AWS, OpenStack. Within those, if you use containers, Vagrant doesn’t care, and embraces that: it can automatically install, pull down, build, and run Docker containers, for example. With Vagrant 1.6, Vagrant has docker-based development environments, and supports using Docker with the same workflow as Vagrant across Linux, Mac, and Windows. Vagrant doesn’t try to replace Docker here, it embraces Docker practices.
Docker specifically runs Docker containers. If you’re comparing directly to Vagrant: it is specifically a more specific (can only run Docker containers), less flexible (requires Linux or Linux host somewhere) solution. Of course if you’re talking about production or CI, there is no comparison to Vagrant! Vagrant doesn’t live in these environments, and so Docker should be used.
If your organization runs only Docker containers for all their projects and only has developers running on Linux, then okay, Docker could definitely work for you!
Otherwise, I don’t see a benefit to attempting to use Docker alone, since you lose a lot of what Vagrant has to offer, which have real business/productivity benefits:
To address specific counter arguments that I’ve heard in favor of using Docker instead of Vagrant:
In conclusion: in highly specific use cases, Docker is certainly a possible replacement for Vagrant. In most use cases, it is not. Vagrant doesn’t hinder your usage of Docker; it actually does what it can to make that experience smoother. If you find this isn’t true, I’m happy to take suggestions to improve things, since a goal of Vagrant is to work equally well with any system.”
(i.e. This applies to my scenario - it may well not apply to yours…)
The production environment is your main deployment target. It mostly means that you should only use Docker if your hosting provider has some sort of built-in support already for it, e.g. AWS EBS/ECS, GKE, etc. If you’re deploying directly on EC2 or some other kind of VPS then just go with Vagrant, which is more development-oriented and easier to manage.