Hi, Quoting Josh Triplett (2025-04-20 19:05:13) > On Sun, Apr 20, 2025 at 12:48:08PM +0200, Simon Josefsson wrote: > > Josh Triplett <j...@joshtriplett.org> writes: > > > > > And the extra symlinks in `/etc/alternatives` don't take much size; I > > > agree you don't need update-alternatives, but then, you also don't > > > strictly need the entire dpkg and apt packages, if you're already > > > omitting their files under /var/lib. > > > > Right -- has anyone considered if Debian should have official containers > > without apt and dpkg? I think that for many use-cases for containers, > > apt and dpkg will not be used and just take up space. Guix packs > > (containers) doesn't get Guix installed unless you specify that as a > > package you want to have installed (which is usually not necessary), so > > something like this should be possible. > > The tricky part of that would be that you then couldn't use that > container image as a base and install any further packages. Offering a > "stock" container image without dpkg and apt would mean that the > container image has to *already* have everything installed that people > using the container need. (By contrast, if someone is installing their > own container they could then finalize it by removing dpkg and apt and other > things not needed at runtime.)
Not quite. You can use dpkg --root to let dpkg work on another directory than your current rootfs [1]. You can use DPkg::Options to pass such options to apt. You can use dpkg --force-script-chrootless and then maintainer scripts will use tools from outside the chroot to work on the chroot. mmdebstrap makes use of this functionality. [1] small wrinkle, dpkg will read its configuration from outside the chroot, so this does not work well if you want to set up a system with a different configuration, see #808203 > I think it's a good idea to support this case, but I would ideally want to > support it in tools that people use to build containers. For instance, > suppose we had an mmdebstrap option to purge dpkg and apt and associated > paraphernalia, after installing everything needed. You don't purge dpkg. You just tell mmdebstrap to create a chroot without dpkg. You can use mmdebstrap to create, for example, a chroot which contains all of build-essential but not dpkg. mmdebstrap can do this by running apt and dpkg from the outside, passing the chroot directory using the respective options and let it populate the chroot with the packages you choose. That package set can include dpkg and apt but it doesn't have to. Don't purge dpkg and apt from your chroot. Do not install it at all in the first place. :) Thanks! cheers, josch
signature.asc
Description: signature