使用Docker Compose的交互式外壳 [英] Interactive shell using Docker Compose
问题描述
myapp:
image:alpine:最新
entrypoint:/ bin / sh
当我使用docker-compose启动这个容器它立即退出。有没有任何可以添加到entrypoint命令的标志,或者作为myapp的附加选项,作为交互式shell启动?
我知道有本机docker命令选项实现这个,只是好奇,如果可能只使用Docker Compose。
最好的问候,
鲍里斯
您需要在docker-compose.yml中包含以下行:
stdin_open:true
tty:true
第一个对应于 docker运行
中的-i ,第二个到 -t
。
Is there any way to start a interactive shell in a container using Docker Compose only? I've tried something like this, in my docker-compose.yml:
myapp:
image: alpine:latest
entrypoint: /bin/sh
When I start this container using docker-compose up it's exited immediately. Are there any flags I can add to the entrypoint command, or as and additional option to myapp, to start as interactive shell?
I know there are native docker command options to achieve this, just curious if it's possible using only Docker Compose, too.
Best regards, Boris
You need to include the following lines in your docker-compose.yml:
stdin_open: true
tty: true
The first corresponds to -i
in docker run
and the second to -t
.
这篇关于使用Docker Compose的交互式外壳的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!