Docker-独立且具有交互性? [英] Docker - Detached and Interactive?

查看:73
本文介绍了Docker-独立且具有交互性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在阅读不同的书籍,文章和论坛主题时,我经常看到以下Docker Run命令:

When reading different books, articles and forum threads I often saw the following Docker Run command:

docker run -tid <dockerimage>

我真的不明白:开始分离是否有意义(-d)具有 pseudo tty (-t)的容器 interactive (-i)吗?

What I really don't understand: Does it make sense to start a detached (-d) Container interactive (-i) with pseudo tty (-t) ?

I意味着分离的容器永远不会提示您进入控制台,因此我认为不必使用-it来调用它。

I mean a detached Container will never prompt you to a console so I don't think it's necessary to call it with -it.

推荐答案

当仅使用-d选项运行映像时,该容器将在执行命令后立即退出。如果使用-itd选项运行,则该容器将被分离但在后台运行,并且您可以在需要时附加。有关更多信息,请参见附件中的屏幕截图。

When you run an image with only -d option, the container will exit immediately after the command executed. If you run with -itd option, the container will be detached but running in background, and you can attach back when you need. See the screenshot attached for more clarity.

这篇关于Docker-独立且具有交互性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆