> The message itself comes (or at least should) in response to
> Dir::Cache::pkgcache and Dir::Cache::srcpkgcache being empty and if
> the cache is forbidden to be build entirely in memory – which is the
> case for apt running as root for, well, reasons. I guess we should
> drop this, even through keeping everything in memory can be very slow…

I'm not opposed to changing/removing that config (or adding more config
as appropriate), but I would note that this is documented in
apt.conf(5):

| Generation of caches can be turned off by setting pkgcache or
| srcpkgcache to "". This will slow down startup but save disk space. It
| is probably preferable to turn off the pkgcache rather than the
| srcpkgcache.

The goal in the Docker case is that we can have a "layer" in an image
whose filesystem changes consist only of the files from the packages
we've installed, and the metadata updates noting which packages were
indeed installed.  The configuration we've got now actually gets us
reasonably close to that via incantations like the following:

| RUN apt-get update && apt-get install -y some-packages && rm -rf 
/var/lib/apt/lists/*

Relevant list for a simple package like "busybox-static":

| A /bin/busybox
| A /usr/share/man/man1/busybox.1.gz
| A /usr/share/doc/busybox-static/changelog.Debian.gz
| ...
| A /usr/share/doc/busybox-static/syslog.conf.txt
| A /usr/share/initramfs-tools/hooks/zz-busybox
| C /var/lib/dpkg/status-old
| C /var/lib/dpkg/triggers
| C /var/lib/dpkg/triggers/Lock
| C /var/lib/dpkg/info
| A /var/lib/dpkg/info/busybox-static.list
| A /var/lib/dpkg/info/busybox-static.md5sums
| C /var/lib/dpkg/status
| C /var/lib/dpkg/lock
| A /var/lib/apt/extended_states
| A /var/lib/apt/lists/httpredir.debian.org_debian_dists_sid_InRelease
| A 
/var/lib/apt/lists/httpredir.debian.org_debian_dists_sid_main_binary-amd64_Packages.gz
| A /var/lib/apt/lists/lock
| A /var/log/apt/history.log
| A /var/log/apt/term.log
| C /var/log/dpkg.log

If there's a better way to accomplish this, I'm very interested, because
I'm not particularly happy about hard-coding so much APT internal
knowledge (especially since the "/var/lib/apt/lists" bit there gets
encoded in actual "end-user" Dockerfiles, not just baked into the base
image).

The full source of all configuration modifications is in the script that
builds the images:

https://github.com/docker/docker/blob/5fd15da7daad56c07842ecda082e9c5d0e6ff620/contrib/mkimage/debootstrap#L36-L152

♥,
- Tianon
  4096R / B42F 6819 007F 00F8 8E36  4FD4 036A 9C25 BF35 7DD4

Reply via email to