Hello, In my last blog you have read about docker, Today lets talk about vagrant,
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 virtual box and its up to you that you handle it from command line or you wanna use its graphical interface because vagrant provides you both interfaces GUI as well as CLI, 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 light weight application, It uses virtual box, VMware and need a single command to build up and get ready, through 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 vagrant in our working environment ?
It is very easy to handle, I mean it looks like no tangle of wires and you can easily run multiple development or testing environments simultaneously on a single base machine, I would also like to tell you that there are so many organizations which are not only working on vagrant but also they 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 a practical experience.
One more thing 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 the 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.
Now, lets 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 but here are some points for knowledge which are mentioned below:
1) Vagrant is mostly used for testing purpose while Docker is used for developing purpose.
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 IP address on that Vagrant file which you get after initializing.
3) The great thing about Docker is that it is light-weight because it relies on shared-kernel of host machine but 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 base machine.
A specific arguments that I’ve heard in favor of using Docker instead of Vagrant is:
Docker is faster:- Once you have the 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 shine because of its lightweight architecture.
I hope now its clear to see that it is very difficult and I believe It’s not correct, to compare Docker and Vagrant.
In 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,
I’m happy to take suggestions to improve my knowledge…:)
So, In Next Article, I’ll Provide A Very Simple Way That You Can Follow To Get Yourself Up And Running.