add description of 'initial_sync' attribute in Compose watch documentation (#23421)

<!--Delete sections as needed -->

## Description
Describe the new added `initial_sync` attribute of Compose watch
configuration

## Related issues or tickets
Fix #23345

## Reviews

<!-- Notes for reviewers here -->
<!-- List applicable reviews (optionally @tag reviewers) -->

- [ ] Technical review
- [x] Editorial review
- [ ] Product review

---------

Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
Co-authored-by: aevesdocker <allie.sadler@docker.com>
This commit is contained in:
Guillaume Lours
2025-09-18 11:54:30 +02:00
committed by GitHub
parent 67e9f7bf4d
commit 7fbf498277
2 changed files with 11 additions and 0 deletions

View File

@@ -118,6 +118,10 @@ For `path: ./app/html` and a change to `./app/html/index.html`:
The `ignore` patterns are relative to the `path` defined in the current `watch` action, not to the project directory. In the following Example 1, the ignore path would be relative to the `./web` directory specified in the `path` attribute.
### `initial_sync`
When using a `sync+x` action, the `initial_sync` attribute tells Compose to ensure files that are part of the defined `path` are up to date before starting a new watch session.
## Example 1
This minimal example targets a Node.js application with the following structure:
@@ -142,6 +146,7 @@ services:
- action: sync
path: ./web
target: /src/web
initial_sync: true
ignore:
- node_modules/
- action: rebuild

View File

@@ -124,6 +124,12 @@ services:
> In many cases `include` patterns start with a wildcard (`*`) character. This has special meaning in YAML syntax
> to define an [alias node](https://yaml.org/spec/1.2.2/#alias-nodes) so you have to wrap pattern expression with quotes.
#### `initial_sync`
When using `sync+x` actions, it can be useful to ensure that files inside containers are up to date at the start of a new watch session.
The `initial_sync` attribute instructs the Compose runtime, if containers for the service already exist, to check that the files from the path attribute are in sync within the service containers.
#### `path`
`path` attribute defines the path to source code (relative to the project directory) to monitor for changes. Updates to any file