yeasy
12c2acca52
fix(命令): 五处照抄跑不起来,另修四处违反本书自己规则的写法
...
跑不起来的五处:
- 11.5:604 的 Compose 示例里 `db:` 顶在第 0 列,是**顶级键而不是服务**。
实测 yaml 解析结果是 `{'services': None, 'db': {...}}`,`docker compose up`
直接报错。同文件其他服务示例都缩进正确。
- 10.3 的 `docker manifest create` 把 `--amend` 当成每个 manifest 的前缀写了
两遍。upstream `docker/cli` 里它是 `BoolVarP(&opts.amend, "amend", "a", ...)`,
不取值;用法是 `create MANIFEST_LIST MANIFEST [MANIFEST...]`。照抄不仅参数
错位,还会打开"修改已有列表"的语义。改为直接跟位置参数。
- 21.7:288 `apk add postgresql-contrib pg-stat-monitor`。核对 Alpine v3.23 的
APKINDEX(427828 行,直接解包官方索引):这两个包名都**不存在**,Alpine 只
提供带主版本号的 `postgresql16-contrib` 等;`apk add` 遇到未知包会中止,
该 Dockerfile 卡在第二步。改为 postgresql16-contrib 并去掉 pg-stat-monitor,
同时注明原因。
- 19.3:528 用 `pip install --user` 装到 `/root/.local`,运行阶段却 `USER nobody`。
Debian 的 `/root` 是 0700,nobody 无法进入,容器起来就找不到依赖。改为装到
`/opt/pydeps`(PYTHONUSERBASE)并同步 COPY 与 PATH。
- 11.8:202 的 `WORDPRESS_REDIS_HOST` 不被官方镜像识别——`wp-config-docker.php`
只映射固定的一组 WORDPRESS_* 变量,其中没有 Redis 项;Redis Object Cache
插件读的是 PHP 常量 `WP_REDIS_HOST`。改为经 `WORDPRESS_CONFIG_EXTRA` 注入。
违反本书自己规则的四处:
- 全书 21 处 `FROM ... as`(13 处在正文、8 处在 Dockerfile)用小写 as,会被
`docker buildx build --check` 的 FromAsCasing 报
`'as' and 'FROM' keywords' casing do not match`——而本书正是拿 `--check`
当准绳(7.6:16、10.2:23),且自己另有 12 处已经写成大写 AS。统一为 AS,
并把 7.17:174 那句"可以使用 `as` 来为某一阶段命名"一并改掉并附上检查项链接。
- 6.3:137 建议"可替换为 `httpd:latest`",而同文件 22 行之后就写着"不要使用
`latest`,以保证部署的可重复性"。删去该建议。
- 7.6:253 写"多个 ENV 会创建多层",而 4.5:5 明确区分过:只改元数据的指令
不新增文件系统层。ENV 正属于后者。改为"多出几条构建历史记录"。
核验方式的一点说明:查 Alpine 包是否存在时,我先用网页搜索接口做了一遍,
结果四个包名全部"命中"(包括本不该存在的那个)——那个页面会把查询词回显。
改用官方 APKINDEX 解包比对后才得到可信结论,两种方法交叉确认后才动手。
2026-09-04 15:01:00 -07:00
yeasy
ac5ec03ab5
fix(安全,版本): seccomp 示例是安全降级,另修三处凭据/暴露面与九处版本过时
...
安全(四条,前三条都是书自己打自己):
- 18.5 的自定义 seccomp 示例用 `"defaultAction": "SCMP_ACT_ALLOW"` 写了一个
blocklist。但 `--security-opt seccomp=<file>` 是**整体替换**默认 profile
而非叠加(官方 seccomp 文档:容器"uses the default profile unless you
override it"),而默认 profile 恰恰是 deny-by-default 的 allowlist——本节
第 11 行自己就这么写的。净效果是:挡住了 chmod,却把默认拦下的那 ~44 个
高危调用(unshare / keyctl / add_key / bpf / perf_event_open / init_module
/ reboot 等)全部放行,**比不加这个参数更危险**,而读者会以为自己加固了。
改为从官方 default.json 派生,并在示例前置醒目警告。
- 7.6 把 `docker run -e DB_PASSWORD=xxx` 标成「✅ 正确」。它只是把泄漏路径
从镜像换到了别处:进 shell history、进宿主机进程 argv(同机任何用户 ps
可见)、并永久固化在 `docker inspect` 的 Config.Env 里。而本书 11.8:102
明写「不要把数据库密码写入 compose.yaml、.env、**命令行** 或 Git」,
16.3:251 也要求「避免把真实口令写入命令历史」。改为标注 -e 的泄漏面,
并给出 --env-file / Compose secrets 的正确做法。
- 6.2 教读者起一个**无认证、无 TLS** 的 registry,且引导把它绑到内网地址、
开 insecure-registries,全节零安全提示。同网段任意主机可匿名 push,即
镜像投毒。而 18.3:17 用最强语气写着「绝不能在没有任何安全控制的情况下
强行开启」。示例改为绑 127.0.0.1,并在两处补上风险说明与指向 6.3 的出口。
- 18.6 的 CI 示例里,Trivy 那条注释写着「务必使用不可变的 commit SHA 引用,
而非可变标签」(引的是 2026-03-19 Trivy Actions 76 个 tag 被劫持事件),
可同一 workflow 里另外九条 uses 全是可变标签,包括持有凭据的
docker/login-action。补一段说明点破这一点。(本仓库自己的
.github/workflows/ 确实全部按 SHA 钉死,已实测确认后才写进书里。)
版本时效(对 GitHub releases / endoflife.date / docs.docker.com 逐条核实):
- 5.1 与 6.3 说 `ubuntu:24.04`「是最新 LTS」——最新 LTS 已是 26.04
(2026-04-23 发布);而本书 3.1 早就列出了 26.04,属书内不一致。更糟的是
5.1 建议可替换为 `ubuntu:20.04`,而 3.1:33 正警告 20.04 已不在支持列表。
- 3.1 的支持列表里的 Ubuntu 25.10 已被 Docker 官方安装文档移除(该版本本身
也已于 2026-07-01 EOL),删去。
- 4.6 拿 `alpine:3.20` 当"锁定版本以确保可重现性"的范例,而 3.20 已于
2026-04 EOL;改为 3.24。
- 3.2 的「Debian Bullseye 11 将于 2026 年 8 月底结束长期支持」时态已过期。
- kind v0.31.0 → v0.33.0(落后两个小版本);etcd v3.5.29 → v3.5.33。
- 10_buildx/README 推荐「Docker v28 及以上」,而紧接着的段落就在用
「自 Docker Engine 29 起」立论;改为 v29。
2026-09-04 14:53:09 -07:00
yeasy
a780127d48
fix(用词): 「其它」统一为「其他」(34 处 / 25 文件)
...
《现代汉语词典》与《中文技术文档写作风格指南》都以「其他」为规范词形;
本书基线是 90 处「其他」比 35 处「其它」,是集群里遗留最多的一本
(其余各书 0~4 处,blockchain_guide 已于 2026-08-05 统一过 47 处)。
其中 6 处在标题和目录上——`4.6 其它制作镜像的方式`、`第十七章 容器其它生态`、
`18.5 其它安全特性`——标题与 SUMMARY 条目**同批改写以保持一致**:
改动后 196 条目录名与各文件标题仍是 0 处不一致。
**`CHANGELOG.md` 里那一处刻意不动**:它是历史发布记录,改它等于改历史。
改动前后逐字符对称差:只有 34 个「它」变成「他」,无其他字符变化。
`check_project_rules` 202/202、`check_emphasis` 202/202、37 tests OK。
2026-08-24 13:18:05 -07:00
yeasy
ef2625531d
style: 含中文的括号统一为全角(336 处 / 110 文件)
...
全书此前是真·五五开:含中文的括号 336 处半角 : 336 处全角,而且**在同一文件
内混用**——`18_security/18.1_kernel_ns.md` 第 11/17/20 行写 `(如 runC)`,
第 31 行写 `(用户命名空间映射)`。这不是体例问题,是它自己跟自己不一致。
集群里其余 13 本都一边倒(llm_internals 5 : 1049、oc_guide 2 : 713、
forward_deployed_engineering_guide 0 : 108),blockchain_guide 已在 2026-08-05
按同一方向统一过 97 处,故取全角,而非另立新规。全角括号前后不留空格,
原先 `概念 (镜像、容器、仓库) 和` 两侧的空格一并收掉。
**纯拉丁内容的半角括号一个没动**——`新建一个层 (Layer)`、`项目 (project)`
保持原样:改动前后「半角且内容纯拉丁」的数量都是 **1163**,而「半角且含中文」
从 **336 变成 0**。
其余验证:改动前后各自抹掉全部空白与圆括号后**逐字节相同**(两侧均 19559 字符);
左右括号总数改动前后都是 399 : 399,证明没有吞括号也没有配错对。
`check_project_rules` 202/202、`check_emphasis` 202/202、37 tests OK、
根 `format_checker` 与 `validate_codeblocks` 干净、`git diff --check` 干净。
2026-08-24 13:13:23 -07:00
yeasy
4a1e7aeaff
fix(4.2): Engine 29 起 docker image ls 默认不再列出虚悬镜像
...
4.2.5 用一条裸 `docker images` 演示 `<none>` 行,但本书 1.1 的版本提示写明
「本书内容及示例基于 Docker Engine v29.x 及以上版本」,而这条输出在 29 上
不可能出现:docker/cli#6574(2025-10-29 合入,随 29.0 发布)把无标签镜像
从默认列表里拿掉了,Engine 29 发行说明写作 "docker image ls no longer shows
untagged images by default if no --all flag is provided",官方 `docker image ls`
参考页的 Description 现在也是 "Untagged (dangling) images are also hidden by
default. Use the -a (--all) flag to show intermediate layers and dangling
images."(该页 Examples 里的老输出反而还没跟上,以 Description 与发行说明为准)。
示例改用本节自己后面就在推荐的 `-f dangling=true`,并把这条默认行为写进导语。
4.2.6 「-a 会显示很多无标签镜像——这些是构建过程中产生的中间层」同步补上虚悬镜像
——`-a` 的官方说明正是 "default hides intermediate and dangling images",两类
都藏,只说中间层会让读者以为虚悬镜像仍在默认列表里。
2026-08-22 23:30:10 -07:00
yeasy
08e981018e
fix(content): 修正四处书内自相矛盾的技术断言
...
1. FROM「必须是第一条指令」(4.5、7.16、summary 三处)与本书 7.7.4「FROM 之前的
ARG」整节直接冲突。官方 Dockerfile 参考写的是 "A Dockerfile must begin with a
FROM instruction. This may be after parser directives, comments, and globally
scoped ARGs",且 "ARG is the only instruction that may precede FROM"。三处
一并改成「第一条构建指令」并点明例外。
2. 12 章小结把 USER Namespace 列进「默认启用」的一档,并写「容器 root ≠ 宿主机
root」;而同章 12.2.2 明写 USER Namespace 默认**不**启用、需 userns-remap 显式
开启,18.1 更直说「在默认情况下,容器内的 root 用户(UID=0)就是宿主机上的
root 用户」。小结按正文口径改回——这条读反了会直接误判容器逃逸的风险面。
3. 11.5「目前支持三种日志驱动类型」是 Compose 早期文本的残留。官方支持 json-file、
local、syslog、journald、gelf、fluentd、awslogs、splunk、etwlogs、gcplogs、
none 共十余种,本书 19 章小结自己就列了六种。改为给出常见取值并链到官方清单。
4. 7.8 与 7.5 的示例注释建议 postgres:latest / redis:latest,而 4.1、7.10、
7.16、7 章小结、4.5 全都要求避免 latest(7.8 同一文件第 177 行也写「避免
latest」)。按全书口径改掉这两处。
另:ENV 的空格分隔旧写法(7.6 的「格式一」、附录四的 PG_MAJOR/PATH 示例)改为等号
形式并加注。BuildKit 的 LegacyKeyValueFormat 检查会报
"ENV key=value" should be used instead of legacy "ENV key value" format,
而本书 10.2 与 07 章 README 正是在推荐 docker buildx build --check。
2026-08-07 23:26:12 -07:00
yeasy
51698c89c5
fix(content): correct verified internal inconsistencies across 7 sections
...
均为书内自证的矛盾,无需外部来源:
- 19.3: golang:1.26-alpine 标注为 ~1GB,但 21.7 将 ~900MB 归给非 alpine 的
golang:1.26,且 7.17 实测 alpine 版镜像为 295MB——alpine 变体不可能大于其
非 alpine 版本。改为与 21.7 一致的「golang:1.26 基础镜像的 ~900MB」。
- 20_cases_os: 正文称通用镜像 100-300 MB,紧邻的表格却列 Ubuntu ~80 MB
(与 4.2 的 ubuntu 24.04 78MB 一致)。正文改为 80-300 MB。
- 4.2: 「查找大于 500MB 的镜像」的 ^[0-9]+GB 不匹配小数,会漏掉 docker 实际
输出的全部 x.yGB(本书自己的示例即为 2.5GB)。补充可选小数部分。
- 6.2: docker image ls 示例输出把 tag 混入 REPOSITORY 列
(127.0.0.1:5000/ubuntu:latest + TAG latest),与同块 ubuntu/latest 行及
本节自述的 tag 格式不符。
- 5.3: 生命周期状态图缺 Stopped --> Running,而 5.3.6 正是讲 docker start
启动已停止的容器;原图中停止的容器只能被删除。
- 9.5: 端口映射图节点标签 "容器 (Class B: 80)" 语义错乱(Class B 是 IP 地址
分类,与端口无关),改为「容器 (端口: 80)」。
- appendix/faq/errors.md: 标题「常见错误速查表」与 SUMMARY.md 及 faq/README
两处链接文字「常见错误处理」不一致(全书 196 篇中唯一一处标题漂移)。
2026-07-16 23:20:25 -07:00
yeasy
9fdffa9d91
fix(content): harden Docker practice guide
2026-06-16 21:23:21 -07:00
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
yeasy
1cdd3c582a
fix(content): harden Docker examples
2026-06-01 10:33:50 -07:00
yeasy
094965e039
修复编辑问题:错别字/语病/术语/标点等 25 处(自动审校)
2026-05-31 22:20:50 -07:00
yeasy
9230b49b6b
fix(04): replace deprecated openjdk base image with eclipse-temurin and fix 地 typo
2026-05-28 11:38:28 -07:00
yeasy
7f83abc53b
fix(content): correct Docker Engine 29.0.0 date and align login-action version
...
Docker Engine 29.0.0 was released 2025-11-10 per docs.docker.com release
notes, not 2025-11-11 (off by one day). Also bring docker/login-action
reference in 18.6 up to v4 to match the 21.2 example (v4 has been current
since 2026-03-04).
2026-05-22 03:19:37 -07:00
yeasy
4075330dba
Fix architecture mermaid and MySQL version
2026-05-19 18:43:11 -07:00
yeasy
e21794ebde
Fix stale image facts
2026-05-17 20:28:01 -07:00
yeasy
1ba904a9ff
Fix markdown format issues
2026-05-15 09:58:19 -07:00
yeasy
705d162f05
Fix image docs typos
2026-05-15 09:16:33 -07:00
yeasy
3c5c5911b0
Fix nginx version, IPVS removal, cgroups v2 and Redis config
2026-05-13 08:22:20 +00:00
yeasy
625d209fa8
Fix Docker Engine 29 release date and Rootless mode history
2026-05-02 22:26:19 +00:00
yeasy
b148d9efa9
Update nginx to 1.30 stable, add IPVS deprecation note
2026-05-02 18:18:48 +00:00
yeasy
89c2690a62
Correct Docker Engine 29 release date
2026-04-29 10:24:06 +00:00
yeasy
16203c5018
Complete Dockerfile instruction reference list
2026-04-27 23:17:39 +00:00
yeasy
09fd556c18
Refresh image CLI docs
2026-04-27 09:15:19 -07:00
Baohua Yang
aa204fb454
chore: lint cleanup and version corrections
...
- Accept benign linter changes (version notes, explicit tags, formatting)
- Fix incorrect version downgrades introduced by linter:
- golang:1.22→1.26 (restored)
- rust:1.82→1.95 (restored)
- 23 files updated
2026-04-25 15:58:27 +00:00
yeasy
1e9cdeea3f
Update Grafana to v13, add version notes
2026-04-25 15:50:13 +00:00
yeasy
515ba9f64a
Add blank lines before lists per CommonMark
2026-04-25 15:13:27 +00:00
yeasy
94f74fc86e
Clarify image build semantics
2026-04-24 10:51:49 -07:00
yeasy
b3d1508310
Add new content and update versions
2026-04-19 22:35:33 -07:00
yeasy
31093ccbdb
修复 URL 编码与澄清 containerd image store 启用条件
2026-03-30 08:37:37 -07:00
yeasy
3bad07c41a
更新Docker安装、镜像、Dockerfile和Compose等文档内容
2026-03-29 11:40:34 -07:00
yeasy
63ce0dc3f5
Fix trailing whitespace
2026-03-27 22:20:39 -07:00
yeasy
76c2ae50fe
Add blank lines around headers
2026-03-24 09:27:04 -07:00
yeasy
44b1307277
Remove blank lines after code block markers
2026-03-21 22:36:09 -07:00
yeasy
370949f226
Add blank lines before headers
2026-03-21 12:57:51 -07:00
yeasy
b9c63a5133
Polish Docker workflow formatting
2026-03-16 00:32:49 -07:00
yeasy
a16e0879c0
Improve READMEs and add contribution prompts
2026-03-09 20:04:21 -07:00
yeasy
c4eca44c85
Minor fix
2026-03-09 20:04:15 -07:00
baohua
20a69d1662
Fix typography
2026-03-09 20:04:13 -07:00
Baohua Yang
6b95292d1b
Fix format
2026-03-02 21:55:31 -08:00
Baohua Yang
44c580c412
Reduce image size
2026-02-27 19:23:28 -08:00
Baohua Yang
5f32350c12
Add more content and fix format
2026-02-25 21:06:21 -08:00
Baohua Yang
5e8d7252be
Simplify words and fix format issues
2026-02-24 22:01:02 -08:00
Baohua Yang
f0c6d7de95
Fix wrong links
2026-02-22 16:04:41 -08:00
Baohua Yang
8c77a9aa99
Fix missing links
2026-02-22 13:40:20 -08:00
Baohua Yang
cd61d220bc
Add number to section names
2026-02-22 08:37:51 -08:00
Baohua Yang
114def0634
style(docs): standardize heading formats and numbering
...
- Enforce Level 1-3 structural numbering based on SUMMARY.md hierarchy
- Remove structural numbering from Level 4+ headings
- Eliminate single child headings by converting to bold text
- Auto-inject summary text for headings with multiple children missing intro text
- Exclude Appendix chapters from structural numbering
- Avoid modifying code block contents
- Add script to detect non-standard English usage in headers
2026-02-21 22:40:33 -08:00
Baohua Yang
8d85c22ee4
Restruct and reorder chapters
2026-02-21 22:22:17 -08:00
Baohua Yang
b9c9efe02b
Fix space with bold markdown
2026-02-21 17:39:37 -08:00
Baohua Yang
e69a140cc9
chore: remove unused historic image files
2026-02-21 16:43:31 -08:00
Baohua Yang
cc13935f0f
style: apply global formatting fixes (struct, spacing, zhlint)
2026-02-21 11:08:52 -08:00