Magento – Magento 2 – Really Bad Performance in Docker

deploymentdockermagento2performancestatic-content-deploy

we are using Docker on macOS for development and deployment and have massive performance problems especially in deployment.

Our deployment does a full project build with:

  • git clone
  • composer install
  • bin/magento setup:static-content:deploy en_US de_DE –exclude-theme Magento/blank –exclude-theme Magento/luma –force (take 3000 secs!!!!)
  • bin/magento setup:di:compile (take ~1000secs!!!!)

Does anyone know why these processes took that much time?

Update 08.2018

Now we are using docker-sync which "works", but adds an extra layer of complexity to all our M" projects which I want to avoid.

It's such a shame for Magento that it does not optimize for development workflow. All other projects like Laravel, Symfony, TYPO3, Drupal etc works like a charm but M2 sucks in performance caused by the count of files which needs to be read in a request lifecycle.

You can read more about this problem in this post:
https://docs.docker.com/docker-for-mac/osxfs-caching/

Best Answer

Shared Filesystem for Docker on MacOS is nightmarishly slow.

I will suggest:

  • Do not use a shared filesystem at all (and use PhpStorm Deploymechanism or http://docker-sync.io/)
  • Share only your code (using composer base instalation and share app/code/YourVendor or app/theme/*/YourVendor)
Related Topic