Composer memory limit docker Composer memory limit docker docker docker

Composer memory limit docker


Composer has its own COMPOSER_MEMORY_LIMIT environment variable, but uses php.ini's memory_limit by default when its own variable is not set. https://getcomposer.org/doc/03-cli.md#composer-memory-limit

With Docker Compose you will need to pass COMPOSER_MEMORY_LIMIT as an environment variable to the container where Composer is installed. Your docker-compose.yml file would look like this:

services:  php-fmp: //the name of your container (as per your question)    environment:      - COMPOSER_MEMORY_LIMIT=-1 //-1 means unlimited

This environment variable would be taken into account every time you run Composer with docker-compose:

docker-compose exec php-fmp composer [your composer command]


Instead of php -d memory_limit=-1 composer install try COMPOSER_MEMORY_LIMIT=-1 composer install. Composer starts a new php process, that does not adhere to the setting you provide and it might even override the config (I'm not a 100% sure about that).

If that still does not help open the preferences for Docker (by clicking on the icon in the task bar) under the Advanced tab you can specify how many cores and how much memory docker is allowed to consume. I think the default is 2GB and you might want to change that to e.g. 4GB.