Skip to content
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

containers: support derivation #12

Closed
cgwalters opened this issue Apr 15, 2021 · 8 comments
Closed

containers: support derivation #12

cgwalters opened this issue Apr 15, 2021 · 8 comments

Comments

@cgwalters
Copy link
Member

cgwalters commented Apr 15, 2021

We may in the future support the equivalent of a Dockerfile that does

FROM quay.io/exampleos/exampleos:latest
RUN curl ...
ADD ...
RUN ostree container-finalize-bootable

What this will do is basically an ostree-tar version of ostree commit --tree=dir=/ --selinux-policy-from-base that will do e.g. selinux labeling, hardlink deduplication and computing the sha256 digest.

In theory, we don't require this "blessing" of ostree container-finalize-bootable - we could do it client side too. But I think it's better for the client side to be "dumb" by default - it makes it more like an image system.

Use/integration with rpm-ostree and higher level projects

This project is independent of rpm-ostree and other tools. However we need to support them; specifically e.g.:

FROM quay.io/coreos/fedora:stable
RUN rpm-ostree install cowsay
RUN ostree container-finalize-bootable

Following the above. And so our library/model should also support what rpm-ostree natively wants to do in unpacking rpms into ostree commits for example.

Ultimately, this scope creeps basically into a new ostree repo mode container-tar or so?

@cgwalters
Copy link
Member Author

If we want to support Dockerfile then it basically means we need to understand container layer deltas.

@cgwalters
Copy link
Member Author

Thinking through this more, it seems to me that derivation support does scope creep into mapping container image layers into ostree commits, and handling GC. Basically to gain the real benefit, we need to avoid re-pulling layers we already have.

This isn't hard at all, and similar code exists in containers/storage's ostree backend. But it is definitely a scope increase.

@cgwalters cgwalters changed the title containers: support derivation? containers: support derivation Sep 15, 2021
cgwalters added a commit to cgwalters/ostree-rs-ext that referenced this issue Sep 15, 2021
This is prep for iterating on ostreedev#12
@cgwalters
Copy link
Member Author

cgwalters commented Sep 26, 2021

First, you need the code from coreos/rpm-ostree#3139 and most notably #99 plus https://github.com/cgwalters/container-image-proxy stuck in the image too.

These instructions have been tested on current FCOS stable 34.20210904.3.0. But note that the syntax for rebasing to containers has changed in the newer rpm-ostree v2021.11 (with newer ostree-rs-ext) which is included in this test container I've uploaded. Anyways you can copy and paste these commands:

# systemctl mask --now zincati
# rpm-ostree rebase --experimental docker://quay.io/cgwalters/fcos-dev:latest
...
# systemctl reboot

Now from there, try creating a derived image! You could do it on the same machine, but I think it's much clearer to use a separate build system, which could be the quay.io buildsystem or e.g. an OpenShift cluster or whatever.

There's an example here https://github.com/cgwalters/fcos-derivation-example

Right now you can easily e.g. add files - notably things like systemd units. What doesn't work yet is yum install...there's some nontrivial work to do on the rpm-ostree side for that, but you can do rpm -Uvh.

Anyways, once you have your image uploaded somewhere, try rebasing to it:

# rpm-ostree rebase --experimental ostree-unverified-image:docker://quay.io/cgwalters/fcos-derivation-example:latest

From there you can apply via e.g. systemctl reboot or alternatively try rpm-ostree ex apply-live!

cgwalters added a commit to cgwalters/rpm-ostree that referenced this issue Sep 26, 2021
cgwalters added a commit to cgwalters/rpm-ostree that referenced this issue Sep 26, 2021
cgwalters added a commit to cgwalters/rpm-ostree that referenced this issue Sep 28, 2021
@cgwalters
Copy link
Member Author

A big looming problem with this whole thing is handling /etc/passwd. This touches on coreos/rpm-ostree#49

Basically do we support people doing e.g. useradd foo; chown foo /etc/someconfig type stuff in Dockerfile?

cgwalters added a commit to cgwalters/rpm-ostree that referenced this issue Oct 7, 2021
For ostreedev/ostree-rs-ext#12

Let's ship this updated code to replace the existing bits so
people can try it out more easily.  Once we gain experience
with it, we can make a stable ostree-rs-ext release.
cgwalters added a commit to cgwalters/rpm-ostree that referenced this issue Oct 15, 2021
For ostreedev/ostree-rs-ext#12

Let's ship this updated code to replace the existing bits so
people can try it out more easily.  Once we gain experience
with it, we can make a stable ostree-rs-ext release.
cgwalters added a commit to cgwalters/ostree-rs-ext that referenced this issue Oct 22, 2021
This is prep for iterating on ostreedev#12
cgwalters added a commit to cgwalters/rpm-ostree that referenced this issue Oct 28, 2021
For ostreedev/ostree-rs-ext#12

Let's ship this updated code to replace the existing bits so
people can try it out more easily.  Once we gain experience
with it, we can make a stable ostree-rs-ext release.
cgwalters added a commit to cgwalters/rpm-ostree that referenced this issue Oct 28, 2021
For ostreedev/ostree-rs-ext#12

Let's ship this updated code to replace the existing bits so
people can try it out more easily.  Once we gain experience
with it, we can make a stable ostree-rs-ext release.
@mkenigs
Copy link
Contributor

mkenigs commented Nov 2, 2021

Would a Dockerfile be used or some other format? Just thinking about making MCO/MCBS more declarative and wondering how this would fit in.

@cgwalters
Copy link
Member Author

@cgwalters
Copy link
Member Author

But to clarify, this proposal does not require Dockerfile- any tool which can build container images should work.

@cgwalters
Copy link
Member Author

cgwalters commented Nov 2, 2021

The initial version of this is implemented in the 0.4.0 release. Closing this issue since we have a working PoC - a lot more remains to be done obviously, but will make a followup tracker issue.

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