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
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]>
Copy file name to clipboardExpand all lines: content/compose/file-watch.md
+10-3Lines changed: 10 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -49,7 +49,6 @@ In order to work properly, `watch` relies on common executables. Make sure your
49
49
* stat
50
50
* mkdir
51
51
* rmdir
52
-
* tar
53
52
54
53
`watch` also requires that the container's `USER` can write to the target path so it can update files. A common pattern is for
55
54
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:
142
141
path: package.json
143
142
```
144
143
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.
146
145
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).
147
146
148
147
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
159
158
## Use `watch`
160
159
161
160
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.
163
162
3. Edit service source files using your preferred IDE or editor.
164
163
165
164
> **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
169
168
> for a demonstration of Compose `watch`.
170
169
{ .tip }
171
170
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
+
172
179
## Feedback
173
180
174
181
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