4

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

petekaner
  • 8,071
  • 5
  • 29
  • 52

3 Answers3

11

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.

dlondero
  • 2,539
  • 1
  • 24
  • 33
1

you can create your custom DOCKERFILE and build an image with php7.1

StefTweet
  • 11
  • 1
  • this may solve your problem: https://www.howtoforge.com/tutorial/how-to-create-docker-images-with-dockerfile/ – CodeMonkey Feb 05 '18 at 07:41
1

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

Yehia
  • 386
  • 2
  • 9