Skip to content

Proposal: add -i and -t flags on docker compose run and exec #9207

@thaJeztah

Description

@thaJeztah

The defaults for -t / --tty (allocate a pseudo-TTY) and -i / --interactive (Keep STDIN open even if not attached) for docker compose exec and docker compose run are exactly the reverse as the corresponding docker (container) run / docker container exec commands.

For docker compose, users can disable these options using the -T / --no-TTY options; we'll unlikely be able to change these defaults on either side (also see #9202), but we could make the UX slightly more compatible by adding the same flags to docker compose subcommands.

Currently, trying to use the -i and/or -t options will produce an error;

docker compose run -it myservice
unknown shorthand flag: 'i' in -it

docker compose exec -it myservice
unknown shorthand flag: 'i' in -it

I propose to add these flags to (at least) the run and exec subcommands. Setting those options won't have an effect (as they're already set by default), but it allows users to use the same options when using compose (which can be just due to "muscle memory");

  • Add -t / --tty flag, with a default of true
  • Add -i / --interactive flag with a default of true
  • Produce an error passing both -t or -i and -T (conflicting options)

I should note that there's other commands on the docker / docker container that also accept -t and/or -i, such as docker (container) create, and a --no-stdin on docker (container) attach (but compose does not yet have an equivalent to that).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions