From a14f4e7f6a1a6e4cb9c3c06c6f6600f7dba4d9c5 Mon Sep 17 00:00:00 2001 From: Nicolas De Loof Date: Fri, 26 Apr 2024 16:41:16 +0200 Subject: [PATCH 1/2] recommend use of up --watch and document watch command as an alternative Signed-off-by: Nicolas De Loof --- content/compose/file-watch.md | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/content/compose/file-watch.md b/content/compose/file-watch.md index 0188f10c6240..125206821408 100644 --- a/content/compose/file-watch.md +++ b/content/compose/file-watch.md @@ -49,7 +49,6 @@ In order to work properly, `watch` relies on common executables. Make sure your * stat * mkdir * rmdir -* tar `watch` also requires that the container's `USER` can write to the target path so it can update files. A common pattern is for 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: path: package.json ``` -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. +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. 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). 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 ## Use `watch` 1. Add `watch` sections to one or more services in `compose.yaml`. -2. Run `docker compose watch` to build and launch a Compose project and start the file watch mode. +2. Run `docker compose up --watch` to build and launch a Compose project and start the file watch mode. 3. Edit service source files using your preferred IDE or editor. > **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 > for a demonstration of Compose `watch`. { .tip } + +> **Watch command +> +> Watch can also be used with the dedicated `docker compose watch` command if you don't want to +> get application logs mixed with (re)build logs and filesystem sync events. +{ .tip } + + ## Feedback 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). From 1e9259465c29367c81673f22c88ab0611d4700d4 Mon Sep 17 00:00:00 2001 From: Allie Sadler <102604716+aevesdocker@users.noreply.github.com> Date: Fri, 26 Apr 2024 16:03:05 +0100 Subject: [PATCH 2/2] Apply suggestions from code review --- content/compose/file-watch.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/content/compose/file-watch.md b/content/compose/file-watch.md index 125206821408..2c971a00e3bf 100644 --- a/content/compose/file-watch.md +++ b/content/compose/file-watch.md @@ -169,10 +169,10 @@ This pattern can be followed for many languages and frameworks, such as Python w { .tip } -> **Watch command +> **Tip** > > Watch can also be used with the dedicated `docker compose watch` command if you don't want to -> get application logs mixed with (re)build logs and filesystem sync events. +> get the application logs mixed with the (re)build logs and filesystem sync events. { .tip }