通过命令行在Docker容器中运行Linux命令

时间:2020-03-12 18:47:20

标签: bash docker unix kubernetes

我有此命令

clear; sudo kubectl exec -it $(kubectl get pods | grep 'app' | cut -d ' ' -f 1) ash 

我将降落在这里

/src # 

我还要运行命令ls

/src # ls                                                                                           
Procfile             composer.lock        phpunit.xml          server.php                           
app                  config               public               storage                              
artisan              database             resources            tests                                
benu.code-workspace  heroku.sh            routes               vendor                               
bootstrap            package-lock.json    run.sh               webpack.mix.js                       
composer.json        package.json         scripts                                                   
/src #   

我尝试过

clear; sudo kubectl exec -it $(kubectl get pods | grep 'app' | cut -d ' ' -f 1) ash echo "ls"

clear; sudo kubectl exec -it $(kubectl get pods | grep 'app' | cut -d ' ' -f 1) echo "ls"

请纠正我

1 个答案:

答案 0 :(得分:2)

如果要运行命令,则需要product <- plot_ly( mkt533_product, x = ~ onsitetrainers_x, y = ~ lowprice_y, z = ~ flexibleclasses_z, color = ~ name, colors = c( "#AB1100", "#00274C", "#00B5AF", "#00274C", "#00274C", "#72088E", "#E9B000", "#0050AC" ) ) %>% add_markers() %>% layout(scene = list( xaxis = list(title = "Professional guidance", range = c(1, 10)), yaxis = list(title = "Value for money", range = c(1, 10)), zaxis = list(title = "Time flexibility", range = c(1, 10)) )) 。如果您输入kubectl exec -it $podname ls,则该命令将运行,即打印“ ls”。