mirror of https://github.com/docker/docs.git
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 <nicolas.deloof@gmail.com> * Apply suggestions from code review --------- Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com> Co-authored-by: Allie Sadler <102604716+aevesdocker@users.noreply.github.com>
This commit is contained in:
parent
23912a5120
commit
0e7b4d540b
|
|
@ -49,7 +49,6 @@ In order to work properly, `watch` relies on common executables. Make sure your
|
||||||
* stat
|
* stat
|
||||||
* mkdir
|
* mkdir
|
||||||
* rmdir
|
* 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
|
`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
|
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
|
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).
|
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.
|
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`
|
## Use `watch`
|
||||||
|
|
||||||
1. Add `watch` sections to one or more services in `compose.yaml`.
|
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.
|
3. Edit service source files using your preferred IDE or editor.
|
||||||
|
|
||||||
> **Looking for a sample project to test things out?**
|
> **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`.
|
> for a demonstration of Compose `watch`.
|
||||||
{ .tip }
|
{ .tip }
|
||||||
|
|
||||||
|
|
||||||
|
> **Tip**
|
||||||
|
>
|
||||||
|
> Watch can also be used with the dedicated `docker compose watch` command if you don't want to
|
||||||
|
> get the application logs mixed with the (re)build logs and filesystem sync events.
|
||||||
|
{ .tip }
|
||||||
|
|
||||||
|
|
||||||
## Feedback
|
## 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).
|
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).
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue