docker debian镜像配置阿里源

debiandocker
2025-08-15 09:42:49

docker debian镜像配置阿里源

Dockerfile 复制代码
# 普遍替换
RUN sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list.d/debian.sources
RUN apt-get update
Dockerfile 复制代码
# 安装 docker-ce-cli
RUN apt-get update && \
    apt-get install -y curl gnupg lsb-release && \
    curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/debian/gpg  | \
        gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg && \
    echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] \
        https://mirrors.aliyun.com/docker-ce/linux/debian  \
        $(lsb_release -cs) stable" > /etc/apt/sources.list.d/docker.list