skip to Main Content

When I run

docker run --rm -v $(pwd):/opt -w /opt laravelsail/php81-composer:latest composer install

to install all the composer dependencies,

these popped up

~/Crowdstage$ docker run --rm -v $(pwd):/opt -w /opt laravelsail/php81-composer:latest composer install
Installing dependencies from lock file (including require-dev)
Verifying lock file contents can be installed on current platform.
Your lock file does not contain a compatible set of packages. Please run composer update.

  Problem 1
    - spatie/image is locked to version 2.2.2 and an update of this package was not requested.
    - spatie/image 2.2.2 requires ext-exif * -> it is missing from your system. Install or enable PHP's exif extension.
  Problem 2
    - spatie/laravel-medialibrary is locked to version 10.3.4 and an update of this package was not requested.
    - spatie/laravel-medialibrary 10.3.4 requires ext-exif * -> it is missing from your system. Install or enable PHP's exif extension.

To enable extensions, verify that they are enabled in your .ini files:
    -
    - /usr/local/etc/php/conf.d/docker-php-ext-bcmath.ini
    - /usr/local/etc/php/conf.d/docker-php-ext-pcntl.ini
    - /usr/local/etc/php/conf.d/docker-php-ext-sodium.ini
    - /usr/local/etc/php/conf.d/docker-php-ext-zip.ini
You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.

What is the proper way to set up PHP environment in docker for laravel ?

2

Answers


  1. Chosen as BEST ANSWER

    This is how you can install composer dependencies in a cloned project

    docker run --rm -v $(pwd):/opt -w /opt laravelsail/php81-composer:latest composer install --ignore-platform-reqs


  2. If I understand correctly, you want to run composer install inside the php container. You can do this by running

    docker-compose exec laravel.test "composer install"
    

    if laravel.test is the container name

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