下面几种方式都支持 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>
正文完
发表至: 折腾不止
2024-04-24