How to use composer with php 7.2 with docker compose
Solution 1
composer/composer
image has been deprecated and moved to the official composer Docker Container. So you can replace:
image: composer/composer:php7
with:
image: "composer"
Take the time to check the Dockerfile so you can see that php:7-alpine
is used and then if you check its Dockerfile you'll see PHP_VERSION 7.2.1
.
Solution 2
You can use --ignore-platform-reqs
option
This option will ignore php, hhvm, lib-* and ext-* requirements and force the installation even if the local machine does not fulfill these.
Please refer to doc https://getcomposer.org/doc/03-cli.md
petekaner
Updated on June 05, 2022Comments
-
petekaner almost 2 years
I'm trying to create a simple dev env for a web symfony app with docker compose. My problem is when trying to execute composer install I get this error:
- doctrine/collections v1.5.0 requires php ^7.1 -> your PHP version (7.0.7) does not satisfy that requirement.
Here's the Composer part of my docker compose file:
composer: restart: 'no' image: composer/composer:php7 command: install volumes: - .:/app
So that install a php 7.0 and I need at least 7.1. I tried with composer/composer:php7.1 but didn't work.
Any idea on how to do this?
Thanks in advance
-
Lawrence Cherone about 6 yearsUse just
image: "composer"
instead, that's not the official image. -
Fariman Kashani over 2 yearsI get
docker.io/composer/composer:php7: not found
-
-
Ali about 6 yearsthis may solve your problem: howtoforge.com/tutorial/…
-
Данияр Саумбаев over 2 yearsdocker run --rm -v $(pwd):/app composer install --ignore-platform-reqs it works! Thank you!