Skip to content

Increase compatibility for tty/no-tty options#1418

Draft
erikvanoosten wants to merge 1 commit intocontainers:mainfrom
erikvanoosten:increase-no-tty-compat
Draft

Increase compatibility for tty/no-tty options#1418
erikvanoosten wants to merge 1 commit intocontainers:mainfrom
erikvanoosten:increase-no-tty-compat

Conversation

@erikvanoosten
Copy link

@erikvanoosten erikvanoosten commented Mar 15, 2026

Increase compatibility with docker compose for exec and run commands for the tty options:

  • Add support for long option --no-tty besides -T.
  • Add support for hidden options -t and --tty.
  • Make default for tty auto-detected.
  • For the exec command: delegate to podman exec without --interactive when no-tty is specified.

The default for terminal/no-terminal is based on terminal detection, mimicking docker compose code for run and exec.

Hidden options -t and --tty are mimicking docker compose code for run and exec.

NOTE: the added integration tests require the script command to emulate a TTY. This command is available in most unix environments, but might not be present in a minimal docker image.

TODO: The run command should perhaps default to --no-tty and not add -i when --detach is used. Todo: find out what docker compose does.

Fixes #900.

Increase compatibility with docker compose for exec and run commands:

- Add support for long option `--no-tty` besides `-T`.
- Add support for hidden options `-t` and `--tty`.
- Make default for tty auto-detected.
- For the `exec` command: run `podman exec` without `--interactive` when no-tty is specified (the `run` command already does this).

The default for terminal/no-terminal is based on terminal detection, mimicking docker compose code for
[run](https://github.com/docker/compose/blob/3371227794f5f3645f4f19829c60a741635ed329/cmd/compose/run.go#L178)
and [exec](https://github.com/docker/compose/blob/3371227794f5f3645f4f19829c60a741635ed329/cmd/compose/exec.go#L72).

Hidden options `-t` and `--tty`
are mimicking docker compose code for [run](https://github.com/docker/compose/blob/3371227794f5f3645f4f19829c60a741635ed329/cmd/compose/run.go#L195-L196) and [exec](https://github.com/docker/compose/blob/3371227794f5f3645f4f19829c60a741635ed329/cmd/compose/exec.go#L77-L78).

NOTE: the added integration tests require the `script` command to emulate a TTY. This command is available in most unix environments, but might not be present in a minimal docker image.

Fixes containers#900.

Signed-off-by: Erik van Oosten <e.vanoosten@grons.nl>
@erikvanoosten
Copy link
Author

When I run the integration tests from the main branch on my machine (actually, in a clean fedora pod), a lot of them fail. I failed to find the cause. Unfortunately, I can't verify if my work caused more failures. Any help with fixing main would be appreciated.

@erikvanoosten
Copy link
Author

For the reviewers:
I realized that the run command should perhaps default to --no-tty and not add -i when --detach is used. For this I need some time to research what docker compose does.

Unfortunately, the Convert to draft button doesn't work at the moment!

@erikvanoosten erikvanoosten changed the title Increase compatibility for terminal/no-terminal options Increase compatibility for tty/no-tty options Mar 15, 2026
@erikvanoosten erikvanoosten marked this pull request as draft March 17, 2026 18:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support for turning off --interactive flag for podman-compose exec command

1 participant