M2 development with Docker

The story

Although I have tried so many docker-compose projects, I didn’t find any project that matches my requirement:

  • Uses only Official Images.
  • Simply enough to setup/modify.
  • No extra deployment step from host to containers after changing the code.

So I have created a docker-compose project. Below are the reasons for you to use or not use it:


  • Running Magento 2 project really fast on your machine.
  • Just a few steps to setup.
  • No extra step to deploy code from host to container.
  • Easy to modify PHP, MySQL, and Nginx configurations.
  • Works on Linux, macOS, and Windows.

Disadvantages (can be reduced in future releases):

  • Lack of advanced tools like Redis, Varnish, XDebug.
  • Lack of Environment variables configuration.
  • Lack of tests on various types of projects.

You can now jump to the Github project or read the installation instruction below (Linux only).

1. Install Docker & docker-compose

If you install docker with a non-root user, you will have permission issue, this is how to fix:

2. Getting started

It’s time to jump to the project README.md.

3. Some useful notes

Stop all other running containers to prevent port confliction:

Remove old unused images to reclaim disk space:

This post will be updated frequently

Leave a Reply

Notify of