234 points · by nikolay · 9y ago · 73 comments
A recent analysis showed that the debian:latest image is "updated roughly every month" https://anchore.com/blog/look-often-docker-images-updated/
I'm skeptical about this claim. Almost every image built from the Debian official image begins with `apt-get update` before you can actually install anything, which means you will almost always have the latest packages at the time of building.
$ sudo debootstrap stretch mydebian http://mirrors.kernel.org/debian/
$ cd mydebian
$ sudo tar -c . | docker import - mydebian
Plus you can add files to the system before taring etc...If you have significant work to do on an image a Dockerfile can often be far more complex than this method.
(These have to be advisories actually affecting the image, not all of them)
Here's a silly example:
cde python -c "import numpy as np; print(np.random.randn(3, 3).tolist())"
pushd cde-package/cde-root/; tar cavf ../../cde-image.tar *; popd
docker import cde-image.tar $USER:python-randn33
docker run $USER:python-randn33 python -c "import numpy as np; print(np.random.randn(3, 3).tolist())"
docker run -t -i $USER:python-randn33 python
If you look at the resulting "cde-image.tar" you'll find it to be quite bare. Mines had only 387 entries (files and folders).[1]: http://www.pgbovine.net/cde.html
[2]: http://pgbovine.net/automatically-create-docker-images.htm
Have a look at the lengths that AFL uses to get even close: http://lcamtuf.coredump.cx/afl/
[tl;dr it intruments execution while using a genetic algorithm to mutate inputs optimising for code coverage]
Statically determining dependencies is a lot easier and a lot more reliable! Particularly as you only need the base image once, and any extras on top are another layer on the Docker FS.
The minideb image currently weighs in at around 50MB uncompressed. For comparison the debian library image is 123MB, the alpine image is 5MB, and the newly released amazonlinuximage is 328MB.
Anybody have experience with minideb vs. debian:stable-slim? Any pros/cons to either approach?
Worth also mentioning it is the base image for ALL the Bitnami Containers that at the same time are also automatically built, updated and tested. You can take a look at all of them in Github. There are a ton of them
Does look interesting for things that need glibc compatibility though. There are some packages to help with that in Alpine but they only go so far.
https://dzone.com/articles/minideb-a-minimalist-debian-based...
You don’t need to add python “to do anything interesting.”
debian 101M
alpine 4.1M
amazonlinux 160M
These were determined with the following: for image in debian:latest alpine:latest amazonlinux:latest; do
docker pull $image
size=$(docker save $image | wc -c)
echo "\n$image is $(echo $size | numfmt --to=iec)\n"
done
Please note that it's important to only do this test with either a completely clean image store OR to save an exact sha256 image digest tag.If you try to do a `docker save` on a store where you have multiple copies of an image, it's easy to mess up and save old layers too. I suspect that's what happened with your amazonlinux test above.
Anybody know how big minideb is?
Edit: zwerdids posted that it's ~50MB so a wee bit smaller than the currently commonly used Fedora container image. And an order of magnitude bigger than an Alpine image.
Edit: I would like to know where exactly this 5-6MB is saved.
$ install_packages mime-support
vs: $ apt-get update && apt-get install -y --no-install-recommends mime-support && \
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
That's a great win in itself, this is excellent.A little OT but how does bitnami make money? They don't seem to charge AMIs atleast. So, I guess they charge AWS/GCE for providing 1-click images? Or are they a consulting company (if so, why choose them over the original app authors)? Or both?
launcher.gcr.io/google/debian8
(besides debian version)I suppose it wouldn't hurt to have smaller image layers when updating these containers more frequently to save on bandwidth at least.
Assuming, initial size is zero. If you install 100MB of packages in layer 1.
Then in second layer, you uninstall of those packages. Your image size will still be 100MB.
If you are optimizing for high density, a smaller size certainly helps.
Requirements:
- Quick to setup, best would be a one-liner and not something I have to google everytime
- Update and reboot times can be slightly randomized, so the entire cluster won't go down