Search code examples
dockerdebiancontainers

How does Debian differ from Debian-Slim?


I am trying to select a recommended base Linux distribution for my company's container images.

I have narrowed it down to Debian and Debian-Slim.

Everything I read says that Debian-Slim is just a pared down distribution. But I can't seem to find hard details on how they differ.

What capabilities are in Debian that are not in Debian-Slim?


Solution

  • You can compare the git repos used to build the images (rootfs.manifest is useful). Or you can run each image and see what they show is different:

    $ docker run --rm debian:stable dpkg --get-selections >debian-stable-pkgs.txt
    
    $ docker run --rm debian:stable-slim dpkg --get-selections >debian-stable-slim-pkgs.txt
    
    $ diff debian-stable-pkgs.txt debian-stable-slim-pkgs.txt
    23,24d22
    < iproute2                                      install
    < iputils-ping                                  install
    35,36d32
    < libcap2:amd64                                 install
    < libcap2-bin                                   install
    40d35
    < libelf1:amd64                                 install
    53d47
    < libmnl0:amd64                                 install
    77d70
    < libxtables12:amd64                            install
    

    Additionally, as Tomofumi points out, there are various files excluded from the image (with some others reincluded). These are mostly documentation and language support:

    /usr/share/doc/*
    /usr/share/info/*
    /usr/share/linda/*
    /usr/share/lintian/overrides/*
    /usr/share/locale/*
    /usr/share/man/*
    /usr/share/doc/kde/HTML/*/*
    /usr/share/gnome/help/*/*
    /usr/share/locale/*
    /usr/share/omf/*/*-*.emf
    

    So by excluding a handful of packages, and stripping various docs and localization files, they were able to trim 45MB from the image, or about 40%.

    $ docker image ls debian
    REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
    debian              stable-slim         eb8569e750e6        2 weeks ago         69.2MB
    debian              stable              405289501bdf        2 weeks ago         114MB