How I shrunk a Docker image by 98.8% – featuring fanotify
1–10 of 51 posts
Re: How I shrunk a Docker image by 98.8% – featuring fanotify
#2Why not ldd?
Re: How I shrunk a Docker image by 98.8% – featuring fanotify
#3Why not just use a micro kernel container like OSV from cloud outs? Same result with less effort
Re: How I shrunk a Docker image by 98.8% – featuring fanotify
#4Why not ldd?
I've been playing with a project to do this. The first major obvious problem is anything that uses dlopen won't necessarily get all that it needs.
Re: How I shrunk a Docker image by 98.8% – featuring fanotify
#5Why not ldd?
It doesn't find dependencies like /etc/ssl/certs/ca-certificates.crt or /usr/share/zoneinfo.
Re: How I shrunk a Docker image by 98.8% – featuring fanotify
#6If only there were some way to describe in a few lines of text what an image should contain?
Re: How I shrunk a Docker image by 98.8% – featuring fanotify
#7Why not just use a micro kernel container like OSV from cloud outs? Same result with less effort
The truth is hidden in a comment: The goal was to learn fanotify syscall using a real world use-case. This said, when Dockerizing an application from scratch, using an optimized base image may be a suitable option. But that's not always the case. For instance, I often start a project from the Python base image which contains loads of generic libraries that I will not use in a given project but will be important for others. This is when a profiling based approach is interesting. You get the ease of a known environment and the efficiency of an optimized image.
Re: How I shrunk a Docker image by 98.8% – featuring fanotify
#8If only there were some way to describe in a few lines of text what an image should contain?
Do Docker images really have to contain an entire bloated Linux distro? Even for Xen, which, as a hypervisor, provides fewer services than Docker, it's possible to write applications which run directly under Xen.
Re: How I shrunk a Docker image by 98.8% – featuring fanotify
#9I don't think there is any way to prove that this found all the required files. The more paths through the code, each with its own potential file accesses that can't be predicted with out run time information, the more likely one will be missed in this optimization stage.
Re: How I shrunk a Docker image by 98.8% – featuring fanotify
#10ptrace probably would have been better solution, at least it would have avoided the problems with links