docker/cli ยท error

cannot attach stdin to a TTY-enabled container because stdin

Error message

cannot attach stdin to a TTY-enabled container because stdin is not a terminal

What it means

Error "cannot attach stdin to a TTY-enabled container because stdin is not a terminal" thrown in docker/cli.

Source

Thrown at cli/streams/in.go:74

// value.
func (i *In) SetRawTerminal() error {
	return i.cs.setRawTerminal(term.SetRawTerminal)
}

// RestoreTerminal restores the terminal state if SetRawTerminal succeeded earlier.
func (i *In) RestoreTerminal() {
	i.cs.restoreTerminal()
}

// CheckTty reports an error when stdin is requested for a TTY-enabled
// container, but the client stdin is not itself a terminal (for example,
// when input is piped or redirected).
func (i *In) CheckTty(attachStdin, ttyMode bool) error {
	// TODO(thaJeztah): consider inlining this code and deprecating the method.
	if !ttyMode || !attachStdin || i.cs.isTerminal() {
		return nil
	}
	return errors.New("cannot attach stdin to a TTY-enabled container because stdin is not a terminal")
}

// SetIsTerminal overrides whether a terminal is connected. It is used to
// override this property in unit-tests, and should not be depended on for
// other purposes.
func (i *In) SetIsTerminal(isTerminal bool) {
	i.cs.setIsTerminal(isTerminal)
}

View on GitHub (pinned to e9452d6e78)

When it happens

Trigger: Thrown at cli/streams/in.go:74 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of docker/cli@e9452d6e78 (2026-08-01). Data as JSON: /data/errors/0256d7971bab46a6.json. Report an issue: GitHub.