Docker ~ Run multiple commands and docker multiple commands

Source: Internet
Author: User

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!

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.