简体   繁体   English

如何向 docker 容器内的应用程序 shell 注入命令?

[英]How to inject command to application shell inside docker container?

When running跑步时

docker exec mycontainer -it  -- /usr/bin/myapp 

myapp shell is opened myapp shell 已打开

myapp>

How to inject command to that prompt scriptable way so that it would be the same like giving command manually?如何以可编写脚本的提示方式注入命令,使其与手动发出命令一样?

myapp>mycommand

You can try this:你可以试试这个:

docker exec -i mycontainer /usr/bin/myapp << EOF
mycommand
EOF

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM