Docker’s cmd parameter executes two commands at a time

  docker, question

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.php start.php
This forms two commands that need to be executed in the cmd of the docker containercomposer updateAndphp start.phpBut if I do thiscomposer update; php start.phpIn the actual docekr containerupdate; 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 for details
 Command "update&&" is not defined.
 Did you mean this?

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;"