I'm getting the next error after docker-compose up.

Fatal error: Allowed memory size of 2097152 bytes exhausted (tried to allocate 12288 bytes) in /var/www/html/vendor/zendframework/zend-modulemanager/src/ModuleManager.php

Magento ver. 2.1.7 I'm using mageinferno/magento2-php:7.0-fpm-1

Here is docker-compose code:

version: '3'

    build: ./.docker/phpfpm
        - database
        - ./:/var/www/html
        - XDEBUG_CONFIG=remote_host=
        - PHP_IDE_CONFIF=serverName=terp

nginx: build: ./.docker/nginx links: - phpfpm volumes: - .:/var/www/html ports: - "8083:80"

database: image: mysql:5.7 environment: - MYSQL_ROOT_PASSWORD=qwerqwer - MYSQL_DATABASE=terp - MYSQL_USER=terp - MYSQL_PASSWORD=qwerqwer ports: - "3311:3306" volumes: - ./mysql-data:/var/lib/mysql

What could be the reason of that?

  • Looks like your memory limit (either PHP or docker) is set to 2mb.
    – Zefiryn
    Commented Jul 4, 2017 at 19:43
  • But I set limit to 2G Commented Jul 10, 2017 at 10:48
  • I think php disagrees. Put 'phpinfo()' into index.php and double check
    – Zefiryn
    Commented Jul 10, 2017 at 10:54
  • I have about the same pb: Magento2 is ok, then i empty cache, and bam: memory limit, and then i have to restart my containers... without even being sure it will work -_- Commented Oct 6, 2017 at 9:43

1 Answer 1


I was able to solve this by adding the actual value directly inside the php.ini file and mounting my custom version of it in the container. Apparently the variable PHP_MEMORY_LIMIT is not there when running the cron.

You can see the default php.ini file here https://github.com/mageinferno/docker-magento2-php/blob/master/conf/php.ini

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.