mirror of
https://github.com/yeasy/docker_practice.git
synced 2026-08-10 16:37:34 +00:00
fix(content): harden Docker practice guide
This commit is contained in:
@@ -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` 文件中的变量。
|
||||
|
||||
Reference in New Issue
Block a user