Docker ~ Run multiple commands and docker multiple commands
Recently, we are working on the deployment of jenkins pipeline. you do not want to install the dotnet sdk when deploying net core. For better portability, you plan to directly use the docker image of aspnetcore and run it through docker, at this time, there was a problem: docker run aspnetcore: 2.0. If you want to execute multiple sh commands at the same time, you still have to write a script file. This is what uncle does not like!
Docker run aspnetcore: 2.0 ls & ls
The result is that the first ls displays the content in the container, and the second ls displays the content of the local centos, which is not what uncle hopes!
Uncle hopes to execute two ls commands, that is, multiple sh commands, in the container. This avoids the headache of adding SH files!
Then, uncle found some information. Fortunately, he found some information!
Docker run 5800 sh-c "ls & echo '-------' & ls"
In fact, a sh-c command is added after the run Command, followed by multiple statements directly!
This is the expected result. Now, you can create unnecessary files instead of SH files!