2017-08-02 117 views
0

我要同時運行兩個命令:需要運行多個命令

  1. bash
  2. service nginx start

如何傳遞那些通過使用下面的命令?

kubectl run nginx --image=nginx --command -- <cmd> <arg1> ... <argN> 

kubectl run -it testnew --image=imagename --command -- "/bin/bash","-c","service nginx start && while true; do echo bye; sleep 10;done" --requests=cpu=200m 

回答

1

不確定--command標誌如何工作或應該工作。

這個工作對我來說,在我得到的bash永遠循環和打印「再見」運行Nginx的。 kubectl run -it testnew --image=nginx -- /bin/bash -c "service nginx start && while true; do echo bye; sleep 10;done"

而不是這個特殊的命令,你可能想創建一個在開始時運行腳本的調整圖像。更容易管理正在運行的內容,更難以丟失定製內容。