Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to execute multiple commands after run in docker

2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article will explain in detail how to execute multiple commands after run in docker. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.

In the deployment of jenkins pipeline, but in the deployment of. Net core do not want to install dotnet sdk, in order to better portability, intend to directly use aspnetcore docker image, through docker to run it, and at this time there is a problem docker run aspnetcore:2.0 if you want to simultaneously execute multiple sh commands have problems, but also have to write a script file, this is the uncle does not like!

Docker run aspnetcore:2.0 ls & & ls

The result is that the first ls displays the contents of the container, while the second ls displays the contents of the local centos, which is not what the uncle wants!

Uncle hopes that two ls, that is, multiple sh commands, will be executed in the container, so as to avoid the trouble of adding new SH files!

Then the uncle found some information, fortunately, was found by the uncle!

Docker run 5800 sh-c "ls & & echo'-'& & ls"

In fact, a sh-c command is added after run, followed by multiple statements directly!

This is the result I hope. Finally, there is no need to establish SH files in the future. We should not have established redundant files in the first place!

This is the end of this article on "how to execute multiple commands after run in docker". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 293

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report