From 5aea94794cdba43901d2c43d9f09c5f11fe0126b Mon Sep 17 00:00:00 2001 From: Guillaume Lours <705411+glours@users.noreply.github.com> Date: Fri, 19 Sep 2025 09:37:58 +0200 Subject: [PATCH] Update comment on run command with tty & piped command Co-authored-by: Nicolas De loof Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com> --- cmd/compose/run.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmd/compose/run.go b/cmd/compose/run.go index 14fefdb5b..2c6362ef1 100644 --- a/cmd/compose/run.go +++ b/cmd/compose/run.go @@ -184,7 +184,10 @@ func runCommand(p *ProjectOptions, dockerCli command.Cli, backend api.Service) * options.noTty = !ttyFlag } } else if !cmd.Flags().Changed("no-TTY") && !cmd.Flags().Changed("interactive") && !dockerCli.In().IsTerminal() { - // Check if the command was piped or not, if so, force noTty to tru + // while `docker run` requires explicit `-it` flags, Compose enables interactive mode and TTY by default + // but when compose is used from a scripr has stdin piped from another command, we just can't + // Here, we detect we run "by default" (user didn't passed explicit flags) and disable TTY allocation if + // we don't have an actual terminal to attach to for interactive mode options.noTty = true }