debuerreotype / docker-debian-artifacts

Official builds of debuerreotype-generated Debian tarballs for use in Docker
https://docker.debian.net
Apache License 2.0
317 stars 104 forks source link

apt source can't be customized? #230

Closed cyberxnomad closed 1 month ago

cyberxnomad commented 1 month ago
FROM debian:stable-slim

RUN echo "deb http://mirrors.aliyun.com/debian stable main" > /etc/apt/sources.list
RUN echo "deb http://mirrors.aliyun.com/debian stable-updates main" >> /etc/apt/sources.list
RUN echo "deb http://mirrors.aliyun.com/debian-security stable-security main" >> /etc/apt/sources.list

RUN apt-get update && apt-get install -y --no-install-recommends \
        ca-certificates  \
        netbase \
        && rm -rf /var/lib/apt/lists/ \
        && apt-get autoremove -y && apt-get autoclean -y

log:

#16 [stage-1 6/8] RUN apt-get update && apt-get install -y --no-install-recommends      ca-certificates          netbase         && rm -rf /var/lib/apt/lists/         && apt-get autoremove -y && apt-get autoclean -y
#16 0.558 Get:1 http://mirrors.aliyun.com/debian stable InRelease [151 kB]
#16 0.739 Get:2 http://mirrors.aliyun.com/debian stable-updates InRelease [55.4 kB]
#16 0.909 Get:3 http://mirrors.aliyun.com/debian-security stable-security InRelease [48.0 kB]
#16 0.913 Get:4 http://deb.debian.org/debian stable InRelease [151 kB]
#16 1.008 Get:5 http://mirrors.aliyun.com/debian stable/main amd64 Packages [8787 kB]
#16 2.573 Get:6 http://mirrors.aliyun.com/debian stable-updates/main amd64 Packages [2468 B]
#16 2.600 Get:7 http://mirrors.aliyun.com/debian-security stable-security/main amd64 Packages [188 kB]
#16 6.285 Get:8 http://deb.debian.org/debian stable-updates InRelease [55.4 kB]
#16 10.04 Get:9 http://deb.debian.org/debian-security stable-security InRelease [48.0 kB]
#16 14.48 Get:10 http://deb.debian.org/debian stable/main amd64 Packages [8787 kB]
#16 ...

As you can see from the logs, apt-get update is still using http://deb.debian.org/debian

cyberxnomad commented 1 month ago

I got it. I should have deleted /etc/apt/sources.list.d/debian.sources first!