Files

43 lines
1.7 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
id: devops.docker.index
title: Docker 与 Compose
type: index
domain: devops
stack: [docker]
tags: [Docker, 容器, Compose, 镜像]
week: [3, 6, 13, 14]
---
# Docker 与 Compose
几乎所有后端和 AI 应用岗位都要求“会用 Docker 部署”。目标是:能写出体积小、可缓存、安全的 Dockerfile;能用 Compose 一条命令拉起“应用 + 数据库 + 缓存”的完整环境;能排查容器启动失败、连不上数据库等常见问题。
## 学习路线
| 顺序 | 课程 | 级别 | 预计 |
| --- | --- | --- | --- |
| 1 | [镜像和 Dockerfile:分层缓存、多阶段构建、非 root、信号处理](01-image-dockerfile.md) | 基础 | 3 小时 |
| 2 | [Compose、网络和数据卷:多服务编排、健康检查、环境变量](02-compose-network-volume.md) | 基础 | 2 小时 |
## 企业场景
- [一条命令拉起开发环境:Go API + Python AI 服务 + PostgreSQL + Redis](scenarios/compose-dev-env.md)
## 面试题
- [Docker 面试题](interview.md)
## 示例代码
- [examples/go-api-compose](examples/go-api-compose/):Go 服务(健康检查、优雅退出)+ 多阶段 Dockerfile + compose.yaml;Go 代码有测试,Dockerfile 需要本机安装 Docker 后自行构建验证
## 在 16 周计划中
- [第 3 周:项目一部署](../../../plan/week03-project1.md)、[第 6 周:RAG 服务容器化](../../../plan/week06-rag-2.md)、[第 13 周:Agent 部署](../../../plan/week13-agent-m4-eval-lowcode.md)、[第 14 周:部署](../../../plan/week14-backend-extend-deploy.md)
## 官方资料
- Docker 文档:https://docs.docker.com/
- Dockerfile 参考:https://docs.docker.com/reference/dockerfile/
- Compose 文件参考:https://docs.docker.com/reference/compose-file/