Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

1K
Views
PHP-FPM Alpine Docker Image 7.4 installs PHP version 8.0

since the latest php fpm docker image update yesterday (https://hub.docker.com/_/php?tab=tags&page=1&name=fpm-alpine) my pipeline is broken because apparently PHP version 8 is installed instead of 7.4 as in my Dockerfile specified.

I am using this in my docker file:

FROM php:7.4-fpm-alpine AS ...

But according to my composer installs the container has PHP 8.0.13 running:

 Root composer.json requires php 7.4.26 but your php version (8.0.13) does not satisfy that requirement.

Anyone an idea what is going on here?

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

As Jeremy Brooks already mentioned, Alpine released version 3.15 where composer requires PHP 8 (https://pkgs.alpinelinux.org/package/v3.15/community/x86_64/composer). Instead of installing composer from getcomposer.org another solution is to use Alpine 3.14:

FROM php:7.4-fpm-alpine3.14 AS ...
over 4 years ago · Santiago Trujillo Report

0

I may have hit the same issue. Those alpine PHP images do not include composer, so how are you installing it? If you are using apk, it looks like the latest alpine composer package is pulling php8 in as a dependency. What solved this issue for me is to install composer using the install script from getcomposer.org instead of using apk. Assuming this is what you are doing, remove this from your Dockerfile:

RUN apk add composer

and add:

ADD https://getcomposer.org/installer ./composer-setup.php
RUN php ./composer-setup.php --install-dir=/usr/local/bin --filename=composer
RUN rm ./composer-setup.php

If composer is indeed included in your base image, you could try uninstalling first:

RUN apk delete composer

and then add the above code to install it from the setup script instead.

Edit: adding the ignore-platform-reqs flag will probably get you past the error, but you are introducing a possible point of failure in the future if you have a composer package with a platform requirement. In that case, you won't know about the error until runtime. I would not recommend that approach. The method I posted above will install composer using the version of PHP already on the system and will not require risky workarounds.

over 4 years ago · Santiago Trujillo Report

0

I'm currently working on my docker-compose file to install laravel 8 with php 8.

I tested "php:7.4-fpm-alpine", and when I access the container I'm getting this version of php :

/var/www/html # php --version  
PHP 7.4.26 (cli) (built: Nov 30 2021 08:21:51) ( NTS )

You can test it yourself :

docker container ls
docker exec -it <container_id> sh
php --version

I'm getting PHP 8.0.13 when installing "php:8.0-fpm-alpine"

Also I'm creating my laravel project using the composer image, I don't have php/composer installed locally. It's something you might have a look, because it could be quickly confusing ;-)

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!