PHP extension unavailable to composer container in docker-compose PHP extension unavailable to composer container in docker-compose docker docker

PHP extension unavailable to composer container in docker-compose


Alternatively, you may pass the --ignore-platform-reqs and --no-scripts flags to install or update (as mentioned here).

docker run --rm --interactive --tty \    --volume $PWD:/app \    composer install --ignore-platform-reqs --no-scripts

But I always prefer installing composer in my php container.


You are installing the modules in your php service, but not in your composer service.

When composer runs, the php installation in its container doesn't have those modules installed.

You could install composer in your php container, and run it from there.

You could do it by simply adding:

# latest composerCOPY --from=composer:latest /usr/bin/composer /usr/bin/composer

In your php dockerfile, right after your RUN line.

That would require you removing your composer container completely, and run composer directly within the PHP container.

You can also simply run composer and tell it not to check for platform requirements:

docker run --rm --interactive --tty \    --volume $PWD:/var/www/html \    composer install --ignore-platform-reqs 

or if you have a separate composer container, for some reason:

docker-compose run composer install --ignore-platform-reqs


A better option could be to specify the env dependencies using platform setting. Found on: https://stackoverflow.com/a/55431247/2254615

"config": {"platform": {    "php": "7.2.14",    "ext-fileinfo": "1.0.5",    "ext-pdo": "7.2.14",    "ext-session": "7.2.14",    "ext-iconv": "7.2.14",    "ext-zip": "1.15.4"}