mirror of
https://github.com/yeasy/docker_practice.git
synced 2026-08-10 08:27:25 +00:00
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。
This commit is contained in:
@@ -164,7 +164,7 @@ curl -s http://myip.ipip.net -i
|
||||
#### 实现方式
|
||||
|
||||
```docker
|
||||
# 建议使用 redis:7 或 redis:latest,具体版本号根据生产需求选择
|
||||
# 建议使用 redis:7 等具体版本标签,避免 latest,具体版本号根据生产需求选择
|
||||
FROM redis:7-alpine
|
||||
COPY docker-entrypoint.sh /usr/local/bin/
|
||||
ENTRYPOINT ["docker-entrypoint.sh"]
|
||||
|
||||
Reference in New Issue
Block a user