yeasy 0cfd55af7b fix(content): repair Django tutorial crash and complete the hardening sweep
Follow-ups to the 9 secret-hardening commits (each verified against
docs.docker.com / vendor docs; one outright new bug found and fixed):

- 11.6: eb5e4397 changed settings.py to a hard os.environ lookup but the
  web service never receives POSTGRES_PASSWORD (only db does; DATABASE_URL
  is set but never read) -> step-6 'docker compose up' crashed with
  KeyError. Pass the var to web; harden the leftover literal password in
  the 配置详解 snippet that contradicted the new guidance two lines down;
  blank line after the inserted sentence (bold heading merged into the
  paragraph); dev/prod table no longer claims dev uses 明文 passwords
- 11.8: FAQ still told readers to check passwords in .env after the same
  file banned passwords in .env -> point at secrets/db_password.txt;
  backup sidecar env vars updated to tiredofit/db-backup 4.x interface
  (DB01_* + DB01_PASS_FILE + DB01_BACKUP_INTERVAL - the unprefixed DB_*
  names are ignored by current :latest; verified against upstream README)
- demo/wordpress: compose now references secrets files that ship nowhere
  -> add README with the creation commands from 11.8; demo/django: align
  with the hardened 11.6 (env-injected password, passed to web too)
- 04_image multistage demos: go build without go.mod fails on module-mode
  Go (reproduced by reviewer on go1.26) -> add 'go mod init helloworld'
  matching the 7.17 doc pattern in all three Dockerfiles
- 21.7: init script reworked init-db.sql -> init-db.sh per the official
  image's env-reading .sh hook - removes the baked 'secure_password' AND
  the CREATE DATABASE myappdb collision with POSTGRES_DB that aborted
  first-boot init (ON_ERROR_STOP); compose passes APP_DB_PASSWORD;
  microservices init.sql mount annotated schema-only (POSTGRES_USER:
  appuser would collide with CREATE USER); Dockerfile-redis healthcheck
  now authenticates via REDISCLI_AUTH read from redis.conf (plain
  redis-cli ping gets NOAUTH against requirepass - same class as the
  compose sibling eb5e4397 already fixed); dev-container dev/dev creds
  annotated local-only
- 19.3: Grafana admin password 'admin' sat directly under the newly added
  security warning -> env-injected like the rest of the stack
2026-06-10 12:06:57 -07:00
2026-03-26 08:56:11 -07:00
2020-11-02 10:33:27 +08:00
2020-07-03 12:19:36 +08:00
2026-05-18 22:37:02 -07:00
2026-02-17 22:17:02 -08:00
2026-05-15 09:16:33 -07:00
2026-05-18 07:38:58 -07:00
2019-01-06 10:15:13 +08:00
2026-02-09 11:34:35 -08:00
2026-05-18 22:37:02 -07:00
2026-05-18 07:38:58 -07:00
2026-03-24 09:27:04 -07:00
2018-01-04 15:41:34 +08:00

Docker 从入门到实践

License: CC BY-NC-SA 4.0 GitHub stars Release Online Reading PDF Based on Docker Engine v29.x

从零开始,系统掌握 Docker 容器技术的核心概念、原理与实战技巧

Docker 从入门到实践封面

关于本书

Docker 是个划时代的开源项目,它彻底释放了计算虚拟化的威力,极大提高了应用的维护效率,降低了云计算应用开发的成本!使用 Docker,可以让应用的部署、测试和分发都变得前所未有的高效和轻松!

无论是应用开发者、运维人员、还是其他信息技术从业人员,都有必要认识和掌握 Docker,节约有限的生命。

本书既适用于具备基础 Linux 知识的 Docker 初学者,也希望可供理解原理和实现的高级用户参考。同时,书中给出的实践案例,可供在进行实际部署时借鉴。

内容特色

  • 入门基础:第 1 ~ 6 章为基础内容,帮助深入理解 Docker 的基本概念 (镜像、容器、仓库) 和核心操作。
  • 进阶应用:第 7 ~ 11 章涵盖 Dockerfile 指令详解、数据与网络管理、Buildx、Compose 等高级配置和管理操作。
  • 深入原理:第 12 ~ 17 章介绍其底层实现技术,深入探讨容器编排体系 (Kubernetes、Etcd),并延伸涉及容器与云计算及其它关键生态项目 (Fedora CoreOS、Podman 等)。
  • 实战扩展:第 18 ~ 21 章重点讨论容器安全防护机制、监控与日志聚合系统 (Prometheus、ELK),并展示操作系统、CI/CD 自动化构建等典型实践案例。

五分钟快速上手

“5分钟运行第一个容器”——跟随以下步骤快速体验 Docker:

  1. 安装 Docker(第3章):根据操作系统完成 Docker 的安装与验证
  2. 第一个容器(第1章 1.1):快速体验构建镜像与启动容器的完整流程
  3. 交互式容器(第5章):执行 docker run -it ubuntu bash,进入容器内部与系统交互
  4. 镜像与仓库(第2章、第4章、第6章):理解核心概念,并学会拉取、使用与管理镜像和仓库
  5. 自定义镜像(第7章):学习如何编写 Dockerfile 创建自己的镜像

学习路线图

graph LR
    Start[Docker 学习入口] --> Ch1[第1章:Docker 简介]

    Ch1 --> Role1["运维新手<br/>第1-4章"]
    Ch1 --> Role2["开发者<br/>第1-3章 → 第5-8章"]
    Ch1 --> Role3["DevOps 工程师<br/>第1章 → 第9-14章 → 第18章"]
    Ch1 --> Role4["架构师<br/>第1章 → 第15-21章"]

    Role1 --> End1["掌握基本操作"]
    Role2 --> End2["构建与部署应用"]
    Role3 --> End3["自动化与运维"]
    Role4 --> End4["设计容器方案"]
读者角色 学习重点 核心成果
运维新手 第1-4章 掌握容器的基本概念与操作
开发者 第1-3章 → 第5-8章 学会容器化应用的构建与部署
DevOps 工程师 第1章 → 第9-14章 → 第18章 实现容器编排与自动化部署流程
架构师 第1章 → 第15-21章 设计高可用、高性能的容器基础设施

在线阅读

本书在线阅读,可直接访问 GitBook。也可访问 GitHub 仓库目录镜像站点

下载离线版本

本书提供 PDF 版本供离线阅读,可前往 GitHub Releases 页面下载最新版本。

如需获取默认分支自动更新的预览版,可直接下载 docker_practice.pdf。该文件会随主线更新覆盖,不代表正式发布版本。

本地阅读

先安装 mdPress

brew tap yeasy/tap && brew install mdpress
mdpress serve

或使用 Docker 镜像一条命令启动:

docker run -it --rm -p 4000:80 ccr.ccs.tencentyun.com/dockerpracticesig/docker_practice:vuepress

社区交流

推荐阅读

本书是技术丛书的一部分。以下书籍与本书形成互补:

书名 与本书的关系
《前线部署工程实践指南》 讲容器、Kubernetes、GitOps、IaC、供应链、安全、观测与 SLO 如何组合成可交付、可审计、可运营的部署工程体系
《智能体 Harness 工程指南》 Agent 基础设施中的容器化部署与隔离
《大模型安全权威指南》 容器安全与 AI 系统安全的交叉实践
《区块链技术指南》 区块链节点的容器化部署

参与贡献

欢迎参与项目维护

进阶学习

Docker 技术入门与实战》已更新到第 4 版,讲解最新容器技术栈知识,欢迎大家阅读并反馈建议。京东图书 | 天猫图书

支持鼓励

欢迎鼓励项目一杯 coffee~

Star History

Star History Chart

许可证

本书采用 CC BY-NC-SA 4.0 许可证。

您可以自由分享和演绎,但需署名、非商业使用、相同方式共享。

Languages
Go 100%