You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<!--Delete sections as needed -->
## Description
Adds new attributes to the spec from the recent 2.32.0 release
## Related issues or tickets
<!-- Related issues, pull requests, or Jira tickets -->
## Reviews
<!-- Notes for reviewers here -->
<!-- List applicable reviews (optionally @tag reviewers) -->
- [ ] Technical review
- [ ] Editorial review
- [ ] Product review
Copy file name to clipboardExpand all lines: content/reference/compose-file/develop.md
+28-2Lines changed: 28 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -56,10 +56,36 @@ Compose to monitor source code for changes. For more information, see [Use Compo
56
56
`action` defines the action to take when changes are detected. If `action` is set to:
57
57
58
58
- `rebuild`, Compose rebuilds the service image based on the `build` section and recreates the service with the updated image.
59
+
- `restart`, Compose restarts the service container. Available with Docker Compose version 2.32.0 and later.
59
60
- `sync`, Compose keeps the existing service container(s) running, but synchronizes source files with container content according to the `target` attribute.
60
-
- `sync+restart`, Compose synchronizes source files with container content according to the `target` attribute, and then restarts the container.
61
+
- `sync+restart`, Compose synchronizes source files with container content according to the `target` attribute, and then restarts the container. Available with Docker Compose version 2.23.0 and later.
62
+
- `sync+exec`, Compose synchronizes source files with container content according to the `target` attribute, and then executes a command inside the container. Available with Docker Compose version 2.32.0 and later.
61
63
62
-
> `sync+restart` attribute is available with Docker Compose version 2.23.0 and later.
`exec`is only relevant when `action` is set to `sync+exec`. Like [service hooks](services.md#post_start), `exec` is used to define the command to be run inside the container once it has started.
69
+
70
+
- `command`: Specifies the command to run once the container starts. This attribute is required, and you can choose to use either the shell form or the exec form.
71
+
- `user`: The user to run the command. If not set, the command is run with the same user as the main service command.
72
+
- `privileged`: Lets the command run with privileged access.
73
+
- `working_dir`: The working directory in which to run the command. If not set, it is run in the same working directory as the main service command.
74
+
- `environment`: Sets the environment variables to run the command. While the command inherits the environment variables defined for the service’s main command, this section lets you add new variables or override existing ones.
75
+
76
+
```yaml
77
+
services:
78
+
frontend:
79
+
image: ...
80
+
develop:
81
+
watch:
82
+
# sync content then run command to reload service without interruption
The `label_file` attribute lets you load labels for a service from an external file or a list of files. This provides a convenient way to manage multiple labels without cluttering the Compose file.
1160
+
1161
+
The file uses a key-value format, similar to `env_file`. You can specify multiple files as a list. When using multiple files, they are processed in the order they appear in the list. If the same label is defined in multiple files, the value from the last file in the list overrides earlier ones.
1162
+
1163
+
```yaml
1164
+
services:
1165
+
one:
1166
+
label_file: ./app.labels
1167
+
1168
+
two:
1169
+
label_file:
1170
+
- ./app.labels
1171
+
- ./additional.labels
1172
+
```
1173
+
1174
+
If a label is defined in both the `label_file` and the `labels` attribute, the value in [`labels](#labels) takes precedence.
1175
+
1155
1176
### links
1156
1177
1157
1178
`links`defines a network link to containers in another service. Either specify both the service name and
0 commit comments