apt/apt-get commands may use SRV record to find nearby APT service. 1
However, offical Debian/Ubuntu images cannot utilize such functonality unless /etc/services file is present.
This means APT will download packages from deb.debian.org / archive.ubuntu.com as usual. 🤣
This also means local APT (cache/proxy) servers is bypassed and the build process may be slowed down if the bandwidth is limited.
Workaround
apt-get install -y netbasein the very beginning but this still down the package from remote.RUN apt-get update && apt-get install -y netbaseand let docker cache this RUN command.
Great when often rebuilt. 🛠️Acquire::http::Proxybut only useful in private use (proxy server usually behind firewall?) .- Modify
/etc/apt/sources.listor/etc/hosts, but cons as above. - Modify A/CNAME record in local DNS service and point to local APT service. This is another reliability/maintenance story.
Details
When APT query SRV, it asks the service name of port 80 with getservbyport_r(), which use /etc/services, which shipped in netbase.
http is not an easy answer there. Therefore, everything works as usual. 🤣
keywords for search engines
apt, apt-get, apt cache, apt proxy, srv records, dns, apt-cacher-ng, netbase, /etc/services
Just google back to my own gist from https://bugs-devel.debian.org/cgi-bin/bugreport.cgi?bug=1092164
@woshikid's comment also work. But it prevent installation of netbase due to the existence of
/etc/services, and the packages depend on it.