When using docker, I encountered such a problem:
My php project uses composer to install extensions. I want to update every time I run docker, and also run it.
This forms two commands that need to be executed in the cmd of the docker container
php start.phpBut if I do this
composer update; php start.phpIn the actual docekr container
update; phpAs a parameter to analyze the use of
&&The same is true for separators, as follows
Do not run Composer as root/super user! See https://getcomposer.org/root for details [Symfony\Component\Console\Exception\CommandNotFoundException] Command "update&&" is not defined. Did you mean this? update
What am I supposed to do? Said to create a batch file, I thank you all, I already know this
I don’t know which way you started docker and which way you executed the command.
Let’s take the command line to start docker as an example to execute multiple commands in sequence.
docker run ... /bin/bash -c "composer update; php start.php;"