Skip to content

Dockerfile: consistently use Alpine or Debian for building the binaries #4037

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
AkihiroSuda opened this issue Mar 26, 2025 · 3 comments
Open

Comments

@AkihiroSuda
Copy link
Member

IIRC static linking didn't work well with glibc, at least in the past.
Basically we should rather try to use Alpine (musl) for building the binaries

Originally posted by @AkihiroSuda in #4012 (comment)

@apostasie
Copy link
Contributor

Breakout of #4021

A few data points:

  • my fork builds everything on Debian - there is no particular difficulty with static - https://github.com/farcloser/lepton/blob/main/Dockerfile
  • the projects concerned by this change would be the ones which need CGO - that is:
    • containerd (not ctr nor containerd-shim)
    • bypass4netns (but not bypass4netnsd)
    • runc
    • soci
    • of course tini, libslirp, and slirp4netns

I do not believe you can build containerd against musl (eg: because of pkcs11).
Also, compiling containerd statically as we do right now very likely breaks pkcs11 on any system where the glibc version is not exactly the same as the glic used to compile (the irony of dlopen).

@AkihiroSuda
Copy link
Member Author

pkcs11

Probably we can just ignore it, as it seems only used for rarely-used imgcrypt.
Anybody who wants to use pkcs11 will have to rebuild the binary.

Anyway, if Debian builds work well, we can just depend on it, although Alpine might be able to save the binary footprints

@AkihiroSuda
Copy link
Member Author

Alternatively we can still consider adopting Nix:

This is more ideal for repro builds, but maintaining the nix files isn’t really straightforward

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants