Hello, In my last blog you read about docker, Today let’s talk about how to do virtualization with vagrants.
Firstly, the main question is, what is vagrant, why should we adopt it in our working environment & what is the main difference between docker & vagrant?
As you may know about virtualization, Vagrant is also a part of virtualization. We get a complete base machine with the help of vagrant in a virtual box and it’s up to you that you handle it from the command line or you wanna use its graphical interface.
Because vagrant provides you with both interfaces GUI as well as CLI for virtualization, it is very feasible to run on your base machine, it didn’t consume a big amount of hardware on your base machine because it is also a lightweight application.
It uses the virtual box, VMware, and needs a single command to build up and get ready, through the command you can not only create a box but also you can destroy it and create another fresh box to work.
Now the other question is why should we adopt vagrants for virtualization.
It is very easy to handle, I mean it looks like no tangle of wires and you can easily run multiple developments or testing environments simultaneously on a single base machine.
I would also like to tell you that there are so many organizations that are not only working on vagrant but also have moved their testing servers on it, they are adopting this application because of its reliability and consistency and all the servers are running well on this application.
Even if I talk about my organization, we have also moved our couple of servers on vagrant and we get positive results, so you can say that I am writing this blog with practical experience.
One more thing that makes vagrant so attractive and trust-able, as if you are a developer and have done lots of coding on multiple websites and you have adopted vagrant as your working environment, then the next time, when you upgrade your operating system or do a fresh install, there’s no chance that things will stop working.
Just take a backup of your vagrant box and after installation, export your vagrant box back to your base machine and start your work from where you have left off.
Now, let’s talk about the main difference between Docker & Vagrant:-
It isn’t correct to compare Vagrant and Docker directly because in some scenarios they do overlap and in the vast majority they don’t, so it isn’t a fair comparison in most cases here are some points for knowledge that are mentioned below:
1) Vagrant is mostly in use for testing purposes while Docker is for developing purposes.
2) Vagrant knows how to configure some advanced or non-trivial things like networking and syncing folders. For example Vagrant knows how to attach a static IP to the machine, you just need to mention the IP address on that Vagrant file which you get after initializing.
3) The great thing about Docker is that it is lightweight because it relies on the shared kernel of the host machine but is isolated from the host, the user space for different containers can be based on different Linux distributions.
4) Vagrant makes its own Kernel with its OS while Docker always shares the kernel of the base machine.
A specific argument that I’ve heard in favor of using Docker instead of Vagrant is:
Docker is faster:- Once you have a host that can run Linux containers, Docker is definitely faster for running a container than any virtual machine would be. But launching a virtual machine is like a one-time cost. In production, Docker really shines because of its lightweight architecture.
I hope now it’s clear to see that it is very difficult and I believe It’s not correct, to compare Docker and Vagrant.
Conclusion
In highly specific use cases, Docker is certainly a possible replacement for Vagrant, but in most use cases, it is not. Vagrant doesn’t hinder your usage of Docker; it actually does what it can do to make that experience smoother. If you find this isn’t true, then I’m happy to take suggestions to improve my knowledge.
So, In the Next Article, I’ll Provide A Very Simple Way That You Can Follow To Get Yourself Up And Running.