← All posts

Why docker compose run consumed my SSH stdin

A short note about an unexpected interaction between Compose and an interactive shell.

#Docker#Linux

Context

A command invoked over SSH behaved as if the remote shell had stopped accepting input. The application was still running; standard input had been claimed by a Compose process.

What happened

docker compose run allocates interactive input by default. Inside an SSH-driven workflow, that default can consume the same stream expected by the surrounding command or shell.

The useful part

When a command behaves differently over SSH, inspect which process owns standard input before debugging the application itself.

For non-interactive automation, make the intent explicit instead of relying on terminal detection:

docker compose run -T service command

What I learned

TTY and stdin defaults are convenient at a terminal but become hidden coupling in automation. Commands used over SSH should state whether they are interactive.