Open gwynforthewyn opened 2 years ago
There hasn't been any activity on this issue for a long time.
If the problem is still relevant, mark the issue as fresh with a /remove-lifecycle stale
comment.
If not, this issue will be closed in 14 days. This helps our maintainers focus on the active issues.
Prevent issues from auto-closing with a /lifecycle frozen
comment.
/lifecycle stale
/remove-lifecycle stale
/lifecycle frozen
I'm keeping this one open because this really took a decent amount of investigation to understand, and I'm just a community member who worked with another community member trying to figure this behaviour out, which took a fair bit of time.
I'm really not sure what the right fix is, as I had said, but the confusing issue is there.
File: engine/reference/commandline/run.md
Picking up from this slack thread https://dockercommunity.slack.com/archives/C7GKACWDV/p1649427806814209, the behaviour of
docker run -a stdin
seems is a bit confusing.The current
docker run
docs show that the--interactive
flag will "Keep STDIN open even if not attached". In order to attach STDIN without the--interactive
flag, the docs show that--attach stdin
is available.The expectation was that
docker run -a stdin -a stdout -a stderr busybox cat < foo.txt
would be equivalent todocker run -i busybox cat < foo.txt
. However, docker run without the-i
flag but with stdin/stderr/stdout attached displays nothing to stdout.After investigation, it looks historically like there was confusion about how
--interactive
would behave when-a stdin
was not specified (https://github.com/moby/moby/pull/12401). There's some discussion across several issues (https://github.com/moby/moby/pull/14390, https://github.com/moby/moby/pull/14417) about whether there were use-cases for--interactive
when stdin wasn't attached, with the conclusion that the right way to fix was to enforce that-a stdin
is silently enforced whenever--interactive
is specified.My read here is that the initial use-case for the
-a stdin
flag was to pair with the--interactive
flag (again, cf. this diff https://github.com/moby/moby/pull/12401/files), and that's always happening since PR 14417.However, that leaves
-a stdin
now as a cli option without clear purpose. It appears to me that specifyingdocker run -a stdin -a stdout -a stderr busybox cat < foo.txt
results in stdin being attached, then the handles are being detached before any output can happen. I expected the handles to be blocked open until after the command output is returned.I'm not sure what the best docs fix here is; maybe
-a stdin
has use-cases that aren't obvious to me here? I'm happy to help answer questions as best I can to try and find a way to clarify the intended behaviour.