Images to make use of statically linked binaries to remove need for libc6-compat
Please excuse my ignorance here if this is the wrong place to raise this, but thought it might be useful to have a placeholder folks could follow. Not sure if something can be done in this repo right now, or we would still be waiting on another part of the docker ecosystem.
Background
- Last year in https://github.com/docker-library/docker/pull/323
libc6-compatwas added into the Alpine images to address an issue withctrnot being fully statically linked as noted in https://github.com/containerd/containerd/issues/5824 - Since then this addition of
libc6-compathas migrated a few places: https://github.com/docker-library/docker/search?q=libc6-compat e.g https://github.com/docker-library/docker/blob/04ae082ff40c8d4be2d20f87041e9c71447f7af4/Dockerfile-cli.template#L4-L7 - since the
libc6-compatlibrary can conflict with alternatives folks might want to use (e.ggcompator... gasp.... alpine glibc 🙈) it can cause child images to have toapk del --purge libc6-compatso seems would be better without it if it can be avoided
Current State (Sep 2022)
- In containerd
1.6.7a fix was backported to allow building static binaries simpler via- https://github.com/containerd/containerd/pull/7022
- https://github.com/containerd/containerd/pull/7045
-
Docker 20.10.18 includes containerd
1.6.8but not sure if the Alpine builds are all fully static just yet -
docker-proxyfixed to be static in https://github.com/moby/moby/pull/43621 - A mega pull was at https://github.com/moby/moby/pull/43492 but the
ctrbits had problems so look like not merged. - Fixing static build of
ctrmay be waiting on https://github.com/moby/moby/pull/43529 or similar.
Agreed, it would be great to remove this dependency -- at the very least, we could move it to the dind images now that the CLI and Docker-in-Docker are separated (#369).
I just did some testing on the ctr builds we currently consume both in 20.10 and 22.06-rc and they do still exhibit the issue, so short of building ctr from source ourselves in the image (which I don't plan to do at this layer), we are a bit at the mercy of the upstream builds. :disappointed:
at the very least, we could move it to the
dindimages now that the CLI and Docker-in-Docker are separated (https://github.com/docker-library/docker/pull/369)
Hmm, although there's a decent argument to be made for ctr existing in the CLI images, especially with https://github.com/moby/moby/labels/containerd-integration well-underway. :thinking:
Thanks for replying and giving it a test - tried to do this myself in this repo, but got lost in the scripting here :-) Let's see how things go upstream; hopefully we have the right issues opened/pull requests underway to make this happen at some point.
Am I right in thinking after https://github.com/moby/moby/pull/44659 that ctr should be static in 23.x?
Yeah! Just tested and 20.10 is still affected, but 23.0 looks fine! Will be sending a PR shortly. :muscle:
Thanks, very nice! 🥳
Happy to close this unless we think there's a realistic chance of the underlying improvements getting back-ported to 20.10?
Yeah, I guess that's a fair point; the chances of backporting the fixes are indeed low. :+1: