Answer the question
In order to leave comments, you need to log in
How to run 1 php script on two containers with different PHP version using docker-compose?
I more or less figured out how to launch it through a yml file, but I can’t figure out how to make it for different services. All the examples that I googled demonstrate the launch of one service.
In short, I need to create a yml that sequentially launches the program for both versions of PHP and writes the results of the work.
And do I need to make a dockerfile for this or specify different ones for different containers. I admit that I missed something in terms of what to write in the yml file for this.
Answer the question
In order to leave comments, you need to log in
Something like this:
docker-compose.xml
version: '3.1'
services:
php74:
image: php:7.4
volumes:
- ./:/opt/site
container_name: php-74
working_dir: /opt/site
command: php -f /opt/site/somescript.php
php73:
image: php:7.3
volumes:
- ./:/opt/site
container_name: php-73
working_dir: /opt/site
command: php -f /opt/site/somescript.php
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question