2021-03-08 15:47:24 +01:00
|
|
|
command: docker compose exec
|
|
|
|
short: Execute a command in a running container.
|
2021-09-13 17:41:21 +02:00
|
|
|
long: |-
|
2022-07-26 14:58:08 +02:00
|
|
|
This is the equivalent of `docker exec` targeting a Compose service.
|
2021-09-13 17:41:21 +02:00
|
|
|
|
2022-11-29 16:52:22 +01:00
|
|
|
With this subcommand, you can run arbitrary commands in your services. Commands allocate a TTY by default, so
|
2022-07-26 14:58:08 +02:00
|
|
|
you can use a command such as `docker compose exec web sh` to get an interactive prompt.
|
2022-08-02 13:11:57 +02:00
|
|
|
usage: docker compose exec [OPTIONS] SERVICE COMMAND [ARGS...]
|
2021-03-08 15:47:24 +01:00
|
|
|
pname: docker compose
|
|
|
|
plink: docker_compose.yaml
|
|
|
|
options:
|
2022-07-26 14:58:08 +02:00
|
|
|
- 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: "1"
|
|
|
|
description: |
|
|
|
|
index of the container if there are multiple instances of a service [default: 1].
|
|
|
|
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
|
2021-03-08 15:47:24 +01:00
|
|
|
deprecated: false
|
|
|
|
experimental: false
|
|
|
|
experimentalcli: false
|
|
|
|
kubernetes: false
|
|
|
|
swarm: false
|
|
|
|
|