Skip to content

[BUG] Error when stdin is not a TTY but stdout is a TTY #13228

@SmartHypercube

Description

@SmartHypercube

Description

docker-compose will error with a misleading message when stdin is not a TTY but stdout is a TTY, and stdin_open: true. docker doesn't have this problem.

Steps To Reproduce

  1. compose.yaml:
services:
  main:
    image: debian:trixie
    command: ['cat']
    stdin_open: true
  1. echo a | docker-compose run --rm main | cat
    You will get an a as output.
  2. echo a | docker-compose run --rm main
    I expect to get an a as output, because echo a | docker run -i --rm debian:trixie cat also outputs an a. But I got the input device is not a TTY, which is misleading --- I did not ask for a TTY, why is docker-compose complaining the input device not being a TTY? And it's very hard to guess that the actual problem is related to stdout (being a TTY), not stdin.

Compose Version

# docker compose version
Docker Compose version 2.26.1-4
# docker-compose version
Docker Compose version 2.26.1-4

Docker Environment

Client:
 Version:    26.1.5+dfsg1
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  0.13.1+ds1
    Path:     /usr/libexec/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  2.26.1-4
    Path:     /usr/libexec/docker/cli-plugins/docker-compose
...
 Kernel Version: 6.12.43+deb13-amd64
 Operating System: Debian GNU/Linux 13 (trixie)
...

Anything else?

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions