无法在 Docker 中设置 php 环境

Cant set up php enviroment in Docker

当我运行

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

安装所有作曲家dependencies,

弹出这些

~/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.

在 docker 中为 laravel 设置 PHP 环境的正确方法是什么?

如果我没理解错的话,你想运行composer install放在php容器里面。您可以通过 运行ning

docker-compose exec laravel.test "composer install"

if laravel.test is the container name

这是在克隆项目中安装 composer 依赖项的方法

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