command: docker compose exec
short: Execute a command in a running container
long: |-
    This is the equivalent of `docker exec` targeting a Compose service.

    With this subcommand, you can run arbitrary commands in your services. Commands allocate a TTY by default, so
    you can use a command such as `docker compose exec web sh` to get an interactive prompt.

    By default, Compose will enter container in interactive mode and allocate a TTY, while the equivalent `docker exec`
    command requires passing `--interactive --tty` flags to get the same behavior. Compose also support those two flags
    to offer a smooth migration between commands, whenever they are no-op by default. Still, `interactive` can be used to
    force disabling interactive mode (`--interactive=false`), typically when `docker compose exec` command is used inside
    a script.
usage: docker compose exec [OPTIONS] SERVICE COMMAND [ARGS...]
pname: docker compose
plink: docker_compose.yaml
options:
    - option: detach
      shorthand: d
      value_type: bool
      default_value: "false"
      description: 'Detached mode: Run command in the background'
      deprecated: false
      hidden: false
      experimental: false
      experimentalcli: false
      kubernetes: false
      swarm: false
    - option: env
      shorthand: e
      value_type: stringArray
      default_value: '[]'
      description: Set environment variables
      deprecated: false
      hidden: false
      experimental: false
      experimentalcli: false
      kubernetes: false
      swarm: false
    - option: index
      value_type: int
      default_value: "0"
      description: Index of the container if service has multiple replicas
      deprecated: false
      hidden: false
      experimental: false
      experimentalcli: false
      kubernetes: false
      swarm: false
    - option: interactive
      shorthand: i
      value_type: bool
      default_value: "true"
      description: Keep STDIN open even if not attached
      deprecated: false
      hidden: true
      experimental: false
      experimentalcli: false
      kubernetes: false
      swarm: false
    - option: no-tty
      shorthand: T
      value_type: bool
      default_value: "true"
      description: |
        Disable pseudo-TTY allocation. By default 'docker compose exec' allocates a TTY.
      deprecated: false
      hidden: false
      experimental: false
      experimentalcli: false
      kubernetes: false
      swarm: false
    - option: privileged
      value_type: bool
      default_value: "false"
      description: Give extended privileges to the process
      deprecated: false
      hidden: false
      experimental: false
      experimentalcli: false
      kubernetes: false
      swarm: false
    - option: tty
      shorthand: t
      value_type: bool
      default_value: "true"
      description: Allocate a pseudo-TTY
      deprecated: false
      hidden: true
      experimental: false
      experimentalcli: false
      kubernetes: false
      swarm: false
    - option: user
      shorthand: u
      value_type: string
      description: Run the command as this user
      deprecated: false
      hidden: false
      experimental: false
      experimentalcli: false
      kubernetes: false
      swarm: false
    - option: workdir
      shorthand: w
      value_type: string
      description: Path to workdir directory for this command
      deprecated: false
      hidden: false
      experimental: false
      experimentalcli: false
      kubernetes: false
      swarm: false
inherited_options:
    - option: dry-run
      value_type: bool
      default_value: "false"
      description: Execute command in dry run mode
      deprecated: false
      hidden: false
      experimental: false
      experimentalcli: false
      kubernetes: false
      swarm: false
deprecated: false
hidden: false
experimental: false
experimentalcli: false
kubernetes: false
swarm: false

