-
Notifications
You must be signed in to change notification settings - Fork 43
fix: allow envbuilder on sysbox container runtime #51
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
Conversation
97d3ff1
to
42c7956
Compare
It probably needs a lot of polishing as I'm not native to the go ecosystem. I'm sorry about that. But I can confirm that it allows to successfully use envbuilder on top of a sysbox runtime. |
This fixes coder#50 by temporary bind-mounting all readonly mounts within the MagicDir to keep them out of the way for kaniko. After kaniko finished it's build, the original mountpoints are restored at their original location. Signed-off-by: Jan Losinski <[email protected]>
To give a bit more of an explanation here: The base-image I'm using in the envbuilder-dockerfile (debian:bookworm) contains a symlink from I first attempted to add all So my "fix" is now to bind-mount all One question that remains is, if this scheme should also apply to the RW mounts - as this would then be more close to how a "normal" container works (runtime-mounts are "on top" of the image-state). |
🖐️ |
🙌 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Neat trick, TIL you can unmount the source of a bind-mount. 😄
err = syscall.Unmount(src, 0) | ||
if err != nil { | ||
logf(codersdk.LogLevelError, "Could not unmount %s: %s", src, err.Error()) | ||
continue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really want to continue in both of these cases? Wouldn't it be safer to error out?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at it now I think you might be right. On the other hand, the error will catch you later anyway when kaniko tries to delete the containing directory to make room for the base image.
But I do think fail fast is better. Feel free to make any changes you feel suitable.
There is stuff you learn in 20 years of Linux that you wish you would have never be exposed to 🫣 What do you think about RW mounts? It would mean that we could mount a persistent home directory In an envbuilder container without having to meddle with the ignorelist. |
Creating a separate branch for resolving conflicts: https://github.com/coder/envbuilder/compare/cj/janl/sysbox-issues Validated using sysbox v0.6.4 in a Lima VM using envbuilder's own devcontainer:
Note: dockerd does need to be started manually in the absence of any init or systemd. Some separate fiddling may be necessary there. |
Continuing in #183 |
This fixes #50 by temporary bind-mounting all readonly mounts within the MagicDir to keep them out of the way for kaniko.
After kaniko finished it's build, the original mountpoints are restored at their original location.