refactor: 移除子镜像中无效的时区设置与 yum 换源命令
- ALinux3 官方源已使用 mirrors.aliyun.com,sed 换源为空操作 - 时区已由 ENV TimeZone 控制,/etc/localtime 运行时被宿主机覆盖 - 同步更新 VULNERABILITY_FIX.md 示例
This commit is contained in:
+1
-3
@@ -9,7 +9,5 @@ WORKDIR /home/admin
|
||||
# wget \
|
||||
# net-tools \
|
||||
# bind-utils -y;
|
||||
RUN ln -snf /usr/share/zoneinfo/$TimeZone /etc/localtime && echo $TimeZone > /etc/timezone; \
|
||||
sed -i 's/mirrors.cloud.aliyuncs.com/mirrors.aliyun.com/' /etc/yum.repos.d/*.repo; \
|
||||
yum update -y && yum clean all; \
|
||||
RUN yum update -y && yum clean all; \
|
||||
rm -rf /usr/lib/python3.6;
|
||||
|
||||
@@ -80,11 +80,14 @@ LABEL MAINTAINER="tianjun@odboy.cn"
|
||||
ENV TimeZone=Asia/Shanghai
|
||||
WORKDIR /home/admin
|
||||
|
||||
RUN ln -snf /usr/share/zoneinfo/$TimeZone /etc/localtime && echo $TimeZone > /etc/timezone; \
|
||||
sed -i 's/mirrors.cloud.aliyuncs.com/mirrors.aliyun.com/' /etc/yum.repos.d/*.repo; \
|
||||
yum update -y && yum clean all
|
||||
RUN yum update -y && yum clean all; \
|
||||
rm -rf /usr/lib/python3.6
|
||||
```
|
||||
|
||||
> 说明:ALinux3 官方镜像的 repo 已使用 `mirrors.aliyun.com`,不需要再做 `mirrors.cloud.aliyuncs.com` 换源;
|
||||
> 时区由 `ENV TimeZone` 控制,运行时通常会被容器引擎挂载的宿主机 `/etc/localtime` 覆盖,
|
||||
> 因此子镜像也不再重复 `ln -snf ... /etc/localtime`。
|
||||
|
||||
然后执行构建:
|
||||
|
||||
```bash
|
||||
|
||||
Reference in New Issue
Block a user