Docker (containerization) vs Vagrant (virtual machine) 🌱

  • What if you can run an application on your machine, but someone on another machine can’t?
  • If you want to manage machines, you should use Vagrant. If you want to build and run applications environments, you should use Docker. Vagrant is a tool for managing virtual machines. Docker is a tool for building and deploying applications by packaging them into lightweight containers.

Vagrant

monolithic

  • Say you start with a fresh virtual machine, then you have a β€œprovisioning script” which installs on the virtual machine all the extra software you need to run your application.
  • This β€œprovisioning script” is also run on the staging server (server for development/testing) and production server (server to publish finished application) so that anyone can inintialize a virtual machine and run your application.
  • Now, someone can just take your project code from github and run your application from any virtual machine as long as they use the β€œprovisioning script” to install everything.

Docker

monolithic

  • Docker uses a β€œdockerfile” to convert your project code and all installation requirements into a β€œdocker image” (this image is essentially everything you need to run your application).
  • You then run this β€œdocker image” as something called a β€œcontainer”, and you can run as many of these β€œcontainers” as you want on a single virtual machine (as long as you don’t run out of memory).
  • You store your β€œdocker image” on essentially a docker version of Github (like Docker Hub) and now any machine with Docker can run your applicatino using the β€œdocker image”.
  • Amazon’s β€œECS” (EC2 (elastic compute cloud) Container Service) platform can manage your containers for you.
  • Containers reuse the kernel the hosting OS. Most of the containers available out there are based on Linux, so they need to have access a Linux kernel for them to run. Therefore, if you’re on Windows and want to run one you would need to install a Linux VM and run the containers in the VM.

Notes mentioning this note

There are no notes linking to this note.


Here are all the notes in this garden, along with their links, visualized as a graph.