A lot of people ask me why you would use vagrant over docker and vice-versa in
this video I'm going to explain the differences between these two
technologies and when it might make sense to use one instead of the other
both vagrant and docker are similar in that they use virtualization technology
to isolate the application from the machine that is running on however they
both do this in different ways and each are better suited to different use cases
so what is docker
docker is an open-source containerization tool that
allows you to run your application in a lightweight image it works by creating
something called a docker file that contains all of the steps required to
build the image to run your application
during the build stage docker installs
all of the dependencies and code required to run your app an image is
typically based on a very lightweight stripped-down version of the Linux
operating system once you have your image you can use it to run your
application on your local development machine or deploy it to a production
server
because docker is designed to run in production it has a steeper learning
curve compared to vagrant
docker also only has limited versions available for
home editions of the Windows operating system
Vagrant is a tool used for
managing virtual development environments however it doesn't come
with any virtualization technology out of the box
vagrant works by using something called a hypervisor such as VirtualBox a tool
that's used to run virtual machines on a computer with vagrant you create a
vagrant file which contains all of the instructions for creating your
development server vagrant then uses the hypervisor to create and configure the
server on your machine
a vagrant server usually consists of a slimmed-down
but complete version of the Linux operating system such as Ubuntu
Because vagrant isn't designed to run in production it has an easier learning
curve compared to docker
also as vagrant supports a number of different
hypervisors it has a wider range of support for operating systems it runs on
Vagrant should run on any machine in which you can install and use VirtualBox
you would use docker if you're looking to streamline your workflow from
development to production and all of your developers on your project use a
supported operating system
vagrant is preferred if you're just getting started
or if you're looking for a development environment that's supported on a wider
range of operating systems