混淆了docker的-i“即使未连接也保持STDIN打开". [英] Confuse about docker's -i "Keep STDIN open even if not attached"
问题描述
-i
标志被描述为即使未连接也保持STDIN打开",但是 Docker运行参考还说:
The -i
flag is described as "Keep STDIN open even if not attached", but Docker run reference also says:
如果您未指定-a,则Docker将附加所有标准流.
If you do not specify -a then Docker will attach all standard streams.
那么,默认情况下,标准输入是附加的,但没有打开?我认为连接STDIN但未打开时没有任何意义,对吧?
So, by default, stdin is attached, but not opened? I think it doesn't make any sense when STDIN is attached but not opened, right?
推荐答案
使用: 换句话说,如果设置了 In other words, stdin is attached only if 从这种意义上讲,所有"标准流都不准确. In that sense, "all" standard streams isn't accurate. As commented below, that code (referenced by the doc) has since changed to: 这篇关于混淆了docker的-i“即使未连接也保持STDIN打开".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!flStdin := cmd.Bool("i", false, "Keep stdin open even if not attached")
-i
,则仅 附加stdin.-i
is set. if *flStdin {
flAttach.Set("stdin")
}
cmd.Var(&flAttach, []string{"a", "-attach"}, "Attach to STDIN, STDOUT or STDERR")
-a
不再附加所有流",而是.-a
does not man anymore "attach all streams", but "specify which streams you want attached".var (
attachStdin = flAttach.Get("stdin")
attachStdout = flAttach.Get("stdout")
attachStderr = flAttach.Get("stderr")
)
-i
remains a valid option:if *flStdin {
attachStdin = true
}