fix(content): harden Docker practice guide

This commit is contained in:
yeasy
2026-06-16 21:23:21 -07:00
parent f4e684afeb
commit 9fdffa9d91
67 changed files with 343 additions and 278 deletions
+8
View File
@@ -582,6 +582,14 @@ $ docker compose --profile debug up # 启动 web + debug
$ docker compose up # 仅启动 web
```
也可以通过环境变量激活
```bash
$ COMPOSE_PROFILES=debug,test docker compose up
```
如果在命令行里显式指定某个带 profile 的服务Compose 会自动启动这个目标服务及其声明的依赖但不会自动启动同一 profile 下的其它服务除非也显式指定或通过 `--profile` / `COMPOSE_PROFILES` 启用
### 11.5.35 读取变量
Compose 模板文件支持动态读取主机的系统环境变量和当前目录下的 `.env` 文件中的变量