Debian Codegraph @

docs/reference/docker_compose_exec.yaml

raw
1 command: docker compose exec
2 short: Execute a command in a running container
3 long: |-
4 This is the equivalent of `docker exec` targeting a Compose service.
5
6 With this subcommand, you can run arbitrary commands in your services. Commands allocate a TTY by default, so
7 you can use a command such as `docker compose exec web sh` to get an interactive prompt.
8
9 By default, Compose will enter container in interactive mode and allocate a TTY, while the equivalent `docker exec`
10 command requires passing `--interactive --tty` flags to get the same behavior. Compose also support those two flags
11 to offer a smooth migration between commands, whenever they are no-op by default. Still, `interactive` can be used to
12 force disabling interactive mode (`--interactive=false`), typically when `docker compose exec` command is used inside
13 a script.
14 usage: docker compose exec [OPTIONS] SERVICE COMMAND [ARGS...]
15 pname: docker compose
16 plink: docker_compose.yaml
17 options:
18 - option: detach
19 shorthand: d
20 value_type: bool
21 default_value: "false"
22 description: 'Detached mode: Run command in the background'
23 deprecated: false
24 hidden: false
25 experimental: false
26 experimentalcli: false
27 kubernetes: false
28 swarm: false
29 - option: env
30 shorthand: e
31 value_type: stringArray
32 default_value: '[]'
33 description: Set environment variables
34 deprecated: false
35 hidden: false
36 experimental: false
37 experimentalcli: false
38 kubernetes: false
39 swarm: false
40 - option: index
41 value_type: int
42 default_value: "0"
43 description: Index of the container if service has multiple replicas
44 deprecated: false
45 hidden: false
46 experimental: false
47 experimentalcli: false
48 kubernetes: false
49 swarm: false
50 - option: interactive
51 shorthand: i
52 value_type: bool
53 default_value: "true"
54 description: Keep STDIN open even if not attached
55 deprecated: false
56 hidden: true
57 experimental: false
58 experimentalcli: false
59 kubernetes: false
60 swarm: false
61 - option: no-tty
62 shorthand: T
63 value_type: bool
64 default_value: "true"
65 description: |
66 Disable pseudo-TTY allocation. By default 'docker compose exec' allocates a TTY.
67 deprecated: false
68 hidden: false
69 experimental: false
70 experimentalcli: false
71 kubernetes: false
72 swarm: false
73 - option: privileged
74 value_type: bool
75 default_value: "false"
76 description: Give extended privileges to the process
77 deprecated: false
78 hidden: false
79 experimental: false
80 experimentalcli: false
81 kubernetes: false
82 swarm: false
83 - option: tty
84 shorthand: t
85 value_type: bool
86 default_value: "true"
87 description: Allocate a pseudo-TTY
88 deprecated: false
89 hidden: true
90 experimental: false
91 experimentalcli: false
92 kubernetes: false
93 swarm: false
94 - option: user
95 shorthand: u
96 value_type: string
97 description: Run the command as this user
98 deprecated: false
99 hidden: false
100 experimental: false
101 experimentalcli: false
102 kubernetes: false
103 swarm: false
104 - option: workdir
105 shorthand: w
106 value_type: string
107 description: Path to workdir directory for this command
108 deprecated: false
109 hidden: false
110 experimental: false
111 experimentalcli: false
112 kubernetes: false
113 swarm: false
114 inherited_options:
115 - option: dry-run
116 value_type: bool
117 default_value: "false"
118 description: Execute command in dry run mode
119 deprecated: false
120 hidden: false
121 experimental: false
122 experimentalcli: false
123 kubernetes: false
124 swarm: false
125 deprecated: false
126 hidden: false
127 experimental: false
128 experimentalcli: false
129 kubernetes: false
130 swarm: false
131