composer.json
"platform":
{
"php": "7.3" #Put the version you want
}
And run composer update
FROM php:7.3-fpm-buster
Rewrite to docker-compose up -d
OK
I had to change the PHP of the Laravel environment that was already running from 7.4 to 7.3 I manage the library with composer, but it doesn't work if I just set the container image to 7.3. I get an error like this
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. It is recommended that you run `composer update` or `composer update <package name>`.
Your requirements could not be resolved to an installable set of packages.
Problem 1
- This package requires php ^7.4.0 but your PHP version (7.3.24) does not satisfy that requirement.
Docker
FROM php:7.4-fpm-buster
//The following is omitted
To
FROM php:7.3-fpm-buster
//The following is omitted
I want to move
composer.json
"platform":
{
"php": "7.3" #Put the version you want
}
And run composer update
### 2 Erase the docker image
```
docker-compose down --rmi all --volumes
```
Do
### 3 Docker File rewrite
```dockerfile
FROM php:7.4-fpm-buster
//The following is omitted
```
To
```dockerfile
FROM php:7.3-fpm-buster
//The following is omitted
```
Rewrite
### 4 build
```docker-compose up -d --build```Run
Then what?
```
$ docker-compose exec php bash
$ hoge@fugafugab5318:/var/www/html# php -v
PHP 7.3.24 (cli) (built: Nov 18 2020 10:14:01) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.24, Copyright (c) 1998-2018 Zend Technologies
```
that's all
Recommended Posts