Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The smallest I've been able to get things without completely breaking everything was around 230mb. This required lots of ugly hacks such as post install triggers that would remove useless garbage such as /usr/share/doc/ and man pages.

  # debootstrap stable mydir
  # chroot mydir apt-get remove -y vim-common nano netcat-traditional e2fsprogs
  # chroot mydir apt-get clean
  # du -sh mydir
  228M mydir


With a little more work:

    cat /etc/dpkg/dpkg.cfg.d/small
    path-exclude=/usr/share/locale/*
    path-exclude=/usr/share/man/*
    path-exclude=/usr/share/doc/*
    path-exclude=/usr/share/info/*
Saves about 15MB. Removing wget saves 50MB or so, since it uses a large library (libicu52).

    for p in $(dpkg --get-selections | cut -d $'\t' -f 1); do echo $(du -kc /x $(for i in `dpkg-query -L $p`; do [[ -f $i ]] && echo $i; done) | tail -n 1 | cut -d $'\t' -f 1) $p; done | sort -n | tail
    2676 libssl1.0.0:amd64
    3084 tzdata
    3152 libc-bin
    3288 groff-base
    3652 iptables
    5224 coreutils
    5660 perl-base
    6036 udev
    10308 libc6:amd64
    13784 systemd
(Since I've removed things, `dpkg-query -Wf '${Installed-Size}\t${Package}\n'` isn't accurate.)

Compressing Apt indices saves another 20MB [1]

The system is now down to 123MB.

[1] https://wiki.ubuntu.com/ReducingDiskFootprint#Compress_files


Note the coreutils-single package in Fedora rawhide which can be used to get coreutils down to about 1MB. Details on that change at http://pkgs.fedoraproject.org/cgit/rpms/coreutils.git/commit...


You can also use separate build and deploy containers... build in a container with all the tooling you need, that exports out to a mount point everything needed to run, then turn that mount point into the new deploy container.


Did you also try stripping out the locale's from glibc that you don't need? In CentOS that frees up about 150MB for me.


debootstrap already only comes with the minimum (en_US, I think).


Excellent. I was not aware of that, thank you!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: