diff --git a/01_introduction/1.1_quickstart.md b/01_introduction/1.1_quickstart.md index 1961b4a..18eac7e 100644 --- a/01_introduction/1.1_quickstart.md +++ b/01_introduction/1.1_quickstart.md @@ -1,4 +1,4 @@ -## 快速上手(5分钟) +## 1.1 快速上手 本节将通过一个简单的 Web 应用例子,带你快速体验 Docker 的核心流程:构建镜像、运行容器。 diff --git a/01_introduction/1.2_what.md b/01_introduction/1.2_what.md index c072989..ebf82a7 100644 --- a/01_introduction/1.2_what.md +++ b/01_introduction/1.2_what.md @@ -1,4 +1,4 @@ -## 什么是 Docker +## 1.2 什么是 Docker Docker 是彻底改变了软件开发和交付方式的革命性技术。本节将从核心概念、与传统虚拟机的对比、技术基础以及历史生态等多个维度,带你深入理解什么是 Docker。 @@ -77,7 +77,7 @@ Docker 使用 [Go 语言](https://golang.google.cn/) 开发,基于 Linux 内 - **[Cgroups](https://zh.wikipedia.org/wiki/Cgroups)**:实现资源限制(CPU、内存、I/O 等) - **[Union FS](https://en.wikipedia.org/wiki/Union_mount)**:实现分层存储(如 OverlayFS) -> 如果你对这些底层技术感兴趣,可以阅读本书的[底层实现](../13_implementation/README.md)章节。 +> 如果你对这些底层技术感兴趣,可以阅读本书的[底层实现](../14_implementation/README.md)章节。 #### Docker 架构演进 diff --git a/01_introduction/1.3_why.md b/01_introduction/1.3_why.md index cb7ec7b..914cd80 100644 --- a/01_introduction/1.3_why.md +++ b/01_introduction/1.3_why.md @@ -1,4 +1,4 @@ -## 为什么要使用 Docker? +## 1.3 为什么要使用 Docker? 在回答"为什么用 Docker"之前,笔者想先问一个问题:**你有没有经历过这些场景?** @@ -152,7 +152,7 @@ Docker 完美契合 DevOps 的工作流程: 使用 [Dockerfile](../04_image/4.5_build.md) 定义镜像构建过程,使得: - 构建过程**可重复、可追溯** - 任何人都能从代码重建完全相同的镜像 -- 配合 [GitHub Actions](../14_cases/ci/actions/README.md) 等 CI 系统实现自动化 +- 配合 [GitHub Actions](../15_cases/ci/actions/README.md) 等 CI 系统实现自动化 #### 5. 轻松迁移 diff --git a/02_basic_concept/2.1_image.md b/02_basic_concept/2.1_image.md index a24bfb5..5d805d7 100644 --- a/02_basic_concept/2.1_image.md +++ b/02_basic_concept/2.1_image.md @@ -1,4 +1,4 @@ -## Docker 镜像 +## 2.1 Docker 镜像 ## Docker 镜像 @@ -238,5 +238,5 @@ Docker 镜像可以通过以下方式获取: - [获取镜像](../04_image/4.1_pull.md):从 Registry 下载镜像 - [使用 Dockerfile 定制镜像](../04_image/4.5_build.md):创建自己的镜像 -- [Dockerfile 最佳实践](../15_appendix/15.1_best_practices.md):构建高质量镜像的技巧 -- [底层实现 - 联合文件系统](../13_implementation/13.4_ufs.md):深入理解分层存储的技术原理 +- [Dockerfile 最佳实践](../16_appendix/16.1_best_practices.md):构建高质量镜像的技巧 +- [底层实现 - 联合文件系统](../14_implementation/14.4_ufs.md):深入理解分层存储的技术原理 diff --git a/02_basic_concept/2.2_container.md b/02_basic_concept/2.2_container.md index d53cbbc..3df4169 100644 --- a/02_basic_concept/2.2_container.md +++ b/02_basic_concept/2.2_container.md @@ -1,4 +1,4 @@ -## Docker 容器 +## 2.2 Docker 容器 ## Docker 容器 @@ -137,8 +137,8 @@ $ docker rm abc123 | 方式 | 说明 | 适用场景 | |------|------|---------| -| **[数据卷(Volume)](../07_data_network/data/volume.md)** | Docker 管理的存储 | 数据库、应用数据 | -| **[绑定挂载(Bind Mount)](../07_data_network/data/bind-mounts.md)** | 挂载宿主机目录 | 开发时共享代码 | +| **[数据卷(Volume)](../08_data_network/data/volume.md)** | Docker 管理的存储 | 数据库、应用数据 | +| **[绑定挂载(Bind Mount)](../08_data_network/data/bind-mounts.md)** | 挂载宿主机目录 | 开发时共享代码 | ```bash ## 使用数据卷(推荐) @@ -254,7 +254,7 @@ Docker 容器通过以下 Namespace 实现隔离: | **IPC** | 进程间通信 | 独立的信号量、消息队列 | | **USER** | 用户 | 独立的用户和组 ID | -> 想深入了解?请阅读[底层实现 - 命名空间](../13_implementation/13.2_namespace.md)。 +> 想深入了解?请阅读[底层实现 - 命名空间](../14_implementation/14.2_namespace.md)。 ### 本章小结 @@ -273,4 +273,4 @@ Docker 容器通过以下 Namespace 实现隔离: - [启动容器](../05_container/5.1_run.md):详细的容器启动选项 - [后台运行](../05_container/5.2_daemon.md):理解容器为什么会"立即退出" - [进入容器](../05_container/5.4_attach_exec.md):如何操作运行中的容器 -- [数据管理](../07_data_network/README.md):Volume 和数据持久化详解 +- [数据管理](../08_data_network/README.md):Volume 和数据持久化详解 diff --git a/02_basic_concept/2.3_repository.md b/02_basic_concept/2.3_repository.md index f511549..43383fd 100644 --- a/02_basic_concept/2.3_repository.md +++ b/02_basic_concept/2.3_repository.md @@ -1,4 +1,4 @@ -## Docker Registry +## 2.3 Docker Registry ## Docker Registry diff --git a/03_install/3.10_experimental.md b/03_install/3.10_experimental.md index c8f7bf5..b03eab7 100644 --- a/03_install/3.10_experimental.md +++ b/03_install/3.10_experimental.md @@ -1,4 +1,4 @@ -## 开启实验特性 +## 3.10 开启实验特性 一些 docker 命令或功能仅当 **实验特性** 开启时才能使用,请按照以下方法进行设置。 diff --git a/03_install/3.1_ubuntu.md b/03_install/3.1_ubuntu.md index d1ec12d..3a2399f 100644 --- a/03_install/3.1_ubuntu.md +++ b/03_install/3.1_ubuntu.md @@ -1,4 +1,4 @@ -## Ubuntu 安装 Docker +## 3.1 Ubuntu 安装 Docker ## Ubuntu 安装 Docker diff --git a/03_install/3.2_debian.md b/03_install/3.2_debian.md index b2ebdc4..ab64c0d 100644 --- a/03_install/3.2_debian.md +++ b/03_install/3.2_debian.md @@ -1,4 +1,4 @@ -## Debian 安装 Docker +## 3.2 Debian 安装 Docker ## Debian 安装 Docker diff --git a/03_install/3.3_fedora.md b/03_install/3.3_fedora.md index 38b3720..a7be551 100644 --- a/03_install/3.3_fedora.md +++ b/03_install/3.3_fedora.md @@ -1,4 +1,4 @@ -## Fedora 安装 Docker +## 3.3 Fedora 安装 Docker ## Fedora 安装 Docker diff --git a/03_install/3.4_centos.md b/03_install/3.4_centos.md index caff8ad..98f2116 100644 --- a/03_install/3.4_centos.md +++ b/03_install/3.4_centos.md @@ -1,4 +1,4 @@ -## CentOS 安装 Docker +## 3.4 CentOS 安装 Docker ## CentOS 安装 Docker diff --git a/03_install/3.5_raspberry-pi.md b/03_install/3.5_raspberry-pi.md index ed20285..fb8b289 100644 --- a/03_install/3.5_raspberry-pi.md +++ b/03_install/3.5_raspberry-pi.md @@ -1,4 +1,4 @@ -## 树莓派卡片电脑安装 Docker +## 3.5 树莓派卡片电脑安装 Docker ## 树莓派卡片电脑安装 Docker diff --git a/03_install/3.6_offline.md b/03_install/3.6_offline.md index 329c16b..7ac6687 100644 --- a/03_install/3.6_offline.md +++ b/03_install/3.6_offline.md @@ -1,4 +1,4 @@ -## Linux 离线安装 +## 3.6 Linux 离线安装 \[TOC] diff --git a/03_install/3.7_mac.md b/03_install/3.7_mac.md index 1c9ed93..ecf6e12 100644 --- a/03_install/3.7_mac.md +++ b/03_install/3.7_mac.md @@ -1,4 +1,4 @@ -## macOS +## 3.7 macOS ### 系统要求 diff --git a/03_install/3.8_windows.md b/03_install/3.8_windows.md index a9eb565..dc24480 100644 --- a/03_install/3.8_windows.md +++ b/03_install/3.8_windows.md @@ -1,4 +1,4 @@ -## Windows 10/11 +## 3.8 Windows 10/11 在 Windows 平台上,Docker Desktop 提供了完整的 Docker 开发环境。本节介绍在 Windows 10/11 上的安装和配置。 diff --git a/03_install/3.9_mirror.md b/03_install/3.9_mirror.md index ae337ff..afedc69 100644 --- a/03_install/3.9_mirror.md +++ b/03_install/3.9_mirror.md @@ -1,4 +1,4 @@ -## 镜像加速器 +## 3.9 镜像加速器 国内从 Docker Hub 拉取镜像有时会遇到困难,此时可以配置镜像加速器。 diff --git a/04_image/4.1_pull.md b/04_image/4.1_pull.md index 10d9b62..18f0503 100644 --- a/04_image/4.1_pull.md +++ b/04_image/4.1_pull.md @@ -1,4 +1,4 @@ -## 获取镜像 +## 4.1 获取镜像 ## 获取镜像 diff --git a/04_image/4.2_list.md b/04_image/4.2_list.md index cb47e32..040b7b7 100644 --- a/04_image/4.2_list.md +++ b/04_image/4.2_list.md @@ -1,4 +1,4 @@ -## 列出镜像 +## 4.2 列出镜像 ## 列出镜像 diff --git a/04_image/4.3_rm.md b/04_image/4.3_rm.md index 25d3ba5..82a5b7e 100644 --- a/04_image/4.3_rm.md +++ b/04_image/4.3_rm.md @@ -1,4 +1,4 @@ -## 删除本地镜像 +## 4.3 删除本地镜像 当不再需要某个镜像时,我们可以将其删除以释放存储空间。本节介绍删除镜像的常用方法。 @@ -307,4 +307,4 @@ Build Cache 0 0 0B 0B - [列出镜像](4.2_list.md):查看和过滤镜像 - [删除容器](../05_container/4.3_rm.md):清理容器 -- [数据卷](../07_data_network/data/volume.md):清理数据卷 +- [数据卷](../08_data_network/data/volume.md):清理数据卷 diff --git a/04_image/4.4_commit.md b/04_image/4.4_commit.md index 2f2b42c..6cb2e37 100644 --- a/04_image/4.4_commit.md +++ b/04_image/4.4_commit.md @@ -1,4 +1,4 @@ -## 利用 commit 理解镜像构成 +## 4.4 利用 commit 理解镜像构成 > 注意:如果您是初学者,您可以暂时跳过后面的内容,直接学习 [容器](../05_container/) 一节。 diff --git a/04_image/4.5_build.md b/04_image/4.5_build.md index 1fcaffe..1262c33 100644 --- a/04_image/4.5_build.md +++ b/04_image/4.5_build.md @@ -1,4 +1,4 @@ -## 使用 Dockerfile 定制镜像 +## 4.5 使用 Dockerfile 定制镜像 从刚才的 `docker commit` 的学习中,我们可以了解到,镜像的定制实际上就是定制每一层所添加的配置、文件。如果我们可以把每一层修改、安装、构建、操作的命令都写入一个脚本,用这个脚本来构建、定制镜像,那么之前提及的无法重复的问题、镜像构建透明性的问题、体积的问题就都会解决。这个脚本就是 Dockerfile。 diff --git a/04_image/4.6_other.md b/04_image/4.6_other.md index e304188..360f1e0 100644 --- a/04_image/4.6_other.md +++ b/04_image/4.6_other.md @@ -1,4 +1,4 @@ -## 其它制作镜像的方式 +## 4.6 其它制作镜像的方式 除了标准的使用 `Dockerfile` 生成镜像的方法外,由于各种特殊需求和历史原因,还提供了一些其它方法用以生成镜像。 diff --git a/04_image/4.7_internal.md b/04_image/4.7_internal.md index 4420d7f..0a8633c 100644 --- a/04_image/4.7_internal.md +++ b/04_image/4.7_internal.md @@ -1,4 +1,4 @@ -## 镜像的实现原理 +## 4.7 镜像的实现原理 Docker 镜像是怎么实现增量的修改和维护的? diff --git a/04_image/dockerfile/README.md b/04_image/dockerfile/README.md deleted file mode 100644 index 15f5d4f..0000000 --- a/04_image/dockerfile/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Dockerfile 指令详解 - -我们已经介绍了 `FROM`,`RUN`,还提及了 `COPY`, `ADD`,其实 `Dockerfile` 功能很强大,它提供了十多个指令。下面我们继续讲解其他的指令。 diff --git a/05_container/5.1_run.md b/05_container/5.1_run.md index 88a0aaa..738d758 100644 --- a/05_container/5.1_run.md +++ b/05_container/5.1_run.md @@ -1,4 +1,4 @@ -## 启动容器 +## 5.1 启动容器 本节将详细介绍 Docker 容器的启动方式,包括新建启动和重新启动已停止的容器。 @@ -240,7 +240,7 @@ $ docker run -d -p 80:80 nginx $ docker run -v mydata:/app/data myapp ``` -详见[数据管理](../07_data_network/README.md)。 +详见[数据管理](../08_data_network/README.md)。 ### 本章小结 @@ -256,4 +256,4 @@ $ docker run -v mydata:/app/data myapp - [后台运行](5.2_daemon.md):理解 `-d` 参数和容器生命周期 - [进入容器](5.4_attach_exec.md):操作运行中的容器 - [网络配置](../network/README.md):理解端口映射的原理 -- [数据管理](../07_data_network/README.md):数据持久化方案 +- [数据管理](../08_data_network/README.md):数据持久化方案 diff --git a/05_container/5.2_daemon.md b/05_container/5.2_daemon.md index 80c0083..4d68ada 100644 --- a/05_container/5.2_daemon.md +++ b/05_container/5.2_daemon.md @@ -1,4 +1,4 @@ -## 后台运行 +## 5.2 后台运行 在生产环境中,我们通常需要容器持续运行,不受终端关闭的影响。本节将深入讲解如何让容器在后台运行,以及理解容器生命周期的核心概念。 @@ -240,6 +240,6 @@ $ docker attach mycontainer ### 延伸阅读 - [进入容器](5.4_attach_exec.md):如何进入正在运行的容器执行命令 -- [容器日志](../15_appendix/15.1_best_practices.md):生产环境的日志管理最佳实践 -- [HEALTHCHECK 健康检查](../04_image/dockerfile/healthcheck.md):自动检测容器内服务是否正常 +- [容器日志](../16_appendix/16.1_best_practices.md):生产环境的日志管理最佳实践 +- [HEALTHCHECK 健康检查](../07_dockerfile/7.12_healthcheck.md):自动检测容器内服务是否正常 - [Docker Compose](../compose/README.md):管理多个后台容器的更好方式 diff --git a/05_container/5.3_stop.md b/05_container/5.3_stop.md index 4e2b323..81abd98 100644 --- a/05_container/5.3_stop.md +++ b/05_container/5.3_stop.md @@ -1,4 +1,4 @@ -## 终止容器 +## 5.3 终止容器 本节将介绍如何终止一个运行中的容器,以及几种不同的终止方式及其区别。 diff --git a/05_container/5.4_attach_exec.md b/05_container/5.4_attach_exec.md index 460c946..cd99934 100644 --- a/05_container/5.4_attach_exec.md +++ b/05_container/5.4_attach_exec.md @@ -1,4 +1,4 @@ -## 进入容器 +## 5.4 进入容器 ### 为什么需要进入容器 diff --git a/05_container/5.5_import_export.md b/05_container/5.5_import_export.md index 1cc12e8..1f30bc5 100644 --- a/05_container/5.5_import_export.md +++ b/05_container/5.5_import_export.md @@ -1,4 +1,4 @@ -## 导出和导入容器 +## 5.5 导出和导入容器 当我们需要迁移容器或者备份容器时,可以使用 Docker 的导入和导出功能。本节将介绍这两个命令的使用方法。 diff --git a/05_container/5.6_rm.md b/05_container/5.6_rm.md index e9665de..f727271 100644 --- a/05_container/5.6_rm.md +++ b/05_container/5.6_rm.md @@ -1,4 +1,4 @@ -## 删除容器 +## 5.6 删除容器 随着容器的创建和停止,系统中会积累大量的容器。本节将介绍如何删除不再需要的容器,以及如何清理所有停止的容器。 @@ -280,4 +280,4 @@ $ docker system prune -a --volumes - [终止容器](5.3_stop.md):优雅停止容器 - [删除镜像](../04_image/4.3_rm.md):清理镜像 -- [数据卷](../07_data_network/data/volume.md):数据卷管理 +- [数据卷](../08_data_network/data/volume.md):数据卷管理 diff --git a/06_repository/6.1_dockerhub.md b/06_repository/6.1_dockerhub.md index 702f5bd..9d8f1f8 100644 --- a/06_repository/6.1_dockerhub.md +++ b/06_repository/6.1_dockerhub.md @@ -1,4 +1,4 @@ -## Docker Hub +## 6.1 Docker Hub ### 什么是 Docker Hub diff --git a/06_repository/6.2_registry.md b/06_repository/6.2_registry.md index 1ccef47..92980ef 100644 --- a/06_repository/6.2_registry.md +++ b/06_repository/6.2_registry.md @@ -1,4 +1,4 @@ -## 私有仓库 +## 6.2 私有仓库 有时候使用 Docker Hub 这样的公共仓库可能不方便,用户可以创建一个本地仓库供私人使用。 diff --git a/06_repository/6.3_registry_auth.md b/06_repository/6.3_registry_auth.md index 08d4f1c..47db86b 100644 --- a/06_repository/6.3_registry_auth.md +++ b/06_repository/6.3_registry_auth.md @@ -1,4 +1,4 @@ -## 私有仓库高级配置 +## 6.3 私有仓库高级配置 上一节我们搭建了一个具有基础功能的私有仓库,本小节我们来使用 `Docker Compose` 搭建一个拥有权限认证、TLS 的私有仓库。 diff --git a/06_repository/6.4_nexus3_registry.md b/06_repository/6.4_nexus3_registry.md index f254a76..385a42c 100644 --- a/06_repository/6.4_nexus3_registry.md +++ b/06_repository/6.4_nexus3_registry.md @@ -1,4 +1,4 @@ -## Nexus 3 +## 6.4 Nexus 3 使用 Docker 官方的 Registry 创建的仓库面临一些维护问题。比如某些镜像删除以后空间默认是不会回收的,需要一些命令去回收空间然后重启 Registry。在企业中把内部的一些工具包放入 `Nexus` 中是比较常见的做法,最新版本 `Nexus3.x` 全面支持 Docker 的私有镜像。所以使用 [`Nexus3.x`](https://www.sonatype.com/product/repository-oss-download) 一个软件来管理 `Docker` , `Maven` , `Yum` , `PyPI` 等是一个明智的选择。 diff --git a/04_image/dockerfile/workdir.md b/07_dockerfile/7.10_workdir.md similarity index 97% rename from 04_image/dockerfile/workdir.md rename to 07_dockerfile/7.10_workdir.md index d46ca03..616bd6a 100644 --- a/04_image/dockerfile/workdir.md +++ b/07_dockerfile/7.10_workdir.md @@ -1,4 +1,4 @@ -## WORKDIR 指定工作目录 +## 7.10 WORKDIR 指定工作目录 ### 基本语法 @@ -226,4 +226,4 @@ $ docker run -w /tmp myimage pwd - [COPY 复制文件](copy.md):文件复制 - [RUN 执行命令](../../04_image/4.5_build.md):执行构建命令 -- [最佳实践](../../15_appendix/15.1_best_practices.md):Dockerfile 编写指南 +- [最佳实践](../../16_appendix/16.1_best_practices.md):Dockerfile 编写指南 diff --git a/04_image/dockerfile/user.md b/07_dockerfile/7.11_user.md similarity index 98% rename from 04_image/dockerfile/user.md rename to 07_dockerfile/7.11_user.md index 99aa978..72e09f1 100644 --- a/04_image/dockerfile/user.md +++ b/07_dockerfile/7.11_user.md @@ -1,4 +1,4 @@ -## USER 指定当前用户 +## 7.11 USER 指定当前用户 ### 基本语法 @@ -304,4 +304,4 @@ RUN mkdir -p /app/data && chown appuser:appuser /app/data - [安全](../../security/README.md):容器安全实践 - [ENTRYPOINT](entrypoint.md):入口脚本中的用户切换 -- [最佳实践](../../15_appendix/15.1_best_practices.md):Dockerfile 安全 +- [最佳实践](../../16_appendix/16.1_best_practices.md):Dockerfile 安全 diff --git a/04_image/dockerfile/healthcheck.md b/07_dockerfile/7.12_healthcheck.md similarity index 96% rename from 04_image/dockerfile/healthcheck.md rename to 07_dockerfile/7.12_healthcheck.md index e5e79cc..54d2330 100644 --- a/04_image/dockerfile/healthcheck.md +++ b/07_dockerfile/7.12_healthcheck.md @@ -1,4 +1,4 @@ -## HEALTHCHECK 健康检查 +## 7.12 HEALTHCHECK 健康检查 ### 基本语法 @@ -219,5 +219,5 @@ HEALTHCHECK --start-period=60s CMD curl -f http://localhost/ || exit 1 ### 延伸阅读 - [CMD 容器启动命令](cmd.md):启动主进程 -- [Compose 模板文件](../../compose/9.5_compose_file.md):Compose 中的健康检查 -- [Docker 调试](../../15_appendix/15.2_debug.md):容器排障 +- [Compose 模板文件](../../compose/10.5_compose_file.md):Compose 中的健康检查 +- [Docker 调试](../../16_appendix/16.2_debug.md):容器排障 diff --git a/04_image/dockerfile/onbuild.md b/07_dockerfile/7.13_onbuild.md similarity index 97% rename from 04_image/dockerfile/onbuild.md rename to 07_dockerfile/7.13_onbuild.md index 2aca9a3..d74b633 100644 --- a/04_image/dockerfile/onbuild.md +++ b/07_dockerfile/7.13_onbuild.md @@ -1,4 +1,4 @@ -## ONBUILD 为他人做嫁衣裳 +## 7.13 ONBUILD 为他人做嫁衣裳 ### 基本语法 @@ -166,4 +166,4 @@ python:3.12-onbuild ### 延伸阅读 - [COPY 指令](copy.md):文件复制 -- [Dockerfile 最佳实践](../../15_appendix/15.1_best_practices.md):基础镜像设计 +- [Dockerfile 最佳实践](../../16_appendix/16.1_best_practices.md):基础镜像设计 diff --git a/04_image/dockerfile/label.md b/07_dockerfile/7.14_label.md similarity index 97% rename from 04_image/dockerfile/label.md rename to 07_dockerfile/7.14_label.md index affb587..4431ced 100644 --- a/04_image/dockerfile/label.md +++ b/07_dockerfile/7.14_label.md @@ -1,4 +1,4 @@ -## LABEL 为镜像添加元数据 +## 7.14 LABEL 为镜像添加元数据 ### 基本语法 @@ -164,4 +164,4 @@ $ docker rmi $(docker images -q --filter "label=stage=builder") ### 延伸阅读 - [OCI 标签规范](https://github.com/opencontainers/image-spec/blob/main/annotations.md) -- [Dockerfile 最佳实践](../../15_appendix/15.1_best_practices.md) +- [Dockerfile 最佳实践](../../16_appendix/16.1_best_practices.md) diff --git a/04_image/dockerfile/shell.md b/07_dockerfile/7.15_shell.md similarity index 97% rename from 04_image/dockerfile/shell.md rename to 07_dockerfile/7.15_shell.md index bfce1f4..fb4e92d 100644 --- a/04_image/dockerfile/shell.md +++ b/07_dockerfile/7.15_shell.md @@ -1,4 +1,4 @@ -## SHELL 指令 +## 7.15 SHELL 指令 ### 基本语法 @@ -151,4 +151,4 @@ SHELL ["/bin/bash", "-o", "pipefail", "-c"] ### 延伸阅读 - [RUN 指令](../../04_image/4.5_build.md):执行命令 -- [Dockerfile 最佳实践](../../15_appendix/15.1_best_practices.md):错误处理与调试 +- [Dockerfile 最佳实践](../../16_appendix/16.1_best_practices.md):错误处理与调试 diff --git a/04_image/dockerfile/references.md b/07_dockerfile/7.16_references.md similarity index 92% rename from 04_image/dockerfile/references.md rename to 07_dockerfile/7.16_references.md index 5d5974d..a1dfa75 100644 --- a/04_image/dockerfile/references.md +++ b/07_dockerfile/7.16_references.md @@ -1,4 +1,4 @@ -## 参考文档 +## 7.16 参考文档 * `Dockerfile` 官方文档:https://docs.docker.com/engine/reference/builder/ diff --git a/04_image/dockerfile/run.md b/07_dockerfile/7.1_run.md similarity index 97% rename from 04_image/dockerfile/run.md rename to 07_dockerfile/7.1_run.md index 4ed5d96..56b3721 100644 --- a/04_image/dockerfile/run.md +++ b/07_dockerfile/7.1_run.md @@ -1,4 +1,4 @@ -## RUN 执行命令 +## 7.1 RUN 执行命令 ### 基本语法 @@ -191,4 +191,4 @@ RUN --mount=type=secret,id=mysecret \ - [CMD 容器启动命令](cmd.md):容器启动时的命令 - [WORKDIR 指定工作目录](workdir.md):改变目录 -- [Dockerfile 最佳实践](../../15_appendix/15.1_best_practices.md) +- [Dockerfile 最佳实践](../../16_appendix/16.1_best_practices.md) diff --git a/04_image/dockerfile/copy.md b/07_dockerfile/7.2_copy.md similarity index 98% rename from 04_image/dockerfile/copy.md rename to 07_dockerfile/7.2_copy.md index 8b4a631..0121283 100644 --- a/04_image/dockerfile/copy.md +++ b/07_dockerfile/7.2_copy.md @@ -1,4 +1,4 @@ -## COPY 复制文件 +## 7.2 COPY 复制文件 ### 基本语法 @@ -304,4 +304,4 @@ COPY . . - [ADD 指令](add.md):复制和解压 - [WORKDIR 指令](workdir.md):设置工作目录 - [多阶段构建](../multistage-builds.md):优化镜像大小 -- [最佳实践](../../15_appendix/15.1_best_practices.md):Dockerfile 编写指南 +- [最佳实践](../../16_appendix/16.1_best_practices.md):Dockerfile 编写指南 diff --git a/04_image/dockerfile/add.md b/07_dockerfile/7.3_add.md similarity index 97% rename from 04_image/dockerfile/add.md rename to 07_dockerfile/7.3_add.md index 5a25cb0..23ca6b4 100644 --- a/04_image/dockerfile/add.md +++ b/07_dockerfile/7.3_add.md @@ -1,4 +1,4 @@ -## ADD 更高级的复制文件 +## 7.3 ADD 更高级的复制文件 ### 基本语法 @@ -259,4 +259,4 @@ RUN tar -xzf /tmp/app.tar.gz -C /app && \ - [COPY 复制文件](copy.md):基本复制操作 - [多阶段构建](../multistage-builds.md):减少镜像体积 -- [最佳实践](../../15_appendix/15.1_best_practices.md):Dockerfile 编写指南 +- [最佳实践](../../16_appendix/16.1_best_practices.md):Dockerfile 编写指南 diff --git a/04_image/dockerfile/cmd.md b/07_dockerfile/7.4_cmd.md similarity index 98% rename from 04_image/dockerfile/cmd.md rename to 07_dockerfile/7.4_cmd.md index 34e1f70..7bddfa2 100644 --- a/04_image/dockerfile/cmd.md +++ b/07_dockerfile/7.4_cmd.md @@ -1,4 +1,4 @@ -## CMD 容器启动命令 +## 7.4 CMD 容器启动命令 ### 什么是 CMD @@ -316,4 +316,4 @@ CMD ["python", "app.py"] - [ENTRYPOINT 入口点](entrypoint.md):固定的启动命令 - [后台运行](../../05_container/5.2_daemon.md):容器前台/后台概念 -- [最佳实践](../../15_appendix/15.1_best_practices.md):Dockerfile 编写指南 +- [最佳实践](../../16_appendix/16.1_best_practices.md):Dockerfile 编写指南 diff --git a/04_image/dockerfile/entrypoint.md b/07_dockerfile/7.5_entrypoint.md similarity index 98% rename from 04_image/dockerfile/entrypoint.md rename to 07_dockerfile/7.5_entrypoint.md index ed34816..2f1a64f 100644 --- a/04_image/dockerfile/entrypoint.md +++ b/07_dockerfile/7.5_entrypoint.md @@ -1,4 +1,4 @@ -## ENTRYPOINT 入口点 +## 7.5 ENTRYPOINT 入口点 ### 什么是 ENTRYPOINT @@ -347,5 +347,5 @@ wait $PID ### 延伸阅读 - [CMD 容器启动命令](cmd.md):默认命令 -- [最佳实践](../../15_appendix/15.1_best_practices.md):启动命令设计 +- [最佳实践](../../16_appendix/16.1_best_practices.md):启动命令设计 - [后台运行](../../05_container/5.2_daemon.md):前台/后台概念 diff --git a/04_image/dockerfile/env.md b/07_dockerfile/7.6_env.md similarity index 96% rename from 04_image/dockerfile/env.md rename to 07_dockerfile/7.6_env.md index 8050b4a..9a6a425 100644 --- a/04_image/dockerfile/env.md +++ b/07_dockerfile/7.6_env.md @@ -1,4 +1,4 @@ -## ENV 设置环境变量 +## 7.6 ENV 设置环境变量 ### 基本语法 @@ -296,5 +296,5 @@ ENV VAR3=value3 ### 延伸阅读 - [ARG 构建参数](arg.md):构建时变量 -- [Compose 环境变量](../../compose/9.5_compose_file.md):Compose 中的环境变量 -- [最佳实践](../../15_appendix/15.1_best_practices.md):Dockerfile 编写指南 +- [Compose 环境变量](../../compose/10.5_compose_file.md):Compose 中的环境变量 +- [最佳实践](../../16_appendix/16.1_best_practices.md):Dockerfile 编写指南 diff --git a/04_image/dockerfile/arg.md b/07_dockerfile/7.7_arg.md similarity index 99% rename from 04_image/dockerfile/arg.md rename to 07_dockerfile/7.7_arg.md index 5bc4cd8..7585485 100644 --- a/04_image/dockerfile/arg.md +++ b/07_dockerfile/7.7_arg.md @@ -1,4 +1,4 @@ -## ARG 构建参数 +## 7.7 ARG 构建参数 ### 基本语法 diff --git a/04_image/dockerfile/volume.md b/07_dockerfile/7.8_volume.md similarity index 95% rename from 04_image/dockerfile/volume.md rename to 07_dockerfile/7.8_volume.md index deb6fd6..ac8620c 100644 --- a/04_image/dockerfile/volume.md +++ b/07_dockerfile/7.8_volume.md @@ -1,4 +1,4 @@ -## VOLUME 定义匿名卷 +## 7.8 VOLUME 定义匿名卷 ### 基本语法 @@ -288,6 +288,6 @@ VOLUME /var/lib/mysql ### 延伸阅读 -- [数据卷](../../07_data_network/data/volume.md):卷的管理和使用 -- [挂载主机目录](../../07_data_network/data/bind-mounts.md):Bind Mount -- [Compose 数据管理](../../compose/9.5_compose_file.md):Compose 中的卷配置 +- [数据卷](../../08_data_network/data/volume.md):卷的管理和使用 +- [挂载主机目录](../../08_data_network/data/bind-mounts.md):Bind Mount +- [Compose 数据管理](../../compose/10.5_compose_file.md):Compose 中的卷配置 diff --git a/04_image/dockerfile/expose.md b/07_dockerfile/7.9_expose.md similarity index 97% rename from 04_image/dockerfile/expose.md rename to 07_dockerfile/7.9_expose.md index 2f595e8..3054026 100644 --- a/04_image/dockerfile/expose.md +++ b/07_dockerfile/7.9_expose.md @@ -1,4 +1,4 @@ -## EXPOSE 声明端口 +## 7.9 EXPOSE 声明端口 ### 基本语法 @@ -258,4 +258,4 @@ services: - [网络配置](../../network/README.md):Docker 网络详解 - [端口映射](../../network/port_bindingbindingbinding.md):-p 参数详解 -- [Compose 端口](../../compose/9.5_compose_file.md):Compose 中的端口配置 +- [Compose 端口](../../compose/10.5_compose_file.md):Compose 中的端口配置 diff --git a/07_dockerfile/README.md b/07_dockerfile/README.md new file mode 100644 index 0000000..6827177 --- /dev/null +++ b/07_dockerfile/README.md @@ -0,0 +1,58 @@ +# 第七章 Dockerfile 指令详解 + +## 什么是 Dockerfile + +Dockerfile 是一个文本文件,其內包含了一条条的 **指令(Instruction)**,每一条指令构建一层,therefore 每一条指令的内容,就是描述该层应当如何构建。 + +在 [第四章](04_image/README.md) 中,我们通过 `docker commit` 学习了镜像的构成。但是,手动 `commit` 只能作为临时修补,并不适合作为生产环境镜像的构建方式。 + +使用 Dockerfile 构建镜像有以下优势: + +* **自动化**:可以通过 `docker build` 命令自动构建镜像。 +* **可重复性**:由于 Dockerfile 是文本文件,可以确保每次构建的结果一致。 +* **版本控制**:Dockerfile 可以纳入版本控制系统(如 Git),便于追踪变更。 +* **透明性**:任何人都可以通过阅读 Dockerfile 了解镜像的构建过程。 + +## Dockerfile 基本结构 + +Dockerfile 一般分为四部分:基础镜像信息、维护者信息、镜像操作指令和容器启动时执行指令。 + +### 指令详解 + +本章将详细讲解 Dockerfile 中的各个指令: + +* [COPY 复制文件](7.2_copy.md) +* [ADD 更高级的复制文件](7.3_add.md) +* [CMD 容器启动命令](7.4_cmd.md) +* [ENTRYPOINT 入口点](7.5_entrypoint.md) +* [ENV 设置环境变量](7.6_env.md) +* [ARG 构建参数](7.7_arg.md) +* [VOLUME 定义匿名卷](7.8_volume.md) +* [EXPOSE 暴露端口](7.9_expose.md) +* [WORKDIR 指定工作目录](7.10_workdir.md) +* [USER 指定当前用户](7.11_user.md) +* [HEALTHCHECK 健康检查](7.12_healthcheck.md) +* [ONBUILD 为他人作嫁衣裳](7.13_onbuild.md) +* [LABEL 为镜像添加元数据](7.14_label.md) +* [SHELL 指令](7.15_shell.md) +* [RUN 执行命令](5.1_run.md) + +此外,我们还将介绍 Dockerfile 的最佳实践和常见问题。 + +* [参考文档](7.16_references.md) + +## 使用 Dockerfile 构建镜像 + +构建镜像的基本命令格式为: + +```bash +docker build [选项] <上下文路径/URL/-> +``` + +例如,在 Dockerfile 所在目录执行: + +```bash +docker build -t my-image:v1 . +``` + +更多关于 `docker build` 的用法,我们在实战中会结合具体指令进行演示。 diff --git a/07_data_network/README.md b/08_data_network/README.md similarity index 79% rename from 07_data_network/README.md rename to 08_data_network/README.md index bf4960f..11686c1 100644 --- a/07_data_network/README.md +++ b/08_data_network/README.md @@ -1,4 +1,4 @@ -# 第七章 数据与网络管理 +# 第八章 数据与网络管理 本章将介绍 Docker 中的数据管理与网络配置。 diff --git a/07_data_network/data/README.md b/08_data_network/data/README.md similarity index 100% rename from 07_data_network/data/README.md rename to 08_data_network/data/README.md diff --git a/07_data_network/data/_images/types-of-mounts.png b/08_data_network/data/_images/types-of-mounts.png similarity index 100% rename from 07_data_network/data/_images/types-of-mounts.png rename to 08_data_network/data/_images/types-of-mounts.png diff --git a/07_data_network/data/bind-mounts.md b/08_data_network/data/bind-mounts.md similarity index 98% rename from 07_data_network/data/bind-mounts.md rename to 08_data_network/data/bind-mounts.md index 616e83f..c775586 100644 --- a/07_data_network/data/bind-mounts.md +++ b/08_data_network/data/bind-mounts.md @@ -329,4 +329,4 @@ $ docker run -v /app/data:/data ... - [数据卷](volume.md):Docker 管理的持久化存储 - [tmpfs 挂载](tmpfs.md):内存临时存储 -- [Compose 数据管理](../compose/9.5_compose_file.md):Compose 中的挂载配置 +- [Compose 数据管理](../compose/10.5_compose_file.md):Compose 中的挂载配置 diff --git a/07_data_network/data/volume.md b/08_data_network/data/volume.md similarity index 99% rename from 07_data_network/data/volume.md rename to 08_data_network/data/volume.md index 69caf7c..ba3b31a 100644 --- a/07_data_network/data/volume.md +++ b/08_data_network/data/volume.md @@ -417,4 +417,4 @@ $ docker volume inspect my-vol - [绑定挂载](bind-mounts.md):挂载宿主机目录 - [tmpfs 挂载](tmpfs.md):内存中的临时存储 -- [存储驱动](../13_implementation/13.4_ufs.md):Docker 存储的底层原理 +- [存储驱动](../14_implementation/14.4_ufs.md):Docker 存储的底层原理 diff --git a/07_data_network/network/README.md b/08_data_network/network/README.md similarity index 99% rename from 07_data_network/network/README.md rename to 08_data_network/network/README.md index 8fd99a8..9cce98e 100644 --- a/07_data_network/network/README.md +++ b/08_data_network/network/README.md @@ -330,4 +330,4 @@ $ docker network prune - [高级网络配置](linking.md):容器互联详解 - [配置 DNS](dns.md):自定义 DNS 设置 - [端口映射](port_mapping.md):高级端口配置 -- [Compose 网络](../compose/9.5_compose_file.md):Compose 中的网络配置 +- [Compose 网络](../compose/10.5_compose_file.md):Compose 中的网络配置 diff --git a/07_data_network/network/dns.md b/08_data_network/network/dns.md similarity index 100% rename from 07_data_network/network/dns.md rename to 08_data_network/network/dns.md diff --git a/07_data_network/network/port_mapping.md b/08_data_network/network/port_mapping.md similarity index 98% rename from 07_data_network/network/port_mapping.md rename to 08_data_network/network/port_mapping.md index 1aa85c9..6eae7d0 100644 --- a/07_data_network/network/port_mapping.md +++ b/08_data_network/network/port_mapping.md @@ -164,5 +164,5 @@ iptables -t nat -A DOCKER -p tcp --dport 8080 -j DNAT --to-destination 172.17.0. ### 延伸阅读 -- [EXPOSE 指令](../04_image/dockerfile/expose.md):在 Dockerfile 中声明端口 +- [EXPOSE 指令](../07_dockerfile/7.9_expose.md):在 Dockerfile 中声明端口 - [网络模式](README.md):Host 模式不需要端口映射 diff --git a/08_buildx/8.1_buildkit.md b/09_buildx/9.1_buildkit.md similarity index 99% rename from 08_buildx/8.1_buildkit.md rename to 09_buildx/9.1_buildkit.md index aaad475..1d5cccd 100644 --- a/08_buildx/8.1_buildkit.md +++ b/09_buildx/9.1_buildkit.md @@ -1,4 +1,4 @@ -## 使用 `BuildKit` 构建镜像 +## 9.1 使用 `BuildKit` 构建镜像 **BuildKit** 是下一代的镜像构建组件,在 https://github.com/moby/buildkit 开源。 diff --git a/08_buildx/8.2_buildx.md b/09_buildx/9.2_buildx.md similarity index 85% rename from 08_buildx/8.2_buildx.md rename to 09_buildx/9.2_buildx.md index 31da56e..61f44e2 100644 --- a/08_buildx/8.2_buildx.md +++ b/09_buildx/9.2_buildx.md @@ -1,4 +1,4 @@ -## 使用 Buildx 构建镜像 +## 9.2 使用 Buildx 构建镜像 ### 使用 @@ -12,7 +12,7 @@ $ docker buildx build . => ... ``` -Buildx 使用 [BuildKit 引擎](8.1_buildkit.md) 进行构建,支持许多新的功能,具体参考 [Buildkit](8.1_buildkit.md) 一节。 +Buildx 使用 [BuildKit 引擎](9.1_buildkit.md) 进行构建,支持许多新的功能,具体参考 [Buildkit](9.1_buildkit.md) 一节。 #### 使用 `bake` diff --git a/08_buildx/8.3_multi-arch-images.md b/09_buildx/9.3_multi-arch-images.md similarity index 98% rename from 08_buildx/8.3_multi-arch-images.md rename to 09_buildx/9.3_multi-arch-images.md index be31708..8789138 100644 --- a/08_buildx/8.3_multi-arch-images.md +++ b/09_buildx/9.3_multi-arch-images.md @@ -1,4 +1,4 @@ -## 构建多种系统架构支持的 Docker 镜像 +## 9.3 构建多种系统架构支持的 Docker 镜像 Docker 镜像可以支持多种系统架构,这意味着你可以在 `x86_64`、`arm64` 等不同架构的机器上运行同一个镜像。这是通过一个名为 "manifest list"(或称为 "fat manifest")的文件来实现的。 diff --git a/08_buildx/README.md b/09_buildx/README.md similarity index 53% rename from 08_buildx/README.md rename to 09_buildx/README.md index 70fda46..92aa0ed 100644 --- a/08_buildx/README.md +++ b/09_buildx/README.md @@ -1,6 +1,6 @@ -# 第八章 Docker Buildx +# 第九章 Docker Buildx -Docker Buildx 是一个 docker CLI 插件,其扩展了 docker 命令,支持 [Moby BuildKit](8.1_buildkit.md) 提供的功能。提供了与 docker build 相同的用户体验,并增加了许多新功能。 +Docker Buildx 是一个 docker CLI 插件,其扩展了 docker 命令,支持 [Moby BuildKit](9.1_buildkit.md) 提供的功能。提供了与 docker build 相同的用户体验,并增加了许多新功能。 > 该功能仅适用于 Docker v19.03+ 版本 @@ -8,6 +8,6 @@ Docker Buildx 是一个 docker CLI 插件,其扩展了 docker 命令,支持 本章将详细介绍 Docker Buildx 的使用,包括: -* [使用 BuildKit 构建镜像](8.1_buildkit.md) -* [使用 Buildx 构建镜像](8.2_buildx.md) -* [构建多种系统架构支持的 Docker 镜像](8.3_multi-arch-images.md) +* [使用 BuildKit 构建镜像](9.1_buildkit.md) +* [使用 Buildx 构建镜像](9.2_buildx.md) +* [构建多种系统架构支持的 Docker 镜像](9.3_multi-arch-images.md) diff --git a/09_compose/9.1_introduction.md b/10_compose/10.1_introduction.md similarity index 99% rename from 09_compose/9.1_introduction.md rename to 10_compose/10.1_introduction.md index b13dd86..cc26b9b 100644 --- a/09_compose/9.1_introduction.md +++ b/10_compose/10.1_introduction.md @@ -1,4 +1,4 @@ -## Compose 简介 +## 10.1 Compose 简介 `Compose` 项目是 Docker 官方的开源项目,负责实现对 Docker 容器集群的快速编排。从功能上看,跟 `OpenStack` 中的 `Heat` 十分类似。 diff --git a/09_compose/9.2_install.md b/10_compose/10.2_install.md similarity index 98% rename from 09_compose/9.2_install.md rename to 10_compose/10.2_install.md index 51e82a6..a7f455d 100644 --- a/09_compose/9.2_install.md +++ b/10_compose/10.2_install.md @@ -1,4 +1,4 @@ -## 安装与卸载 +## 10.2 安装与卸载 `Compose` 是 Docker 官方的开源项目,负责实现对 Docker 容器集群的快速编排。 diff --git a/09_compose/9.3_usage.md b/10_compose/10.3_usage.md similarity index 99% rename from 09_compose/9.3_usage.md rename to 10_compose/10.3_usage.md index f54d765..0284056 100644 --- a/09_compose/9.3_usage.md +++ b/10_compose/10.3_usage.md @@ -1,4 +1,4 @@ -## 使用 +## 10.3 使用 本节将通过一个具体的 Web 应用案例,介绍 Docker Compose 的基本概念和使用方法。 diff --git a/09_compose/9.4_commands.md b/10_compose/10.4_commands.md similarity index 99% rename from 09_compose/9.4_commands.md rename to 10_compose/10.4_commands.md index ac07f18..f0ad198 100644 --- a/09_compose/9.4_commands.md +++ b/10_compose/10.4_commands.md @@ -1,4 +1,4 @@ -## Compose 命令说明 +## 10.4 Compose 命令说明 Docker Compose 提供了丰富的命令来管理项目和容器。本节将详细介绍这些命令的使用格式和常用选项。 diff --git a/09_compose/9.5_compose_file.md b/10_compose/10.5_compose_file.md similarity index 99% rename from 09_compose/9.5_compose_file.md rename to 10_compose/10.5_compose_file.md index 57a37cc..9ccd39c 100644 --- a/09_compose/9.5_compose_file.md +++ b/10_compose/10.5_compose_file.md @@ -1,4 +1,4 @@ -## Compose 模板文件 +## 10.5 Compose 模板文件 模板文件是使用 `Compose` 的核心,涉及到的指令关键字也比较多。但大家不用担心,这里面大部分指令跟 `docker run` 相关参数的含义都是类似的。 diff --git a/09_compose/9.6_django.md b/10_compose/10.6_django.md similarity index 97% rename from 09_compose/9.6_django.md rename to 10_compose/10.6_django.md index 3859ea3..1042bb1 100644 --- a/09_compose/9.6_django.md +++ b/10_compose/10.6_django.md @@ -1,4 +1,4 @@ -## 使用 Django +## 10.6 使用 Django > 本小节内容适合 `Python` 开发人员阅读。 @@ -360,7 +360,7 @@ services: ### 延伸阅读 -- [Compose 模板文件详解](9.5_compose_file.md):深入理解 docker-compose.yml 的所有配置项 -- [使用 WordPress](9.8_wordpress.md):另一个 Compose 实战案例 -- [Dockerfile 最佳实践](../15_appendix/15.1_best_practices.md):构建更小、更安全的镜像 -- [数据管理](../07_data_network/README.md):Volume 和数据持久化详解 +- [Compose 模板文件详解](10.5_compose_file.md):深入理解 docker-compose.yml 的所有配置项 +- [使用 WordPress](10.8_wordpress.md):另一个 Compose 实战案例 +- [Dockerfile 最佳实践](../16_appendix/16.1_best_practices.md):构建更小、更安全的镜像 +- [数据管理](../08_data_network/README.md):Volume 和数据持久化详解 diff --git a/09_compose/9.7_rails.md b/10_compose/10.7_rails.md similarity index 97% rename from 09_compose/9.7_rails.md rename to 10_compose/10.7_rails.md index 4a6ac3c..631aeb5 100644 --- a/09_compose/9.7_rails.md +++ b/10_compose/10.7_rails.md @@ -1,4 +1,4 @@ -## 使用 Rails +## 10.7 使用 Rails > 本小节内容适合 Ruby 开发人员阅读。 @@ -282,6 +282,6 @@ $ docker compose run --rm web bundle update ### 延伸阅读 -- [使用 Django](9.6_django.md):Python Web 框架实战 -- [Compose 模板文件](9.5_compose_file.md):配置详解 -- [数据管理](../07_data_network/README.md):数据持久化 +- [使用 Django](10.6_django.md):Python Web 框架实战 +- [Compose 模板文件](10.5_compose_file.md):配置详解 +- [数据管理](../08_data_network/README.md):数据持久化 diff --git a/09_compose/9.8_wordpress.md b/10_compose/10.8_wordpress.md similarity index 96% rename from 09_compose/9.8_wordpress.md rename to 10_compose/10.8_wordpress.md index f0a67ae..2fd1788 100644 --- a/09_compose/9.8_wordpress.md +++ b/10_compose/10.8_wordpress.md @@ -1,4 +1,4 @@ -## 实战 WordPress +## 10.8 实战 WordPress WordPress 是全球最流行的内容管理系统(CMS)。使用 Docker Compose 可以在几分钟内搭建一个包含数据库、Web 服务和持久化存储的生产级 WordPress 环境。 @@ -206,6 +206,6 @@ $ docker compose restart wordpress ### 延伸阅读 -- [Compose 模板文件](9.5_compose_file.md):深入了解配置项 -- [数据卷](../07_data_network/data/volume.md):理解数据持久化 +- [Compose 模板文件](10.5_compose_file.md):深入了解配置项 +- [数据卷](../08_data_network/data/volume.md):理解数据持久化 - [Docker Hub WordPress](https://hub.docker.com/_/wordpress):官方镜像文档 diff --git a/09_compose/9.9_lnmp.md b/10_compose/10.9_lnmp.md similarity index 86% rename from 09_compose/9.9_lnmp.md rename to 10_compose/10.9_lnmp.md index 1325534..bc98151 100644 --- a/09_compose/9.9_lnmp.md +++ b/10_compose/10.9_lnmp.md @@ -1,3 +1,3 @@ -## 使用 compose 搭建 LNMP 环境 +## 10.9 使用 compose 搭建 LNMP 环境 本项目的维护者 [khs1994](https://github.com/khs1994) 的开源项目 [khs1994-docker/lnmp](https://github.com/khs1994-docker/lnmp) 使用 Docker Compose 搭建了一套 LNMP 环境,各位开发者可以参考该项目在 Docker 或 Kubernetes 中运行 LNMP。 diff --git a/09_compose/README.md b/10_compose/README.md similarity index 86% rename from 09_compose/README.md rename to 10_compose/README.md index 159f151..cedd276 100644 --- a/09_compose/README.md +++ b/10_compose/README.md @@ -1,4 +1,4 @@ -# 第九章 Docker Compose +# 第十章 Docker Compose `Docker Compose` 是 Docker 官方编排(Orchestration)项目之一,负责快速的部署分布式应用。 diff --git a/09_compose/demo/app/Dockerfile b/10_compose/demo/app/Dockerfile similarity index 100% rename from 09_compose/demo/app/Dockerfile rename to 10_compose/demo/app/Dockerfile diff --git a/09_compose/demo/app/app.py b/10_compose/demo/app/app.py similarity index 100% rename from 09_compose/demo/app/app.py rename to 10_compose/demo/app/app.py diff --git a/09_compose/demo/app/docker-compose.yml b/10_compose/demo/app/docker-compose.yml similarity index 100% rename from 09_compose/demo/app/docker-compose.yml rename to 10_compose/demo/app/docker-compose.yml diff --git a/09_compose/demo/django/.gitignore b/10_compose/demo/django/.gitignore similarity index 100% rename from 09_compose/demo/django/.gitignore rename to 10_compose/demo/django/.gitignore diff --git a/09_compose/demo/django/Dockerfile b/10_compose/demo/django/Dockerfile similarity index 100% rename from 09_compose/demo/django/Dockerfile rename to 10_compose/demo/django/Dockerfile diff --git a/09_compose/demo/django/docker-compose.yml b/10_compose/demo/django/docker-compose.yml similarity index 100% rename from 09_compose/demo/django/docker-compose.yml rename to 10_compose/demo/django/docker-compose.yml diff --git a/09_compose/demo/django/requirements.txt b/10_compose/demo/django/requirements.txt similarity index 100% rename from 09_compose/demo/django/requirements.txt rename to 10_compose/demo/django/requirements.txt diff --git a/09_compose/demo/wordpress/docker-compose.yml b/10_compose/demo/wordpress/docker-compose.yml similarity index 100% rename from 09_compose/demo/wordpress/docker-compose.yml rename to 10_compose/demo/wordpress/docker-compose.yml diff --git a/10_ops/README.md b/11_ops/README.md similarity index 86% rename from 10_ops/README.md rename to 11_ops/README.md index 05671ac..11ffc23 100644 --- a/10_ops/README.md +++ b/11_ops/README.md @@ -1,4 +1,4 @@ -# 第十章 运维管理 +# 第十一章 运维管理 本章将介绍 Docker 的运维管理,包括监控、日志与安全。 diff --git a/10_ops/logs/README.md b/11_ops/logs/README.md similarity index 100% rename from 10_ops/logs/README.md rename to 11_ops/logs/README.md diff --git a/10_ops/logs/elk.md b/11_ops/logs/elk.md similarity index 100% rename from 10_ops/logs/elk.md rename to 11_ops/logs/elk.md diff --git a/10_ops/monitor/README.md b/11_ops/monitor/README.md similarity index 100% rename from 10_ops/monitor/README.md rename to 11_ops/monitor/README.md diff --git a/10_ops/monitor/prometheus.md b/11_ops/monitor/prometheus.md similarity index 100% rename from 10_ops/monitor/prometheus.md rename to 11_ops/monitor/prometheus.md diff --git a/10_ops/security/README.md b/11_ops/security/README.md similarity index 97% rename from 10_ops/security/README.md rename to 11_ops/security/README.md index 4481999..6d5d1df 100644 --- a/10_ops/security/README.md +++ b/11_ops/security/README.md @@ -38,7 +38,7 @@ | IPC | 进程通信 | 隔离共享内存 | | UTS | 主机名 | 独立主机名 | -详见 [命名空间](../13_implementation/13.2_namespace.md) 章节。 +详见 [命名空间](../14_implementation/14.2_namespace.md) 章节。 ### 2. 控制组(Cgroups) @@ -393,6 +393,6 @@ $ cosign verify --key cosign.pub myimage:tag ## 延伸阅读 -- [命名空间](../13_implementation/13.2_namespace.md):隔离机制详解 -- [控制组](../13_implementation/13.3_cgroups.md):资源限制详解 -- [最佳实践](../15_appendix/15.1_best_practices.md):Dockerfile 安全配置 +- [命名空间](../14_implementation/14.2_namespace.md):隔离机制详解 +- [控制组](../14_implementation/14.3_cgroups.md):资源限制详解 +- [最佳实践](../16_appendix/16.1_best_practices.md):Dockerfile 安全配置 diff --git a/10_ops/security/control_group.md b/11_ops/security/control_group.md similarity index 100% rename from 10_ops/security/control_group.md rename to 11_ops/security/control_group.md diff --git a/10_ops/security/daemon_sec.md b/11_ops/security/daemon_sec.md similarity index 100% rename from 10_ops/security/daemon_sec.md rename to 11_ops/security/daemon_sec.md diff --git a/10_ops/security/kernel_capability.md b/11_ops/security/kernel_capability.md similarity index 100% rename from 10_ops/security/kernel_capability.md rename to 11_ops/security/kernel_capability.md diff --git a/10_ops/security/kernel_ns.md b/11_ops/security/kernel_ns.md similarity index 100% rename from 10_ops/security/kernel_ns.md rename to 11_ops/security/kernel_ns.md diff --git a/10_ops/security/other_feature.md b/11_ops/security/other_feature.md similarity index 100% rename from 10_ops/security/other_feature.md rename to 11_ops/security/other_feature.md diff --git a/10_ops/security/summary.md b/11_ops/security/summary.md similarity index 100% rename from 10_ops/security/summary.md rename to 11_ops/security/summary.md diff --git a/11_orchestration/README.md b/12_orchestration/README.md similarity index 89% rename from 11_orchestration/README.md rename to 12_orchestration/README.md index cf2cda0..c57b4c2 100644 --- a/11_orchestration/README.md +++ b/12_orchestration/README.md @@ -1,4 +1,4 @@ -# 第十一章 容器编排 +# 第十二章 容器编排 本章将介绍容器编排相关的技术与工具。 diff --git a/11_orchestration/etcd/README.md b/12_orchestration/etcd/README.md similarity index 100% rename from 11_orchestration/etcd/README.md rename to 12_orchestration/etcd/README.md diff --git a/11_orchestration/etcd/_images/etcd_logo.png b/12_orchestration/etcd/_images/etcd_logo.png similarity index 100% rename from 11_orchestration/etcd/_images/etcd_logo.png rename to 12_orchestration/etcd/_images/etcd_logo.png diff --git a/11_orchestration/etcd/cluster.md b/12_orchestration/etcd/cluster.md similarity index 100% rename from 11_orchestration/etcd/cluster.md rename to 12_orchestration/etcd/cluster.md diff --git a/11_orchestration/etcd/demo/cluster/docker-compose.yml b/12_orchestration/etcd/demo/cluster/docker-compose.yml similarity index 100% rename from 11_orchestration/etcd/demo/cluster/docker-compose.yml rename to 12_orchestration/etcd/demo/cluster/docker-compose.yml diff --git a/11_orchestration/etcd/etcdctl.md b/12_orchestration/etcd/etcdctl.md similarity index 100% rename from 11_orchestration/etcd/etcdctl.md rename to 12_orchestration/etcd/etcdctl.md diff --git a/11_orchestration/etcd/install.md b/12_orchestration/etcd/install.md similarity index 100% rename from 11_orchestration/etcd/install.md rename to 12_orchestration/etcd/install.md diff --git a/11_orchestration/etcd/intro.md b/12_orchestration/etcd/intro.md similarity index 100% rename from 11_orchestration/etcd/intro.md rename to 12_orchestration/etcd/intro.md diff --git a/11_orchestration/kubectl/README.md b/12_orchestration/kubectl/README.md similarity index 100% rename from 11_orchestration/kubectl/README.md rename to 12_orchestration/kubectl/README.md diff --git a/11_orchestration/kubernetes/README.md b/12_orchestration/kubernetes/README.md similarity index 100% rename from 11_orchestration/kubernetes/README.md rename to 12_orchestration/kubernetes/README.md diff --git a/11_orchestration/kubernetes/_images/k8s-singlenode-docker.png b/12_orchestration/kubernetes/_images/k8s-singlenode-docker.png similarity index 100% rename from 11_orchestration/kubernetes/_images/k8s-singlenode-docker.png rename to 12_orchestration/kubernetes/_images/k8s-singlenode-docker.png diff --git a/11_orchestration/kubernetes/_images/k8s_architecture.png b/12_orchestration/kubernetes/_images/k8s_architecture.png similarity index 100% rename from 11_orchestration/kubernetes/_images/k8s_architecture.png rename to 12_orchestration/kubernetes/_images/k8s_architecture.png diff --git a/11_orchestration/kubernetes/_images/kube-proxy.png b/12_orchestration/kubernetes/_images/kube-proxy.png similarity index 100% rename from 11_orchestration/kubernetes/_images/kube-proxy.png rename to 12_orchestration/kubernetes/_images/kube-proxy.png diff --git a/11_orchestration/kubernetes/_images/kubernetes_design.jpg b/12_orchestration/kubernetes/_images/kubernetes_design.jpg similarity index 100% rename from 11_orchestration/kubernetes/_images/kubernetes_design.jpg rename to 12_orchestration/kubernetes/_images/kubernetes_design.jpg diff --git a/11_orchestration/kubernetes/_images/kubernetes_logo.png b/12_orchestration/kubernetes/_images/kubernetes_logo.png similarity index 100% rename from 11_orchestration/kubernetes/_images/kubernetes_logo.png rename to 12_orchestration/kubernetes/_images/kubernetes_logo.png diff --git a/11_orchestration/kubernetes/_images/kubernetes_logo.svg b/12_orchestration/kubernetes/_images/kubernetes_logo.svg similarity index 100% rename from 11_orchestration/kubernetes/_images/kubernetes_logo.svg rename to 12_orchestration/kubernetes/_images/kubernetes_logo.svg diff --git a/11_orchestration/kubernetes/advanced.md b/12_orchestration/kubernetes/advanced.md similarity index 100% rename from 11_orchestration/kubernetes/advanced.md rename to 12_orchestration/kubernetes/advanced.md diff --git a/11_orchestration/kubernetes/concepts.md b/12_orchestration/kubernetes/concepts.md similarity index 100% rename from 11_orchestration/kubernetes/concepts.md rename to 12_orchestration/kubernetes/concepts.md diff --git a/11_orchestration/kubernetes/design.md b/12_orchestration/kubernetes/design.md similarity index 100% rename from 11_orchestration/kubernetes/design.md rename to 12_orchestration/kubernetes/design.md diff --git a/11_orchestration/kubernetes/intro.md b/12_orchestration/kubernetes/intro.md similarity index 100% rename from 11_orchestration/kubernetes/intro.md rename to 12_orchestration/kubernetes/intro.md diff --git a/11_orchestration/kubernetes/practice.md b/12_orchestration/kubernetes/practice.md similarity index 100% rename from 11_orchestration/kubernetes/practice.md rename to 12_orchestration/kubernetes/practice.md diff --git a/11_orchestration/setup/README.md b/12_orchestration/setup/README.md similarity index 100% rename from 11_orchestration/setup/README.md rename to 12_orchestration/setup/README.md diff --git a/11_orchestration/setup/dashboard.md b/12_orchestration/setup/dashboard.md similarity index 100% rename from 11_orchestration/setup/dashboard.md rename to 12_orchestration/setup/dashboard.md diff --git a/11_orchestration/setup/docker-desktop.md b/12_orchestration/setup/docker-desktop.md similarity index 100% rename from 11_orchestration/setup/docker-desktop.md rename to 12_orchestration/setup/docker-desktop.md diff --git a/11_orchestration/setup/k3s.md b/12_orchestration/setup/k3s.md similarity index 100% rename from 11_orchestration/setup/k3s.md rename to 12_orchestration/setup/k3s.md diff --git a/11_orchestration/setup/kind.md b/12_orchestration/setup/kind.md similarity index 100% rename from 11_orchestration/setup/kind.md rename to 12_orchestration/setup/kind.md diff --git a/11_orchestration/setup/kubeadm-docker.md b/12_orchestration/setup/kubeadm-docker.md similarity index 100% rename from 11_orchestration/setup/kubeadm-docker.md rename to 12_orchestration/setup/kubeadm-docker.md diff --git a/11_orchestration/setup/kubeadm.md b/12_orchestration/setup/kubeadm.md similarity index 100% rename from 11_orchestration/setup/kubeadm.md rename to 12_orchestration/setup/kubeadm.md diff --git a/11_orchestration/setup/systemd.md b/12_orchestration/setup/systemd.md similarity index 100% rename from 11_orchestration/setup/systemd.md rename to 12_orchestration/setup/systemd.md diff --git a/12_ecosystem/README.md b/13_ecosystem/README.md similarity index 87% rename from 12_ecosystem/README.md rename to 13_ecosystem/README.md index a3000a7..ba56192 100644 --- a/12_ecosystem/README.md +++ b/13_ecosystem/README.md @@ -1,4 +1,4 @@ -# 第十二章 容器生态 +# 第十三章 容器生态 本章将介绍容器生态圈的相关项目与服务。 diff --git a/12_ecosystem/cloud/README.md b/13_ecosystem/cloud/README.md similarity index 100% rename from 12_ecosystem/cloud/README.md rename to 13_ecosystem/cloud/README.md diff --git a/12_ecosystem/cloud/_images/ECS.jpg b/13_ecosystem/cloud/_images/ECS.jpg similarity index 100% rename from 12_ecosystem/cloud/_images/ECS.jpg rename to 13_ecosystem/cloud/_images/ECS.jpg diff --git a/12_ecosystem/cloud/_images/aliyun-logo.png b/13_ecosystem/cloud/_images/aliyun-logo.png similarity index 100% rename from 12_ecosystem/cloud/_images/aliyun-logo.png rename to 13_ecosystem/cloud/_images/aliyun-logo.png diff --git a/12_ecosystem/cloud/_images/aws-logo.jpg b/13_ecosystem/cloud/_images/aws-logo.jpg similarity index 100% rename from 12_ecosystem/cloud/_images/aws-logo.jpg rename to 13_ecosystem/cloud/_images/aws-logo.jpg diff --git a/12_ecosystem/cloud/_images/qcloud-logo.jpg b/13_ecosystem/cloud/_images/qcloud-logo.jpg similarity index 100% rename from 12_ecosystem/cloud/_images/qcloud-logo.jpg rename to 13_ecosystem/cloud/_images/qcloud-logo.jpg diff --git a/12_ecosystem/cloud/alicloud.md b/13_ecosystem/cloud/alicloud.md similarity index 100% rename from 12_ecosystem/cloud/alicloud.md rename to 13_ecosystem/cloud/alicloud.md diff --git a/12_ecosystem/cloud/aws.md b/13_ecosystem/cloud/aws.md similarity index 100% rename from 12_ecosystem/cloud/aws.md rename to 13_ecosystem/cloud/aws.md diff --git a/12_ecosystem/cloud/intro.md b/13_ecosystem/cloud/intro.md similarity index 100% rename from 12_ecosystem/cloud/intro.md rename to 13_ecosystem/cloud/intro.md diff --git a/12_ecosystem/cloud/multicloud.md b/13_ecosystem/cloud/multicloud.md similarity index 100% rename from 12_ecosystem/cloud/multicloud.md rename to 13_ecosystem/cloud/multicloud.md diff --git a/12_ecosystem/cloud/summary.md b/13_ecosystem/cloud/summary.md similarity index 100% rename from 12_ecosystem/cloud/summary.md rename to 13_ecosystem/cloud/summary.md diff --git a/12_ecosystem/cloud/tencentCloud.md b/13_ecosystem/cloud/tencentCloud.md similarity index 100% rename from 12_ecosystem/cloud/tencentCloud.md rename to 13_ecosystem/cloud/tencentCloud.md diff --git a/12_ecosystem/coreos/README.md b/13_ecosystem/coreos/README.md similarity index 100% rename from 12_ecosystem/coreos/README.md rename to 13_ecosystem/coreos/README.md diff --git a/12_ecosystem/coreos/demo/example.fcc b/13_ecosystem/coreos/demo/example.fcc similarity index 100% rename from 12_ecosystem/coreos/demo/example.fcc rename to 13_ecosystem/coreos/demo/example.fcc diff --git a/12_ecosystem/coreos/install.md b/13_ecosystem/coreos/install.md similarity index 100% rename from 12_ecosystem/coreos/install.md rename to 13_ecosystem/coreos/install.md diff --git a/12_ecosystem/coreos/intro.md b/13_ecosystem/coreos/intro.md similarity index 100% rename from 12_ecosystem/coreos/intro.md rename to 13_ecosystem/coreos/intro.md diff --git a/12_ecosystem/podman/README.md b/13_ecosystem/podman/README.md similarity index 100% rename from 12_ecosystem/podman/README.md rename to 13_ecosystem/podman/README.md diff --git a/13_implementation/13.1_arch.md b/14_implementation/14.1_arch.md similarity index 96% rename from 13_implementation/13.1_arch.md rename to 14_implementation/14.1_arch.md index 9019a35..4b9960a 100644 --- a/13_implementation/13.1_arch.md +++ b/14_implementation/14.1_arch.md @@ -1,4 +1,4 @@ -## 基本架构 +## 14.1 基本架构 Docker 的架构设计简洁而高效,主要由客户端和服务端两部分组成。 @@ -151,6 +151,6 @@ flowchart TD ### 延伸阅读 -- [命名空间](./13.2_namespace.md):Runc 如何隔离容器 -- [控制组](./13.3_cgroups.md):Runc 如何限制资源 -- [联合文件系统](./13.4_ufs.md):镜像如何存储 +- [命名空间](./14.2_namespace.md):Runc 如何隔离容器 +- [控制组](./14.3_cgroups.md):Runc 如何限制资源 +- [联合文件系统](./14.4_ufs.md):镜像如何存储 diff --git a/13_implementation/13.2_namespace.md b/14_implementation/14.2_namespace.md similarity index 98% rename from 13_implementation/13.2_namespace.md rename to 14_implementation/14.2_namespace.md index c794062..d78edec 100644 --- a/13_implementation/13.2_namespace.md +++ b/14_implementation/14.2_namespace.md @@ -1,4 +1,4 @@ -## 命名空间 +## 14.2 命名空间 命名空间(Namespace)是 Linux 内核的一个强大特性,为容器提供了隔离的运行环境。 @@ -303,7 +303,7 @@ Namespace 提供了隔离但不是安全边界: ### 延伸阅读 -- [控制组(Cgroups)](13.3_cgroups.md):资源限制机制 -- [联合文件系统](13.4_ufs.md):分层存储的实现 +- [控制组(Cgroups)](14.3_cgroups.md):资源限制机制 +- [联合文件系统](14.4_ufs.md):分层存储的实现 - [安全](../security/README.md):容器安全实践 - [Linux Namespace 官方文档](https://man7.org/linux/man-pages/man7/namespaces.7.html) diff --git a/13_implementation/13.3_cgroups.md b/14_implementation/14.3_cgroups.md similarity index 99% rename from 13_implementation/13.3_cgroups.md rename to 14_implementation/14.3_cgroups.md index 15dde7e..e7a8a4a 100644 --- a/13_implementation/13.3_cgroups.md +++ b/14_implementation/14.3_cgroups.md @@ -1,4 +1,4 @@ -## 控制组 +## 14.3 控制组 控制组(Cgroups)是 Linux 内核提供的另一种关键机制,主要用于资源的限制和审计。 @@ -298,6 +298,6 @@ $ docker run -d --name cadvisor \ ### 延伸阅读 -- [命名空间](13.2_namespace.md):资源隔离 +- [命名空间](14.2_namespace.md):资源隔离 - [安全](../security/README.md):容器安全概述 - [Docker Stats](../05_container/README.md):监控容器资源 diff --git a/13_implementation/13.4_ufs.md b/14_implementation/14.4_ufs.md similarity index 99% rename from 13_implementation/13.4_ufs.md rename to 14_implementation/14.4_ufs.md index 01889bb..c345cc6 100644 --- a/13_implementation/13.4_ufs.md +++ b/14_implementation/14.4_ufs.md @@ -1,4 +1,4 @@ -## 联合文件系统 +## 14.4 联合文件系统 联合文件系统(UnionFS)是 Docker 镜像分层存储的基础,它允许将多个目录挂载为同一个虚拟文件系统。 diff --git a/13_implementation/13.5_container_format.md b/14_implementation/14.5_container_format.md similarity index 94% rename from 13_implementation/13.5_container_format.md rename to 14_implementation/14.5_container_format.md index 3c0a9e3..97610a1 100644 --- a/13_implementation/13.5_container_format.md +++ b/14_implementation/14.5_container_format.md @@ -1,3 +1,3 @@ -## 容器格式 +## 14.5 容器格式 最初,Docker 采用了 `LXC` 中的容器格式。从 0.7 版本以后开始去除 LXC,转而使用自行开发的 [libcontainer](https://github.com/docker/libcontainer),从 1.11 开始,则进一步演进为使用 [runC](https://github.com/opencontainers/runc) 和 [containerd](https://github.com/containerd/containerd)。 diff --git a/13_implementation/13.6_network.md b/14_implementation/14.6_network.md similarity index 99% rename from 13_implementation/13.6_network.md rename to 14_implementation/14.6_network.md index 3031912..7c81a49 100644 --- a/13_implementation/13.6_network.md +++ b/14_implementation/14.6_network.md @@ -1,4 +1,4 @@ -## Docker 网络实现 +## 14.6 Docker 网络实现 Docker 的网络实现其实就是利用了 Linux 上的网络命名空间和虚拟网络设备(特别是 veth pair)。建议先熟悉了解这两部分的基本概念再阅读本章。 diff --git a/13_implementation/README.md b/14_implementation/README.md similarity index 98% rename from 13_implementation/README.md rename to 14_implementation/README.md index 608be25..8d9d1f6 100644 --- a/13_implementation/README.md +++ b/14_implementation/README.md @@ -1,4 +1,4 @@ -# 第十三章 底层实现 +# 第十四章 底层实现 Docker 底层的核心技术包括 Linux 上的命名空间(Namespaces)、控制组(Control groups)、Union 文件系统(Union file systems)和容器格式(Container format)。 diff --git a/13_implementation/_images/docker_arch.png b/14_implementation/_images/docker_arch.png similarity index 100% rename from 13_implementation/_images/docker_arch.png rename to 14_implementation/_images/docker_arch.png diff --git a/14_cases/README.md b/15_cases/README.md similarity index 87% rename from 14_cases/README.md rename to 15_cases/README.md index 9064df2..20ca701 100644 --- a/14_cases/README.md +++ b/15_cases/README.md @@ -1,4 +1,4 @@ -# 第十四章 实战案例 +# 第十五章 实战案例 本章将介绍 Docker 在不同场景下的实战案例。 diff --git a/14_cases/ci/README.md b/15_cases/ci/README.md similarity index 100% rename from 14_cases/ci/README.md rename to 15_cases/ci/README.md diff --git a/14_cases/ci/actions/README.md b/15_cases/ci/actions/README.md similarity index 100% rename from 14_cases/ci/actions/README.md rename to 15_cases/ci/actions/README.md diff --git a/14_cases/ci/devops_workflow.md b/15_cases/ci/devops_workflow.md similarity index 100% rename from 14_cases/ci/devops_workflow.md rename to 15_cases/ci/devops_workflow.md diff --git a/14_cases/ci/drone/.env.example b/15_cases/ci/drone/.env.example similarity index 100% rename from 14_cases/ci/drone/.env.example rename to 15_cases/ci/drone/.env.example diff --git a/14_cases/ci/drone/.gitignore b/15_cases/ci/drone/.gitignore similarity index 100% rename from 14_cases/ci/drone/.gitignore rename to 15_cases/ci/drone/.gitignore diff --git a/14_cases/ci/drone/README.md b/15_cases/ci/drone/README.md similarity index 91% rename from 14_cases/ci/drone/README.md rename to 15_cases/ci/drone/README.md index 5a388d6..4e7fa98 100644 --- a/14_cases/ci/drone/README.md +++ b/15_cases/ci/drone/README.md @@ -10,7 +10,7 @@ 在 Github 新建一个名为 `drone-demo` 的仓库。 -打开我们已经 [部署好的 Drone 网站](9.2_install.md) 或者 [Drone Cloud](https://cloud.drone.io),使用 GitHub 账号登录,在界面中关联刚刚新建的 `drone-demo` 仓库。 +打开我们已经 [部署好的 Drone 网站](10.2_install.md) 或者 [Drone Cloud](https://cloud.drone.io),使用 GitHub 账号登录,在界面中关联刚刚新建的 `drone-demo` 仓库。 ## 编写项目源代码 diff --git a/14_cases/ci/drone/_images/drone-build.png b/15_cases/ci/drone/_images/drone-build.png similarity index 100% rename from 14_cases/ci/drone/_images/drone-build.png rename to 15_cases/ci/drone/_images/drone-build.png diff --git a/14_cases/ci/drone/demo/.drone.yml b/15_cases/ci/drone/demo/.drone.yml similarity index 100% rename from 14_cases/ci/drone/demo/.drone.yml rename to 15_cases/ci/drone/demo/.drone.yml diff --git a/14_cases/ci/drone/demo/README.md b/15_cases/ci/drone/demo/README.md similarity index 100% rename from 14_cases/ci/drone/demo/README.md rename to 15_cases/ci/drone/demo/README.md diff --git a/14_cases/ci/drone/demo/app.go b/15_cases/ci/drone/demo/app.go similarity index 100% rename from 14_cases/ci/drone/demo/app.go rename to 15_cases/ci/drone/demo/app.go diff --git a/14_cases/ci/drone/docker-compose.yml b/15_cases/ci/drone/docker-compose.yml similarity index 100% rename from 14_cases/ci/drone/docker-compose.yml rename to 15_cases/ci/drone/docker-compose.yml diff --git a/14_cases/ci/drone/install.md b/15_cases/ci/drone/install.md similarity index 100% rename from 14_cases/ci/drone/install.md rename to 15_cases/ci/drone/install.md diff --git a/14_cases/ide/README.md b/15_cases/ide/README.md similarity index 100% rename from 14_cases/ide/README.md rename to 15_cases/ide/README.md diff --git a/14_cases/ide/vsCode.md b/15_cases/ide/vsCode.md similarity index 100% rename from 14_cases/ide/vsCode.md rename to 15_cases/ide/vsCode.md diff --git a/14_cases/os/README.md b/15_cases/os/README.md similarity index 100% rename from 14_cases/os/README.md rename to 15_cases/os/README.md diff --git a/14_cases/os/_images/alpinelinux-logo.png b/15_cases/os/_images/alpinelinux-logo.png similarity index 100% rename from 14_cases/os/_images/alpinelinux-logo.png rename to 15_cases/os/_images/alpinelinux-logo.png diff --git a/14_cases/os/_images/busybox-logo.png b/15_cases/os/_images/busybox-logo.png similarity index 100% rename from 14_cases/os/_images/busybox-logo.png rename to 15_cases/os/_images/busybox-logo.png diff --git a/14_cases/os/_images/centos-logo.png b/15_cases/os/_images/centos-logo.png similarity index 100% rename from 14_cases/os/_images/centos-logo.png rename to 15_cases/os/_images/centos-logo.png diff --git a/14_cases/os/_images/coreos-login.png b/15_cases/os/_images/coreos-login.png similarity index 100% rename from 14_cases/os/_images/coreos-login.png rename to 15_cases/os/_images/coreos-login.png diff --git a/14_cases/os/_images/coreos-logo.jpg b/15_cases/os/_images/coreos-logo.jpg similarity index 100% rename from 14_cases/os/_images/coreos-logo.jpg rename to 15_cases/os/_images/coreos-logo.jpg diff --git a/14_cases/os/_images/coreos_crt.png b/15_cases/os/_images/coreos_crt.png similarity index 100% rename from 14_cases/os/_images/coreos_crt.png rename to 15_cases/os/_images/coreos_crt.png diff --git a/14_cases/os/_images/coreos_list.png b/15_cases/os/_images/coreos_list.png similarity index 100% rename from 14_cases/os/_images/coreos_list.png rename to 15_cases/os/_images/coreos_list.png diff --git a/14_cases/os/_images/coreos_run_ip.png b/15_cases/os/_images/coreos_run_ip.png similarity index 100% rename from 14_cases/os/_images/coreos_run_ip.png rename to 15_cases/os/_images/coreos_run_ip.png diff --git a/14_cases/os/_images/debian-logo.png b/15_cases/os/_images/debian-logo.png similarity index 100% rename from 14_cases/os/_images/debian-logo.png rename to 15_cases/os/_images/debian-logo.png diff --git a/14_cases/os/_images/docker_version.png b/15_cases/os/_images/docker_version.png similarity index 100% rename from 14_cases/os/_images/docker_version.png rename to 15_cases/os/_images/docker_version.png diff --git a/14_cases/os/_images/fedora-logo.png b/15_cases/os/_images/fedora-logo.png similarity index 100% rename from 14_cases/os/_images/fedora-logo.png rename to 15_cases/os/_images/fedora-logo.png diff --git a/14_cases/os/_images/php_pulling.png b/15_cases/os/_images/php_pulling.png similarity index 100% rename from 14_cases/os/_images/php_pulling.png rename to 15_cases/os/_images/php_pulling.png diff --git a/14_cases/os/_images/ubuntu-logo.jpg b/15_cases/os/_images/ubuntu-logo.jpg similarity index 100% rename from 14_cases/os/_images/ubuntu-logo.jpg rename to 15_cases/os/_images/ubuntu-logo.jpg diff --git a/14_cases/os/_images/vmware_coreos.png b/15_cases/os/_images/vmware_coreos.png similarity index 100% rename from 14_cases/os/_images/vmware_coreos.png rename to 15_cases/os/_images/vmware_coreos.png diff --git a/14_cases/os/alpine.md b/15_cases/os/alpine.md similarity index 100% rename from 14_cases/os/alpine.md rename to 15_cases/os/alpine.md diff --git a/14_cases/os/busybox.md b/15_cases/os/busybox.md similarity index 100% rename from 14_cases/os/busybox.md rename to 15_cases/os/busybox.md diff --git a/14_cases/os/centos.md b/15_cases/os/centos.md similarity index 100% rename from 14_cases/os/centos.md rename to 15_cases/os/centos.md diff --git a/14_cases/os/debian.md b/15_cases/os/debian.md similarity index 100% rename from 14_cases/os/debian.md rename to 15_cases/os/debian.md diff --git a/14_cases/os/summary.md b/15_cases/os/summary.md similarity index 100% rename from 14_cases/os/summary.md rename to 15_cases/os/summary.md diff --git a/15_appendix/15.1_best_practices.md b/16_appendix/16.1_best_practices.md similarity index 99% rename from 15_appendix/15.1_best_practices.md rename to 16_appendix/16.1_best_practices.md index d0cc115..1959392 100644 --- a/15_appendix/15.1_best_practices.md +++ b/16_appendix/16.1_best_practices.md @@ -1,4 +1,4 @@ -## Dockerfile 最佳实践 +## 16.1 Dockerfile 最佳实践 本附录是笔者对 Docker 官方文档中 [Best practices for writing Dockerfiles](https://docs.docker.com/develop/develop-images/dockerfile_best-practices/) 的理解与翻译。 diff --git a/15_appendix/15.2_debug.md b/16_appendix/16.2_debug.md similarity index 98% rename from 15_appendix/15.2_debug.md rename to 16_appendix/16.2_debug.md index 10e2020..9478d24 100644 --- a/15_appendix/15.2_debug.md +++ b/16_appendix/16.2_debug.md @@ -1,4 +1,4 @@ -## 如何调试 Docker +## 16.2 如何调试 Docker ### 开启 Debug 模式 diff --git a/15_appendix/15.3_resources.md b/16_appendix/16.3_resources.md similarity index 98% rename from 15_appendix/15.3_resources.md rename to 16_appendix/16.3_resources.md index cba5f1c..06743dc 100644 --- a/15_appendix/15.3_resources.md +++ b/16_appendix/16.3_resources.md @@ -1,4 +1,4 @@ -## 资源链接 +## 16.3 资源链接 ### 官方网站 diff --git a/15_appendix/README.md b/16_appendix/README.md similarity index 74% rename from 15_appendix/README.md rename to 16_appendix/README.md index 9d9af59..51764dc 100644 --- a/15_appendix/README.md +++ b/16_appendix/README.md @@ -1,4 +1,4 @@ -# 第十五章 附录 +# 第十六章 附录 本章包含了 Docker 相关的参考资料、常见问题解答以及最佳实践指南,旨在为读者提供便捷的查阅工具。 @@ -7,6 +7,6 @@ * [**常见问题总结 (FAQ)**](faq/README.md):汇总了学习和使用 Docker 过程中的常见问题与错误解决方案。 * [**热门镜像介绍**](repo/README.md):详细介绍了 Nginx, MySQL, Redis 等常用官方镜像的使用方法。 * [**Docker 命令查询**](command/README.md):速查 Docker 客户端和服务端的常用命令。 -* [**Dockerfile 最佳实践**](15.1_best_practices.md):提供编写高效、安全 Dockerfile 的指导原则。 -* [**如何调试 Docker**](15.2_debug.md):介绍 Docker 调试技巧和工具。 -* [**资源链接**](15.3_resources.md):推荐更多 Docker 相关的学习资源。 +* [**Dockerfile 最佳实践**](16.1_best_practices.md):提供编写高效、安全 Dockerfile 的指导原则。 +* [**如何调试 Docker**](16.2_debug.md):介绍 Docker 调试技巧和工具。 +* [**资源链接**](16.3_resources.md):推荐更多 Docker 相关的学习资源。 diff --git a/15_appendix/_images/cmd_logic.graffle/data.plist b/16_appendix/_images/cmd_logic 2.graffle/data.plist similarity index 100% rename from 15_appendix/_images/cmd_logic.graffle/data.plist rename to 16_appendix/_images/cmd_logic 2.graffle/data.plist diff --git a/15_appendix/_images/cmd_logic.graffle/image10.pdf b/16_appendix/_images/cmd_logic 2.graffle/image10.pdf similarity index 100% rename from 15_appendix/_images/cmd_logic.graffle/image10.pdf rename to 16_appendix/_images/cmd_logic 2.graffle/image10.pdf diff --git a/15_appendix/_images/cmd_logic.graffle/image11.pdf b/16_appendix/_images/cmd_logic 2.graffle/image11.pdf similarity index 100% rename from 15_appendix/_images/cmd_logic.graffle/image11.pdf rename to 16_appendix/_images/cmd_logic 2.graffle/image11.pdf diff --git a/15_appendix/_images/cmd_logic.graffle/image12.pdf b/16_appendix/_images/cmd_logic 2.graffle/image12.pdf similarity index 100% rename from 15_appendix/_images/cmd_logic.graffle/image12.pdf rename to 16_appendix/_images/cmd_logic 2.graffle/image12.pdf diff --git a/15_appendix/_images/cmd_logic.graffle/image13.pdf b/16_appendix/_images/cmd_logic 2.graffle/image13.pdf similarity index 100% rename from 15_appendix/_images/cmd_logic.graffle/image13.pdf rename to 16_appendix/_images/cmd_logic 2.graffle/image13.pdf diff --git a/15_appendix/_images/cmd_logic.graffle/image4.pdf b/16_appendix/_images/cmd_logic 2.graffle/image4.pdf similarity index 100% rename from 15_appendix/_images/cmd_logic.graffle/image4.pdf rename to 16_appendix/_images/cmd_logic 2.graffle/image4.pdf diff --git a/15_appendix/_images/cmd_logic.graffle/image5.pdf b/16_appendix/_images/cmd_logic 2.graffle/image5.pdf similarity index 100% rename from 15_appendix/_images/cmd_logic.graffle/image5.pdf rename to 16_appendix/_images/cmd_logic 2.graffle/image5.pdf diff --git a/15_appendix/_images/cmd_logic.graffle/image6.pdf b/16_appendix/_images/cmd_logic 2.graffle/image6.pdf similarity index 100% rename from 15_appendix/_images/cmd_logic.graffle/image6.pdf rename to 16_appendix/_images/cmd_logic 2.graffle/image6.pdf diff --git a/15_appendix/_images/cmd_logic.graffle/image7.pdf b/16_appendix/_images/cmd_logic 2.graffle/image7.pdf similarity index 100% rename from 15_appendix/_images/cmd_logic.graffle/image7.pdf rename to 16_appendix/_images/cmd_logic 2.graffle/image7.pdf diff --git a/15_appendix/_images/cmd_logic.graffle/image9.pdf b/16_appendix/_images/cmd_logic 2.graffle/image9.pdf similarity index 100% rename from 15_appendix/_images/cmd_logic.graffle/image9.pdf rename to 16_appendix/_images/cmd_logic 2.graffle/image9.pdf diff --git a/15_appendix/_images/cmd_logic.dot b/16_appendix/_images/cmd_logic.dot similarity index 100% rename from 15_appendix/_images/cmd_logic.dot rename to 16_appendix/_images/cmd_logic.dot diff --git a/15_appendix/_images/cmd_logic.dot.bak b/16_appendix/_images/cmd_logic.dot.bak similarity index 100% rename from 15_appendix/_images/cmd_logic.dot.bak rename to 16_appendix/_images/cmd_logic.dot.bak diff --git a/16_appendix/_images/cmd_logic.graffle/data.plist b/16_appendix/_images/cmd_logic.graffle/data.plist new file mode 100644 index 0000000..26324d3 Binary files /dev/null and b/16_appendix/_images/cmd_logic.graffle/data.plist differ diff --git a/16_appendix/_images/cmd_logic.graffle/image10.pdf b/16_appendix/_images/cmd_logic.graffle/image10.pdf new file mode 100644 index 0000000..a906cd8 Binary files /dev/null and b/16_appendix/_images/cmd_logic.graffle/image10.pdf differ diff --git a/16_appendix/_images/cmd_logic.graffle/image11.pdf b/16_appendix/_images/cmd_logic.graffle/image11.pdf new file mode 100644 index 0000000..0d4a632 Binary files /dev/null and b/16_appendix/_images/cmd_logic.graffle/image11.pdf differ diff --git a/16_appendix/_images/cmd_logic.graffle/image12.pdf b/16_appendix/_images/cmd_logic.graffle/image12.pdf new file mode 100644 index 0000000..61d01d3 Binary files /dev/null and b/16_appendix/_images/cmd_logic.graffle/image12.pdf differ diff --git a/16_appendix/_images/cmd_logic.graffle/image13.pdf b/16_appendix/_images/cmd_logic.graffle/image13.pdf new file mode 100644 index 0000000..ed7078a Binary files /dev/null and b/16_appendix/_images/cmd_logic.graffle/image13.pdf differ diff --git a/16_appendix/_images/cmd_logic.graffle/image4.pdf b/16_appendix/_images/cmd_logic.graffle/image4.pdf new file mode 100644 index 0000000..dd2141e Binary files /dev/null and b/16_appendix/_images/cmd_logic.graffle/image4.pdf differ diff --git a/16_appendix/_images/cmd_logic.graffle/image5.pdf b/16_appendix/_images/cmd_logic.graffle/image5.pdf new file mode 100644 index 0000000..a193b99 Binary files /dev/null and b/16_appendix/_images/cmd_logic.graffle/image5.pdf differ diff --git a/16_appendix/_images/cmd_logic.graffle/image6.pdf b/16_appendix/_images/cmd_logic.graffle/image6.pdf new file mode 100644 index 0000000..3ba6c48 Binary files /dev/null and b/16_appendix/_images/cmd_logic.graffle/image6.pdf differ diff --git a/16_appendix/_images/cmd_logic.graffle/image7.pdf b/16_appendix/_images/cmd_logic.graffle/image7.pdf new file mode 100644 index 0000000..0bff3b5 Binary files /dev/null and b/16_appendix/_images/cmd_logic.graffle/image7.pdf differ diff --git a/16_appendix/_images/cmd_logic.graffle/image9.pdf b/16_appendix/_images/cmd_logic.graffle/image9.pdf new file mode 100644 index 0000000..3af6558 Binary files /dev/null and b/16_appendix/_images/cmd_logic.graffle/image9.pdf differ diff --git a/15_appendix/_images/cmd_logic.png b/16_appendix/_images/cmd_logic.png similarity index 100% rename from 15_appendix/_images/cmd_logic.png rename to 16_appendix/_images/cmd_logic.png diff --git a/15_appendix/_images/container_status.dot b/16_appendix/_images/container_status.dot similarity index 100% rename from 15_appendix/_images/container_status.dot rename to 16_appendix/_images/container_status.dot diff --git a/15_appendix/_images/container_status.png b/16_appendix/_images/container_status.png similarity index 100% rename from 15_appendix/_images/container_status.png rename to 16_appendix/_images/container_status.png diff --git a/15_appendix/command/README.md b/16_appendix/command/README.md similarity index 100% rename from 15_appendix/command/README.md rename to 16_appendix/command/README.md diff --git a/15_appendix/command/docker.md b/16_appendix/command/docker.md similarity index 100% rename from 15_appendix/command/docker.md rename to 16_appendix/command/docker.md diff --git a/15_appendix/command/dockerd.md b/16_appendix/command/dockerd.md similarity index 100% rename from 15_appendix/command/dockerd.md rename to 16_appendix/command/dockerd.md diff --git a/15_appendix/faq/README.md b/16_appendix/faq/README.md similarity index 99% rename from 15_appendix/faq/README.md rename to 16_appendix/faq/README.md index 31e87c6..b2b95ab 100644 --- a/15_appendix/faq/README.md +++ b/16_appendix/faq/README.md @@ -25,7 +25,7 @@ * 如果安装应用时候需要配置一些特殊的环境变量,在安装后要还原不需要保持的变量值; * 使用 Dockerfile 创建镜像时候要添加 .dockerignore 文件或使用干净的工作目录。 -更多内容请查看 [Dockerfile 最佳实践](../15.1_best_practices.md) +更多内容请查看 [Dockerfile 最佳实践](../16.1_best_practices.md) ### 碰到网络问题,无法 pull 镜像,命令行指定 http\_proxy 无效? diff --git a/15_appendix/faq/errors.md b/16_appendix/faq/errors.md similarity index 100% rename from 15_appendix/faq/errors.md rename to 16_appendix/faq/errors.md diff --git a/15_appendix/repo/README.md b/16_appendix/repo/README.md similarity index 100% rename from 15_appendix/repo/README.md rename to 16_appendix/repo/README.md diff --git a/15_appendix/repo/centos.md b/16_appendix/repo/centos.md similarity index 100% rename from 15_appendix/repo/centos.md rename to 16_appendix/repo/centos.md diff --git a/15_appendix/repo/minio.md b/16_appendix/repo/minio.md similarity index 100% rename from 15_appendix/repo/minio.md rename to 16_appendix/repo/minio.md diff --git a/15_appendix/repo/mongodb.md b/16_appendix/repo/mongodb.md similarity index 100% rename from 15_appendix/repo/mongodb.md rename to 16_appendix/repo/mongodb.md diff --git a/15_appendix/repo/mysql.md b/16_appendix/repo/mysql.md similarity index 100% rename from 15_appendix/repo/mysql.md rename to 16_appendix/repo/mysql.md diff --git a/15_appendix/repo/nginx.md b/16_appendix/repo/nginx.md similarity index 100% rename from 15_appendix/repo/nginx.md rename to 16_appendix/repo/nginx.md diff --git a/15_appendix/repo/nodejs.md b/16_appendix/repo/nodejs.md similarity index 100% rename from 15_appendix/repo/nodejs.md rename to 16_appendix/repo/nodejs.md diff --git a/15_appendix/repo/php.md b/16_appendix/repo/php.md similarity index 100% rename from 15_appendix/repo/php.md rename to 16_appendix/repo/php.md diff --git a/15_appendix/repo/redis.md b/16_appendix/repo/redis.md similarity index 100% rename from 15_appendix/repo/redis.md rename to 16_appendix/repo/redis.md diff --git a/15_appendix/repo/ubuntu.md b/16_appendix/repo/ubuntu.md similarity index 100% rename from 15_appendix/repo/ubuntu.md rename to 16_appendix/repo/ubuntu.md diff --git a/15_appendix/repo/wordpress.md b/16_appendix/repo/wordpress.md similarity index 100% rename from 15_appendix/repo/wordpress.md rename to 16_appendix/repo/wordpress.md diff --git a/SUMMARY.md b/SUMMARY.md index d539251..2ffcdc4 100644 --- a/SUMMARY.md +++ b/SUMMARY.md @@ -31,23 +31,6 @@ * [删除本地镜像](04_image/4.3_rm.md) * [利用 commit 理解镜像构成](04_image/4.4_commit.md) * [使用 Dockerfile 定制镜像](04_image/4.5_build.md) - * [Dockerfile 指令详解](04_image/dockerfile/README.md) - * [RUN 执行命令](04_image/dockerfile/run.md) - * [COPY 复制文件](04_image/dockerfile/copy.md) - * [ADD 更高级的复制文件](04_image/dockerfile/add.md) - * [CMD 容器启动命令](04_image/dockerfile/cmd.md) - * [ENTRYPOINT 入口点](04_image/dockerfile/entrypoint.md) - * [ENV 设置环境变量](04_image/dockerfile/env.md) - * [ARG 构建参数](04_image/dockerfile/arg.md) - * [VOLUME 定义匿名卷](04_image/dockerfile/volume.md) - * [EXPOSE 暴露端口](04_image/dockerfile/expose.md) - * [WORKDIR 指定工作目录](04_image/dockerfile/workdir.md) - * [USER 指定当前用户](04_image/dockerfile/user.md) - * [HEALTHCHECK 健康检查](04_image/dockerfile/healthcheck.md) - * [ONBUILD 为他人作嫁衣裳](04_image/dockerfile/onbuild.md) - * [LABEL 为镜像添加元数据](04_image/dockerfile/label.md) - * [SHELL 指令](04_image/dockerfile/shell.md) - * [参考文档](04_image/dockerfile/references.md) * [Dockerfile 多阶段构建](04_image/multistage-builds/README.md) * [实战多阶段构建 Laravel 镜像](04_image/multistage-builds/laravel.md) * [其它制作镜像的方式](04_image/4.6_other.md) @@ -67,116 +50,133 @@ ## 第二部分: 进阶篇 -* [第七章 数据与网络管理](07_data_network/README.md) - * [数据管理](07_data_network/data/README.md) - * [数据卷](07_data_network/data/volume.md) - * [挂载主机目录](07_data_network/data/bind-mounts.md) - * [网络配置](07_data_network/network/README.md) - * [配置 DNS](07_data_network/network/dns.md) - * [外部访问容器](07_data_network/network/port_mapping.md) -* [第八章 Docker Buildx](08_buildx/README.md) - * [BuildKit](08_buildx/8.1_buildkit.md) - * [使用 buildx 构建镜像](08_buildx/8.2_buildx.md) - * [使用 buildx 构建多种系统架构支持的 Docker 镜像](08_buildx/8.3_multi-arch-images.md) -* [第九章 Docker Compose](09_compose/README.md) - * [简介](09_compose/9.1_introduction.md) - * [安装与卸载](09_compose/9.2_install.md) - * [使用](09_compose/9.3_usage.md) - * [命令说明](09_compose/9.4_commands.md) - * [Compose 模板文件](09_compose/9.5_compose_file.md) - * [实战 Django](09_compose/9.6_django.md) - * [实战 Rails](09_compose/9.7_rails.md) - * [实战 WordPress](09_compose/9.8_wordpress.md) - * [实战 LNMP](09_compose/9.9_lnmp.md) -* [第十章 运维管理](10_ops/README.md) - * [容器监控](10_ops/monitor/README.md) - * [Prometheus](10_ops/monitor/prometheus.md) - * [日志管理](10_ops/logs/README.md) - * [ELK 套件](10_ops/logs/elk.md) - * [安全](10_ops/security/README.md) - * [内核命名空间](10_ops/security/kernel_ns.md) - * [控制组](10_ops/security/control_group.md) - * [服务端防护](10_ops/security/daemon_sec.md) - * [内核能力机制](10_ops/security/kernel_capability.md) - * [其它安全特性](10_ops/security/other_feature.md) - * [总结](10_ops/security/summary.md) +* [第七章 Dockerfile 指令详解](07_dockerfile/README.md) + * [RUN 执行命令](07_dockerfile/7.1_run.md) + * [COPY 复制文件](07_dockerfile/7.2_copy.md) + * [ADD 更高级的复制文件](07_dockerfile/7.3_add.md) + * [CMD 容器启动命令](07_dockerfile/7.4_cmd.md) + * [ENTRYPOINT 入口点](07_dockerfile/7.5_entrypoint.md) + * [ENV 设置环境变量](07_dockerfile/7.6_env.md) + * [ARG 构建参数](07_dockerfile/7.7_arg.md) + * [VOLUME 定义匿名卷](07_dockerfile/7.8_volume.md) + * [EXPOSE 暴露端口](07_dockerfile/7.9_expose.md) + * [WORKDIR 指定工作目录](07_dockerfile/7.10_workdir.md) + * [USER 指定当前用户](07_dockerfile/7.11_user.md) + * [HEALTHCHECK 健康检查](07_dockerfile/7.12_healthcheck.md) + * [ONBUILD 为他人作嫁衣裳](07_dockerfile/7.13_onbuild.md) + * [LABEL 为镜像添加元数据](07_dockerfile/7.14_label.md) + * [SHELL 指令](07_dockerfile/7.15_shell.md) + * [参考文档](07_dockerfile/7.16_references.md) +* [第八章 数据与网络管理](08_data_network/README.md) + * [数据管理](08_data_network/data/README.md) + * [数据卷](08_data_network/data/volume.md) + * [挂载主机目录](08_data_network/data/bind-mounts.md) + * [网络配置](08_data_network/network/README.md) + * [配置 DNS](08_data_network/network/dns.md) + * [外部访问容器](08_data_network/network/port_mapping.md) +* [第九章 Docker Buildx](09_buildx/README.md) + * [BuildKit](09_buildx/9.1_buildkit.md) + * [使用 buildx 构建镜像](09_buildx/9.2_buildx.md) + * [使用 buildx 构建多种系统架构支持的 Docker 镜像](09_buildx/9.3_multi-arch-images.md) +* [第十章 Docker Compose](10_compose/README.md) + * [简介](10_compose/10.1_introduction.md) + * [安装与卸载](10_compose/10.2_install.md) + * [使用](10_compose/10.3_usage.md) + * [命令说明](10_compose/10.4_commands.md) + * [Compose 模板文件](10_compose/10.5_compose_file.md) + * [实战 Django](10_compose/10.6_django.md) + * [实战 Rails](10_compose/10.7_rails.md) + * [实战 WordPress](10_compose/10.8_wordpress.md) + * [实战 LNMP](10_compose/10.9_lnmp.md) +* [第十一章 运维管理](11_ops/README.md) + * [容器监控](11_ops/monitor/README.md) + * [Prometheus](11_ops/monitor/prometheus.md) + * [日志管理](11_ops/logs/README.md) + * [ELK 套件](11_ops/logs/elk.md) + * [安全](11_ops/security/README.md) + * [内核命名空间](11_ops/security/kernel_ns.md) + * [控制组](11_ops/security/control_group.md) + * [服务端防护](11_ops/security/daemon_sec.md) + * [内核能力机制](11_ops/security/kernel_capability.md) + * [其它安全特性](11_ops/security/other_feature.md) + * [总结](11_ops/security/summary.md) ## 第三部分: 深入篇 -* [第十一章 容器编排](11_orchestration/README.md) - * [Etcd 项目](11_orchestration/etcd/README.md) - * [简介](11_orchestration/etcd/intro.md) - * [安装](11_orchestration/etcd/install.md) - * [集群](11_orchestration/etcd/cluster.md) - * [使用 etcdctl](11_orchestration/etcd/etcdctl.md) - * [Kubernetes - 开源容器编排引擎](11_orchestration/kubernetes/README.md) - * [简介](11_orchestration/kubernetes/intro.md) - * [基本概念](11_orchestration/kubernetes/concepts.md) - * [架构设计](11_orchestration/kubernetes/design.md) - * [高级特性](11_orchestration/kubernetes/advanced.md) - * [实战练习](11_orchestration/kubernetes/practice.md) - * [部署 Kubernetes](11_orchestration/setup/README.md) - * [使用 kubeadm 部署 kubernetes(CRI 使用 containerd)](11_orchestration/setup/kubeadm.md) - * [使用 kubeadm 部署 kubernetes(CRI 使用 Docker)](11_orchestration/setup/kubeadm-docker.md) - * [在 Docker Desktop 使用](11_orchestration/setup/docker-desktop.md) - * [Kind - Kubernetes IN Docker](11_orchestration/setup/kind.md) - * [K3s - 轻量级 Kubernetes](11_orchestration/setup/k3s.md) - * [一步步部署 kubernetes 集群](11_orchestration/setup/systemd.md) - * [部署 Dashboard](11_orchestration/setup/dashboard.md) - * [Kubernetes 命令行 kubectl](11_orchestration/kubectl/README.md) -* [第十二章 容器生态](12_ecosystem/README.md) - * [Fedora CoreOS](12_ecosystem/coreos/README.md) - * [简介](12_ecosystem/coreos/intro.md) - * [安装](12_ecosystem/coreos/install.md) - * [容器与云计算](12_ecosystem/cloud/README.md) - * [简介](12_ecosystem/cloud/intro.md) - * [腾讯云](12_ecosystem/cloud/tencentCloud.md) - * [阿里云](12_ecosystem/cloud/alicloud.md) - * [亚马逊云](12_ecosystem/cloud/aws.md) - * [小结](12_ecosystem/cloud/summary.md) - * [多云部署策略](12_ecosystem/cloud/multicloud.md) - * [podman - 下一代 Linux 容器工具](12_ecosystem/podman/README.md) -* [第十三章 底层实现](13_implementation/README.md) - * [基本架构](13_implementation/13.1_arch.md) - * [命名空间](13_implementation/13.2_namespace.md) - * [控制组](13_implementation/13.3_cgroups.md) - * [联合文件系统](13_implementation/13.4_ufs.md) - * [容器格式](13_implementation/13.5_container_format.md) - * [网络](13_implementation/13.6_network.md) +* [第十二章 容器编排](12_orchestration/README.md) + * [Etcd 项目](12_orchestration/etcd/README.md) + * [简介](12_orchestration/etcd/intro.md) + * [安装](12_orchestration/etcd/install.md) + * [集群](12_orchestration/etcd/cluster.md) + * [使用 etcdctl](12_orchestration/etcd/etcdctl.md) + * [Kubernetes - 开源容器编排引擎](12_orchestration/kubernetes/README.md) + * [简介](12_orchestration/kubernetes/intro.md) + * [基本概念](12_orchestration/kubernetes/concepts.md) + * [架构设计](12_orchestration/kubernetes/design.md) + * [高级特性](12_orchestration/kubernetes/advanced.md) + * [实战练习](12_orchestration/kubernetes/practice.md) + * [部署 Kubernetes](12_orchestration/setup/README.md) + * [使用 kubeadm 部署 kubernetes(CRI 使用 containerd)](12_orchestration/setup/kubeadm.md) + * [使用 kubeadm 部署 kubernetes(CRI 使用 Docker)](12_orchestration/setup/kubeadm-docker.md) + * [在 Docker Desktop 使用](12_orchestration/setup/docker-desktop.md) + * [Kind - Kubernetes IN Docker](12_orchestration/setup/kind.md) + * [K3s - 轻量级 Kubernetes](12_orchestration/setup/k3s.md) + * [一步步部署 kubernetes 集群](12_orchestration/setup/systemd.md) + * [部署 Dashboard](12_orchestration/setup/dashboard.md) + * [Kubernetes 命令行 kubectl](12_orchestration/kubectl/README.md) +* [第十三章 容器生态](13_ecosystem/README.md) + * [Fedora CoreOS](13_ecosystem/coreos/README.md) + * [简介](13_ecosystem/coreos/intro.md) + * [安装](13_ecosystem/coreos/install.md) + * [容器与云计算](13_ecosystem/cloud/README.md) + * [简介](13_ecosystem/cloud/intro.md) + * [腾讯云](13_ecosystem/cloud/tencentCloud.md) + * [阿里云](13_ecosystem/cloud/alicloud.md) + * [亚马逊云](13_ecosystem/cloud/aws.md) + * [小结](13_ecosystem/cloud/summary.md) + * [多云部署策略](13_ecosystem/cloud/multicloud.md) + * [podman - 下一代 Linux 容器工具](13_ecosystem/podman/README.md) +* [第十四章 底层实现](14_implementation/README.md) + * [基本架构](14_implementation/14.1_arch.md) + * [命名空间](14_implementation/14.2_namespace.md) + * [控制组](14_implementation/14.3_cgroups.md) + * [联合文件系统](14_implementation/14.4_ufs.md) + * [容器格式](14_implementation/14.5_container_format.md) + * [网络](14_implementation/14.6_network.md) ## 第四部分: 实战篇 -* [第十四章 实战案例](14_cases/README.md) - * [实战案例 - 操作系统](14_cases/os/README.md) - * [Busybox](14_cases/os/busybox.md) - * [Alpine](14_cases/os/alpine.md) - * [Debian Ubuntu](14_cases/os/debian.md) - * [CentOS Fedora](14_cases/os/centos.md) - * [本章小结](14_cases/os/summary.md) - * [实战案例 - CI/CD](14_cases/ci/README.md) - * [DevOps 完整工作流](14_cases/ci/devops_workflow.md) - * [GitHub Actions](14_cases/ci/actions/README.md) - * [Drone](14_cases/ci/drone/README.md) - * [部署 Drone](14_cases/ci/drone/install.md) - * [在 IDE 中使用 Docker](14_cases/ide/README.md) - * [VS Code](14_cases/ide/vsCode.md) -* [第十五章 附录](15_appendix/README.md) - * [附录一:常见问题总结](15_appendix/faq/README.md) - * [常见错误速查表](15_appendix/faq/errors.md) - * [附录二:热门镜像介绍](15_appendix/repo/README.md) - * [Ubuntu](15_appendix/repo/ubuntu.md) - * [CentOS](15_appendix/repo/centos.md) - * [Nginx](15_appendix/repo/nginx.md) - * [PHP](15_appendix/repo/php.md) - * [Node.js](15_appendix/repo/nodejs.md) - * [MySQL](15_appendix/repo/mysql.md) - * [WordPress](15_appendix/repo/wordpress.md) - * [MongoDB](15_appendix/repo/mongodb.md) - * [Redis](15_appendix/repo/redis.md) - * [Minio](15_appendix/repo/minio.md) - * [附录三:Docker 命令查询](15_appendix/command/README.md) - * [客户端命令 - docker](15_appendix/command/docker.md) - * [服务端命令 - dockerd](15_appendix/command/dockerd.md) - * [附录四:Dockerfile 最佳实践](15_appendix/15.1_best_practices.md) - * [附录五:如何调试 Docker](15_appendix/15.2_debug.md) - * [附录六:资源链接](15_appendix/15.3_resources.md) +* [第十五章 实战案例](15_cases/README.md) + * [实战案例 - 操作系统](15_cases/os/README.md) + * [Busybox](15_cases/os/busybox.md) + * [Alpine](15_cases/os/alpine.md) + * [Debian Ubuntu](15_cases/os/debian.md) + * [CentOS Fedora](15_cases/os/centos.md) + * [本章小结](15_cases/os/summary.md) + * [实战案例 - CI/CD](15_cases/ci/README.md) + * [DevOps 完整工作流](15_cases/ci/devops_workflow.md) + * [GitHub Actions](15_cases/ci/actions/README.md) + * [Drone](15_cases/ci/drone/README.md) + * [部署 Drone](15_cases/ci/drone/install.md) + * [在 IDE 中使用 Docker](15_cases/ide/README.md) + * [VS Code](15_cases/ide/vsCode.md) +* [第十六章 附录](16_appendix/README.md) + * [附录一:常见问题总结](16_appendix/faq/README.md) + * [常见错误速查表](16_appendix/faq/errors.md) + * [附录二:热门镜像介绍](16_appendix/repo/README.md) + * [Ubuntu](16_appendix/repo/ubuntu.md) + * [CentOS](16_appendix/repo/centos.md) + * [Nginx](16_appendix/repo/nginx.md) + * [PHP](16_appendix/repo/php.md) + * [Node.js](16_appendix/repo/nodejs.md) + * [MySQL](16_appendix/repo/mysql.md) + * [WordPress](16_appendix/repo/wordpress.md) + * [MongoDB](16_appendix/repo/mongodb.md) + * [Redis](16_appendix/repo/redis.md) + * [Minio](16_appendix/repo/minio.md) + * [附录三:Docker 命令查询](16_appendix/command/README.md) + * [客户端命令 - docker](16_appendix/command/docker.md) + * [服务端命令 - dockerd](16_appendix/command/dockerd.md) + * [附录四:Dockerfile 最佳实践](16_appendix/16.1_best_practices.md) + * [附录五:如何调试 Docker](16_appendix/16.2_debug.md) + * [附录六:资源链接](16_appendix/16.3_resources.md)