Dockerfile 中修改阿里云debian9-12镜像源脚本

浏览:92次阅读
没有评论

下面几种方式都支持 8.x 到 11.x 和 12.x 最新版本,即写入镜像源时自动获取系统版本,是版本自适应写法。

阿里云 Debian 镜像源地址:https://developer.aliyun.com/mirror/debian

Dockerfile 写法

RUN echo "deb https://mirrors.aliyun.com/debian/ $(cat /etc/os-release | grep 'VERSION_CODENAME' | awk -F = '{print $2}') main non-free contrib \
deb-src https://mirrors.aliyun.com/debian/ $(cat /etc/os-release | grep 'VERSION_CODENAME' | awk -F = '{print $2}') main non-free contrib  \
deb https://mirrors.aliyun.com/debian-security/ $(cat /etc/os-release | grep 'VERSION_CODENAME' | awk -F = '{print $2}')-security main  \
deb-src https://mirrors.aliyun.com/debian-security/ $(cat /etc/os-release | grep 'VERSION_CODENAME' | awk -F = '{print $2}')-security main \ 
deb https://mirrors.aliyun.com/debian/ $(cat /etc/os-release | grep 'VERSION_CODENAME' | awk -F = '{print $2}')-updates main non-free contrib \ 
deb-src https://mirrors.aliyun.com/debian/ $(cat /etc/os-release | grep 'VERSION_CODENAME' | awk -F = '{print $2}')-updates main non-free contrib \ 
deb https://mirrors.aliyun.com/debian/ $(cat /etc/os-release | grep 'VERSION_CODENAME' | awk -F = '{print $2}')-backports main non-free contrib  \
deb-src https://mirrors.aliyun.com/debian/ $(cat /etc/os-release | grep 'VERSION_CODENAME' | awk -F = '{print $2}')-backports main non-free contrib" > /etc/apt/sources.list

官方 debian11 源

deb https://mirrors.aliyun.com/debian/ bullseye main non-free contrib
deb-src https://mirrors.aliyun.com/debian/ bullseye main non-free contrib
deb https://mirrors.aliyun.com/debian-security/ bullseye-security main
deb-src https://mirrors.aliyun.com/debian-security/ bullseye-security main
deb https://mirrors.aliyun.com/debian/ bullseye-updates main non-free contrib
deb-src https://mirrors.aliyun.com/debian/ bullseye-updates main non-free contrib
deb https://mirrors.aliyun.com/debian/ bullseye-backports main non-free contrib
deb-src https://mirrors.aliyun.com/debian/ bullseye-backports main non-free contrib

如果报 key is not available,执行:sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys <PUB_KEY>

正文完
 0
包子
版权声明:本站原创文章,由 包子 于2024-04-23发表,共计1991字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
评论(没有评论)