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
- 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
- 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.