Magento Run on Docker

Project Description

I was able to use Docker to run a Magento 2 site locally on MacOS.

This was a challenge because the native version of Docker is not very performant on macOS because of current issues that the Docker team is facing with mounting volumes and handling events.

I was able to get satisfactory performance by going around these hurdles using a combination of docker sync and vagrant.

Instead of mounting Magento files through docker's default mounting mechanism, I used docker sync.

Vagrant was used to run the MySQL server. MySQL does not run well on the macOS Version of Docker. I think this is because the library version of Docker's MySQL image uses a volume mount by default.

This solution overall allowed me to keep the nice features of using Docker to run apache and php with a container that is based on an image defined in a docker file. With this I was able to build up the configuration for the system exactly how I wanted, rebuild the image quickly and in an automated fashion, revert changes that did not work in a clean and fast way.

Lessons Learned

Not too long after doing this I found out that Magento created DevBox. This is basically a docker image of Magento. I don't think I would do anything differently since a solution that only uses docker would inevitably face the same issues I faced and resolved.


equipment incompatibility
steep learning curve

Technical Skills Used

  • PHP
  • Docker
  • Vagrant
  • PHP
  • MySQL
  • Docker Sync
  • Princeton25.5384-80.4089
Ask me a question