fix: system-alinux3 修复发行版与软件源不匹配,恢复 alinux 自带源并锁定 releasever=3
This commit is contained in:
@@ -1,4 +1,3 @@
|
|||||||
#FROM alibaba-cloud-linux-3-registry.cn-hangzhou.cr.aliyuncs.com/alinux3/alinux3:220901.1
|
|
||||||
FROM alibaba-cloud-linux-3-registry.cn-hangzhou.cr.aliyuncs.com/alinux3/alinux3:3.13.3
|
FROM alibaba-cloud-linux-3-registry.cn-hangzhou.cr.aliyuncs.com/alinux3/alinux3:3.13.3
|
||||||
LABEL MAINTAINER="tianjun@odboy.cn"
|
LABEL MAINTAINER="tianjun@odboy.cn"
|
||||||
ENV TimeZone=Asia/Shanghai
|
ENV TimeZone=Asia/Shanghai
|
||||||
@@ -7,39 +6,24 @@ WORKDIR /home/admin
|
|||||||
# 升级会有很多问题,比如nginx编译失败等
|
# 升级会有很多问题,比如nginx编译失败等
|
||||||
#RUN yum update -y && yum clean all;
|
#RUN yum update -y && yum clean all;
|
||||||
|
|
||||||
# 全局锁 releasever=8
|
# 时区
|
||||||
RUN mkdir -p /etc/dnf/vars && echo 8 > /etc/dnf/vars/releasever
|
RUN ln -snf /usr/share/zoneinfo/$TimeZone /etc/localtime && echo $TimeZone > /etc/timezone
|
||||||
|
|
||||||
# 删除原有全部repo,手写 Anolis 8 阿里云源
|
# $releasever 显式锁定 3,避免从其他地方解析错版本导致路径 404
|
||||||
RUN rm -rf /etc/yum.repos.d/* && \
|
RUN mkdir -p /etc/dnf/vars && echo 3 > /etc/dnf/vars/releasever
|
||||||
cat > /etc/yum.repos.d/anolis-base.repo <<'EOF'
|
|
||||||
[anolis-BaseOS]
|
|
||||||
name=Anolis 8 BaseOS
|
|
||||||
baseurl=https://mirrors.aliyun.com/anolis/8/BaseOS/$basearch/os/
|
|
||||||
gpgcheck=1
|
|
||||||
gpgkey=https://mirrors.aliyun.com/anolis/RPM-GPG-KEY-Anolis-8
|
|
||||||
enabled=1
|
|
||||||
|
|
||||||
[anolis-AppStream]
|
# 镜像内自带源指向内网域名 mirrors.cloud.aliyuncs.com,这里替换为公网 ali yun 源
|
||||||
name=Anolis 8 AppStream
|
RUN sed -i 's/mirrors.cloud.aliyuncs.com/mirrors.aliyun.com/g' /etc/yum.repos.d/*.repo && \
|
||||||
baseurl=https://mirrors.aliyun.com/anolis/8/AppStream/$basearch/os/
|
grep -rl 'mirrors.aliyun.com' /etc/yum.repos.d/*.repo >/dev/null
|
||||||
gpgcheck=1
|
|
||||||
gpgkey=https://mirrors.aliyun.com/anolis/RPM-GPG-KEY-Anolis-8
|
|
||||||
enabled=1
|
|
||||||
EOF
|
|
||||||
|
|
||||||
# ========== 修复后的 EPEL8(重点:加 Everything) ==========
|
|
||||||
RUN cat > /etc/yum.repos.d/epel.repo <<'EOF'
|
|
||||||
[epel]
|
|
||||||
name=Extra Packages for Enterprise Linux 8
|
|
||||||
baseurl=https://mirrors.aliyun.com/epel/8/Everything/$basearch
|
|
||||||
gpgcheck=1
|
|
||||||
gpgkey=https://mirrors.aliyun.com/epel/RPM-GPG-KEY-EPEL-8
|
|
||||||
enabled=1
|
|
||||||
EOF
|
|
||||||
|
|
||||||
# dnf 调优
|
# dnf 调优
|
||||||
RUN echo -e "max_parallel_downloads=10\nmetadata_expire=3600\nmetadata_timer_sync=0\ndeltarpm=False\ntimeout=15\nminrate=200k" >> /etc/dnf/dnf.conf
|
RUN printf '%s\n' \
|
||||||
|
'max_parallel_downloads=10' \
|
||||||
|
'metadata_expire=3600' \
|
||||||
|
'metadata_timer_sync=0' \
|
||||||
|
'deltarpm=False' \
|
||||||
|
'timeout=30' \
|
||||||
|
'minrate=200k' >> /etc/dnf/dnf.conf
|
||||||
|
|
||||||
# 缓存
|
# 预制缓存,打进镜像
|
||||||
RUN dnf clean all && dnf makecache
|
RUN dnf clean all && dnf makecache
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
#FROM alibaba-cloud-linux-3-registry.cn-hangzhou.cr.aliyuncs.com/alinux3/alinux3:220901.1
|
|
||||||
FROM alibaba-cloud-linux-3-registry.cn-hangzhou.cr.aliyuncs.com/alinux3/alinux3:3.13.3
|
|
||||||
LABEL MAINTAINER="tianjun@odboy.cn"
|
|
||||||
ENV TimeZone=Asia/Shanghai
|
|
||||||
WORKDIR /home/admin
|
|
||||||
|
|
||||||
# 升级会有很多问题,比如nginx编译失败等
|
|
||||||
#RUN yum update -y && yum clean all;
|
|
||||||
|
|
||||||
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;
|
|
||||||
|
|
||||||
# 写入优化dnf.conf
|
|
||||||
RUN cat > /etc/dnf/dnf.conf <<'EOF'
|
|
||||||
[main]
|
|
||||||
gpgcheck=1
|
|
||||||
installonly_limit=3
|
|
||||||
clean_requirements_on_remove=True
|
|
||||||
max_parallel_downloads=12
|
|
||||||
# 镜像构建阶段一次性 makecache,运行时完全不刷元数据
|
|
||||||
metadata_expire=-1
|
|
||||||
check_config_file_age=False
|
|
||||||
skip_if_unavailable=True
|
|
||||||
# 海外千万别开,测速会疯狂重试
|
|
||||||
fastestmirror=0
|
|
||||||
keepcache=True
|
|
||||||
metadata_timer_sync=0
|
|
||||||
# 置空,关闭 module 机制,大幅提速
|
|
||||||
module_platform_id=
|
|
||||||
timeout=30
|
|
||||||
minrate=2048
|
|
||||||
EOF
|
|
||||||
|
|
||||||
# 预制缓存,打进镜像
|
|
||||||
RUN dnf clean all && dnf makecache
|
|
||||||
Reference in New Issue
Block a user