Vagrant vs Docker for Development?

I apologize in advance if this starts a religious war – that is not my intent. But I have been thinking hard about Docker versus Vagrant for building development environments. I wanted to share my current thinking and welcome constructive feedback. (And if you found this article at random on the web, the following discussion is oriented around Magento development.)

Why does it matter?

There are a multiple efforts by different people on development environments for Magento 2. Mark Shust immediately comes to mind on the Docker side, Joshua Warren has MageScotch on the Vagrant side, I would of course be remiss to not mention the Vagrant box used by a number of internal Magento developers, and there are lots more (feel free if you develop one to drop a link in the comments). It’s a great community, and I am sure there will be more out there as people work on and refine these images.

But I do get asked “why doesn’t Magento just define a single recommended way to do things”. The point here is not to restrict developers to that one way, but rather for people who just want to get going, is there a recommended path forward so they don’t have to do the evaluation of alternatives themselves.

Why not support both?

The answer may be to support both. But it goes against the “have one recommendation so I don’t have to think” approach.

Why is this sort of Virtualization better than a native environment?

There are a few benefits (and a few negatives).


  • It is less work to get going – someone has installed all the tools for you. MAMP, WAMP, XAMP etc are proving to be less effective with M2 because they do not include all the tools needed for modern development. Vagrant boxes / Docker images are filling effectively the same gap, but anyone can build such an environment.
  • If you work on multiple projects, you can have tools sets correct per project. (I don’t only mean Magento projects here – I mean any projects.) Sometimes you need a specific version of PHP, MySQL, Memcached, and so on.


  • IDEs tend to work better natively.
  • Performance of filesystem access has been a problem, which impacts performance during development.

So what do you think Alan?

Right now, Vagrant seems to have the greater mindshare and adoption for development. Roughly twice the people seem to be using Vagrant than Docker for this sort of situation (at least for people I bump into). It is also integrated into PHP Storm better, the most common IDE for Magento developers.

Docker definitely has the greater mindshare in terms of deployment (being used live in production). There are lots of hosting partners with native Docker support. Docker also feels like it has greater momentum and investment. But a good local development environment is not the same as a production environment, so Docker popularity in production does not make it more important for local development.

I am very interested in is the upcoming Docker release that claims to have eliminated some of the slowness of filesystem access with full inotify access (for Mac at least – not sure about Windows). The main issue for Windows users is it needs Windows 10, and it won’t be available probably until June 2016.

Regarding installation effort, some people say Vagrant is easier to install. Personally I found the latest version of Docker easier to install (with Docker Toolbox). A single download and it installed all required software for me. Vagrant needed more things installed – I had to find Virtual box, install some extension to it, and then I could start using it.


Today, even though I personally am more of a Docker advocate, it feels like Vagrant still has the edge. (A personal prediction is in 6 months’ time this may no longer be true.) The basis for this is really around PHP Storm integration. It has better built in Vagrant support today. There are articles on running PHP Unit tests with PHP Storm running locally and unit tests running inside the Vagrant box.

So my questions to you, the community

  • Do you think Magento should publish an “official” development environment? (My personal answer is “yes”.)
  • Do you have concrete reasons why you think Vagrant is not the best option here?

Remember, think about it from the mass of developer’s point of view – what is best for the product, not only for yourself. Personally, I am probably going to keep using Docker more than Vagrant. But my personal reasons I do not think are applicable to the greater developer audience. Vagrant feels like the right choice, at least for the next 6 months.

And yes, the next question is which Vagrant box to use as a basis for standardizing on. But that feels like an easier question – that is just a matter of comparing a few boxes for coverage, seeing if the current owner is happy for Magento to “own” at least a fork of the external project, and so on. That is a much easier question than Docker vs Vagrant.


  1. Nestor González · · Reply

    I just whant to say Thanks for having this communication open with the community, I really enjoy this new Magento era.

    And Yes, I think it would be great if there is a Oficial Magento developmento environmet. And I dont care if it changes along the way (evolution comes with changes right?)

  2. Although the end result should be standardized by the open source project maintainer in order to avoid open source chaos, choice of environment/tools used to accomplish this result should be left to the community. Simply let the nature take its course and decide on the best tool for the job, that’s how good open source works. Please read this paragraph before biting into anything that’s not directly related to Magento code.

    1. The goal is not to mandate an environment, but we certainly would not the first project to provide a Vagrant box. Laravel for example provides a Vagrant box to make it easier to get up and going. So if you don’t want the Vagrant box, sure, don’t use it. There is no requirement to do so. But if you want to get on with Magento without worrying about tool set up, the goal is to provide a modern equivalent of MAMP/XAMP/WAMP etc (using Vagrant instead). If nothing else, just viewing the Vagrant file can be educational – another reference for what tools to install instead of the installation manual.

  3. To prevent performance problem, I use Vagrant + vmware plugin for vagrant + Vmware Fusion on OsX. Both Vmware plugin and software cost around 150 $ together but it’s far more effective to work with Magento or Symfony as the nfs driver is more efficient.

    My 50 cts

    1. Cool – do you know if it’s good for Windows too?

  4. mstojanov · · Reply

    Hi Alan. First of all, thanks for putting so much effort into Magento2. You and your team always tend to hear feedback from the community, and please keep it doing. That’s the best way to keep Magento2 healthy.

    This post is just what I was waiting for. I found that one of the most annoying things with Magento2 is its speed in development mode. People (myself first) are never sure if it’s because of Magento2, or their environment is not set correctly. Average developer doesn’t know too much about system fine-tuning, specifically not on Vagrant/Docker. I believe that Magento2 can work fast (maybe not as fast as Magento 1.x, but at least with acceptable response-time) if the environment is set in the best possible way. At the moment, we can Google a lot of “best” solutions for Magento/PHP development, but I would really love to have an official environment, recommended by Magento. I would really love to know how core developers internally work on the platform, because I am pretty sure it’s working fast for you. Personally, I use Vagrant for all of my projects, however I am open to switch to Docker or anything else.

  5. Mr Khoa · · Reply

    Yes, Magento should publish an “official” development environment.

  6. Simon Sprankel · · Reply

    Thanks for being so open and communicative, Alan!

    I think a recommended Vagrant box would be awesome. It is always good to have an official recommendation. If more advanced developers do not want to use it, they can still set up another environment.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: