Skip to content

Commit 0e7b4d5

Browse files
ndeloofaevesdocker
andauthored
recommend use of up --watch and document watch command as an alternative (#19895)
* recommend use of up --watch and document watch command as an alternative Signed-off-by: Nicolas De Loof <[email protected]> * Apply suggestions from code review --------- Signed-off-by: Nicolas De Loof <[email protected]> Co-authored-by: Allie Sadler <[email protected]>
1 parent 23912a5 commit 0e7b4d5

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

content/compose/file-watch.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ In order to work properly, `watch` relies on common executables. Make sure your
4949
* stat
5050
* mkdir
5151
* rmdir
52-
* tar
5352

5453
`watch` also requires that the container's `USER` can write to the target path so it can update files. A common pattern is for
5554
initial content to be copied into the container using the `COPY` instruction in a Dockerfile. To ensure such files are owned
@@ -142,7 +141,7 @@ services:
142141
path: package.json
143142
```
144143
145-
In this example, when running `docker compose watch`, a container for the `web` service is launched using an image built from the `Dockerfile` in the project's root.
144+
In this example, when running `docker compose up --watch`, a container for the `web` service is launched using an image built from the `Dockerfile` in the project's root.
146145
The `web` service runs `npm start` for its command, which then launches a development version of the application with Hot Module Reload enabled in the bundler (Webpack, Vite, Turbopack, etc).
147146

148147
After the service is up, the watch mode starts monitoring the target directories and files.
@@ -159,7 +158,7 @@ This pattern can be followed for many languages and frameworks, such as Python w
159158
## Use `watch`
160159

161160
1. Add `watch` sections to one or more services in `compose.yaml`.
162-
2. Run `docker compose watch` to build and launch a Compose project and start the file watch mode.
161+
2. Run `docker compose up --watch` to build and launch a Compose project and start the file watch mode.
163162
3. Edit service source files using your preferred IDE or editor.
164163

165164
> **Looking for a sample project to test things out?**
@@ -169,6 +168,14 @@ This pattern can be followed for many languages and frameworks, such as Python w
169168
> for a demonstration of Compose `watch`.
170169
{ .tip }
171170

171+
172+
> **Tip**
173+
>
174+
> Watch can also be used with the dedicated `docker compose watch` command if you don't want to
175+
> get the application logs mixed with the (re)build logs and filesystem sync events.
176+
{ .tip }
177+
178+
172179
## Feedback
173180

174181
We are actively looking for feedback on this feature. Give feedback or report any bugs you may find in the [Compose Specification repository](https://github.com/compose-spec/compose-spec/pull/253).

0 commit comments

Comments
 (0)