Auto-sync: 2026-04-16 20:05
This commit is contained in:
44
wiki/concepts/Docker-Compose.md
Normal file
44
wiki/concepts/Docker-Compose.md
Normal file
@@ -0,0 +1,44 @@
|
||||
---
|
||||
title: "Docker-Compose"
|
||||
type: concept
|
||||
tags: [docker, container, orchestration]
|
||||
---
|
||||
|
||||
## Definition
|
||||
Docker Compose(Docker Compose V2)是 Docker 官方提供的多容器 Docker 应用定义和运行工具,通过 `docker-compose.yml` 文件声明式配置多容器应用。
|
||||
|
||||
## Core Components
|
||||
- **Services**:定义每个容器配置
|
||||
- **Volumes**:持久化数据卷
|
||||
- **Networks**:容器网络配置
|
||||
- **Profiles**:条件性启动服务
|
||||
|
||||
## Key Features
|
||||
- 单一命令启动整个应用:`docker compose up`
|
||||
- 服务依赖管理
|
||||
- 环境变量配置
|
||||
- 端口映射
|
||||
- 卷挂载
|
||||
|
||||
## Syntax Example
|
||||
```yaml
|
||||
services:
|
||||
web:
|
||||
image: nginx
|
||||
ports:
|
||||
- "80:80"
|
||||
volumes:
|
||||
- ./html:/usr/share/nginx/html
|
||||
```
|
||||
|
||||
## Use Cases
|
||||
- 本地开发环境搭建
|
||||
- 微服务应用部署
|
||||
- CI/CD 测试环境
|
||||
- Home Lab 应用(如 Navidrome、Pi-hole 等)
|
||||
|
||||
---
|
||||
|
||||
## Related
|
||||
- [[Navidrome]] — 使用 Docker-Compose 部署的服务
|
||||
- [[Docker]] — 容器运行时
|
||||
Reference in New Issue
Block a user