Add latest techniques

This commit is contained in:
Baohua Yang
2026-02-03 11:09:52 -08:00
parent 99e0eb14ce
commit b4b0d4160a
5 changed files with 86 additions and 7 deletions

View File

@@ -285,6 +285,35 @@ $ docker compose scale web=3 db=2
打印版本信息
### `watch`
格式为 `docker compose watch [options] [SERVICE...]`
启用开发模式自动监视源代码并在文件发生变化时刷新服务这需要项目中有 `compose.yaml` ( `docker-compose.yml`)且定义了 `x-develop` `develop` 配置段
例如
```yaml
services:
web:
build: .
develop:
watch:
- action: sync
path: ./web
target: /src/web
ignore:
- node_modules/
- action: rebuild
path: package.json
```
选项
* `--no-up` 不自动启动服务
* `--quiet` 静默模式
## 参考资料
* [官方文档](https://docs.docker.com/compose/reference/overview/)