Should I Use Vagrant or Docker for Creating an Isolated Environment?

Better Stack Team
Updated on August 1, 2022

This depends on what exactly you want to do. The short answer would be that if you want to manage virtual machines, you want to use Vagrant. If you want to build and run an application environment, you want to use Docker. If you want to know more, let's deep dive a little.


Docker is a tool for building, managing and running virtual application environments. It creates a standardized environment by packaging the application into lightweight containers that are easily portable. A container can hold pretty much any software component along with its dependencies (executables, libraries, configuration files, etc.), and execute it in a guaranteed and repeatable runtime environment. This makes it very easy to build your app once and deploy it anywhere - on your laptop for testing, then on different servers for live deployment, etc.

It's a common misconception that you can only use Docker on Linux. That's incorrect; you can also install Docker on Mac, and Windows. When installed on Mac, Docker bundles a tiny Linux VM (25 MB on disk!) which acts as a wrapper for your container. Once installed this is completely transparent; you can use the Docker command line in exactly the same way.


Vagrant is a virtual machine manager. It allows you to script the virtual machine configuration as well as the provisioning. However, it is still a virtual machine depending on VirtualBox (or others) with a huge overhead. It requires you to have a hard drive file that can be huge, it takes a lot of memory, and performance may not be very good.

Vagrant launches machines to run apps/services for the purpose of development. This can be on VirtualBox, VMware. It can be remote like AWS, or 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.

Got an article suggestion? Let us know
Explore more
Licensed under CC-BY-NC-SA

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

We are hiring.

Software is our way of making the world a tiny bit better. We build tools for the makers of tomorrow.

Explore all positions →