I develop websites using python with django framework, I like to get things done fast. I used to use virtual machine or in the local host machine, recently went to vagrant, I am not sure if there is other technologies to help keep the process faster? I could use some tips and pointers.
The main difference lies in their architecture, demonstrated below. Virtual machines have host OS and the guest OS inside each VM. Guest OS can be any OS, like Linux or Windows, irrespective of host OS. In contrast, Docker containers host on a single physical server with a host OS, which shares among them.
Essentially, Docker is a technology for creating and running Linux containers, and Vagrant is a machine provisioning tool used to create VMs and then populate them with applications. In other words, you use Vagrant to create a VM and install Docker.
A virtual machine (VM) is a virtual environment that functions as a virtual computer system with its own CPU, memory, network interface, and storage, created on a physical hardware system (located off- or on-premises).
While Docker provides an isolated environment for your Python application, you're better off by using virtualenv (or your tool of choice) nevertheless. It can help you to maintain control over your Python environment & dependencies.
As we know, Docker focuses more on containers while Vagrant focused more on Virtual Machines. The container and virtual machine are generally compared on three following parameters. Read: Who Is A Devops Architect And How To Become One?
A virtualenv only encapsulates Python dependencies. A Docker container encapsulates an entire OS. With a Python virtualenv, you can easily switch between Python versions and dependencies, but you're stuck with your host OS.
Containers can be whipped up in milliseconds rather than minutes, and require megabytes of RAM rather than Gigabytes. While you can use Vagrant to run multiple instances of the same virtual machine to run multiple applications, doing with containers is going to have significantly better performance.
In the case of virtual machines, resources like CPU, memory, and I/O may not be allocated permanently to containers — unlike in the case of containers, where the resource usage with the load or traffic.
It isolates the Python interpreter and the Python dependencies on one machine so you can install multiple Python projects alongside each other with their own dependencies. But for the rest of the machine the virtualenv doesn't do anything:
you still have global dependencies / packages that are installed using your Mac OS X / Linux package manager and these are shared between the virtualenvs.
often used to programmatically configure virtual machines
specifies the whole machine: it allows you to specify the Linux distribution, packages to be installed and actions to be taken to install the project.
So if you want to launch a Vagrant box with multiple Python projects on that machine you'd still use virtualenv to keep the Python dependencies separate.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With