google / cadvisor

Analyzes resource usage and performance characteristics of running containers.
Other
17.26k stars 2.33k forks source link

Improve alpine container to use native libc6-compat #2109

Open tiagoapimenta opened 6 years ago

tiagoapimenta commented 6 years ago

https://github.com/google/cadvisor/blob/cf21050b5906cce83527f5c531f0cd7d279a3da3/deploy/Dockerfile#L10

Instead of downloading a binary out of nowhere it would be better to use native package libc6-compat:

apk add --no-cache libc6-compat

As well as removing wget, certs and findutils and other unnecessary tools after the download, or use native wget without https.

Other tip would be use multistage-build: https://docs.docker.com/develop/develop-images/multistage-build/

So it wouldn't be necessary to remove wget and certs tools, it would just use another base container and copy the downloaded files from the first one.

dashpole commented 6 years ago

Feel free to open a PR with these improvements. If we use multistage build, we should add documentation about the docker version required to build.

tiagoapimenta commented 6 years ago

Ok, I'm forking it, but in my opinion it should be as clean as possible, as I have stated on the other issue, so I will remove wget and ca-certificates as it seems it was only installed in order to download glibc.

I understand it will not be possible to remove findutils by now, but is it really necessary to have device-mapper, zfs, thin-provisioning-tools and a custom /etc/nsswitch.conf? Could you please explain me why?