Home > other >  Cant set up php enviroment in Docker
Cant set up php enviroment in Docker

Time:05-14

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 ?

CodePudding user response:

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

CodePudding user response:

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

  • Related