hsnsd
hsnsd

Reputation: 1823

Install older version of composer on docker

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

Upvotes: 1

Views: 1900

Answers (2)

DeadApe
DeadApe

Reputation: 61

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

Upvotes: 2

Syscall
Syscall

Reputation: 19764

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/

Upvotes: 1

Related Questions