Why to use Vagrant or Docker for development?

Few years ago, I was introduced to Vagrant and for me it was the most elegant tools I ever used, at the end it ended up the most annoying argument I ever hear all the time ” It works on my computer “, at that my team at the company used to use MAMP (yes they all use MAC so we are all have the same OS but different versions), and when I did introduced Vagrant they really liked the idea, especially that it was so easy to have your environment up and running in just few hours (based on your internet connection and what tools you will have to download).

Now things got more better, so I created a Vagrant file which we all used and share, it was based on Vaprobash and everything went so simple after that, we never heard that annoying phrase anymore, we all now have the same environment (despite the fact that I always update & upgrade my installed image, and I cant guarantee that everyone else does that), and the benefit was way more than what we though, now if we are working for a Node.js project, you can just grab a Vagrant file or image for it, if we are working on PHP the choices are open and we have no limit.

Its 2017, and Docker now is way better than it used to be in the past, especially for development environment, and things started to be more simpler (somehow).

So basically Vagrant and Docker is used to duplicate the production environment, and to make simple to share the same environment with who ever you are working with, and not wasting time trying to solve the compatibility issues and try to figure out why its working on your computer but not on the other team member computer, even if you both have the same OS and the same version, which is something not always guaranteed.

In the past few months a new tool was created called valet and am quoting from the docs :

Valet is a Laravel development environment for Mac minimalists. No Vagrant, no /etc/hosts file. You can even share your sites publicly using local tunnels. Yeah, we like it too.

Laravel Valet configures your Mac to always run Nginx in the background when your machine starts. Then, using DnsMasq, Valet proxies all requests on the *.dev domain to point to sites installed on your local machine.

In other words, a blazing fast Laravel development environment that uses roughly 7 MB of RAM. Valet isn’t a complete replacement for Vagrant or Homestead, but provides a great alternative if you want flexible basics, prefer extreme speed, or are working on a machine with a limited amount of RAM.

So it assume that you are working on Mac, and it will build the development environment based on that fact (Yes I know there is a fork for linux), now trust me am not saying that its bad, no its not, but you need to be smart to know when to use it, if you are working on a personal project, go for it and use it, if you are working on a PHP library development I think you can too, at the end its a library not a full client project, but if its otherwise I think you should think twice before you use it, I mean think about the future of the project that you are working on, is it something that you and only you will work? is it a project that you will deliver and tell that client to get out of your face and find another developer to work on if he needs new features ? is it .. etc, the questions here is somehow limitless but you will need to find the smart questions and answer them correctly, especially if you are not going to work alone nor its a personal project.

What define us as a developers, is the fact that we always plan ahead, we spend a lot of time planing and a lot less coding and executing, the technology we use should always be a way to improve our way of planing, our way of delivering and our way of executing.

Its 2017 not 2005 any more everyone, other wise we will still be using Xampp (a tool I really loved and used a lot in the past) or any other tool like it.

Resources to read :

  1. Vagrant CookBook (Last updated on 2017-01-27): https://leanpub.com/vagrantcookbook
  2. Servers for Hackers (Last updated on 2016-07-22): https://leanpub.com/serversforhackers
  3. Vagrant Provisioning Bash Scripts : https://github.com/fideloper/Vaprobash


As always, you may find some lingual mistakes in my post, as english is not my mother language, so if you do and want to help me out, just let me know so I can fix it.


Filed under: Code, docker, Other, PHP

No comment yet, add your voice below!

Add a Comment

Your email address will not be published. Required fields are marked *

Comment *

Name *
Email *