skip to Main Content

I am trying to run my laravel app on docker. Its an old app I am trying to resurface and was built on php 7.1

Locally, it works fine.

On Docker, I used the following config:

FROM php:7.1-fpm-alpine

RUN docker-php-ext-install pdo pdo_mysql sockets
RUN curl -sS https://getcomposer.org/installer​ | php -- 
     --install-dir=/usr/local/bin --filename=composer

COPY --from=composer:latest /usr/bin/composer /usr/bin/composer

WORKDIR /app
COPY . .
RUN composer install

Its not allowing me to install composer and gives the following error:

[stage-0 7/7] RUN composer install:
#0 0.221 Composer 2.3.0 dropped support for PHP <7.2.5 and you are running 7.1.33, please upgrade PHP or use Composer 2.2 LTS via "composer self-update –2.2". Aborting.

I tried doing RUN composer self-update --2.2 instead but its the same error.

Can anyone tell me how to go install this specific version of composer on docker.

Thank you

2

Answers


  1. All composer releases are accessible via their GitHub repository, including the composer.phar binary archive files. Instead of installing the latest version from getcomposer.org, just use a version that works with your PHP version.

    The composer.phar for composer 2.2.9 can be found here: https://github.com/composer/composer/releases/tag/2.2.9

    Login or Signup to reply.
  2. Composer installer permit to choose the version:

    RUN curl -sS https://getcomposer.org/installer​ | php -- 
       --2.2 
       --install-dir=/usr/local/bin
     
    

    See https://getcomposer.org/download/

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search