mkosi icon indicating copy to clipboard operation
mkosi copied to clipboard

OCI as output format

Open malt3 opened this issue 1 year ago • 5 comments

mkosi is a nice tool for building (in addition to other things) nspawn images. While nspawn can use a large number of different formats, OCI is a very convenient one since there is existing infrastructure for distribution (container registries). Should mkosi learn how to generate the on disk OCI format? Additionally, should mkosi be able to reuse existing directory trees from OCI images / layers as inputs? Not sure if this makes sense and if this belongs here (or should be implemented in systemd-repart instead).

malt3 avatar Sep 05 '23 07:09 malt3

If there's a tool that makes this easy and is packaged everywhere, we can support oci.

DaanDeMeyer avatar Sep 05 '23 07:09 DaanDeMeyer

Currently the easiest workaround is likely to use a directory output and invoke buildah (or docker build with a dockerfile) to put it in a scratch image.

septatrix avatar Sep 24 '23 23:09 septatrix

If there's a tool that makes this easy and is packaged everywhere, we can support oci.

skopeo-copy(1) is widely packaged by distros and can do parts of it but it seems like the tar and a manifest.json still have to be created manually. So unless mkosi would be able to utilize some advantages of creating those images directly like multiple layers to have smaller diffs for upgrades I still stand by my statement that FROM scratch\nCOPY mkosi.output/... is way simpler

septatrix avatar Oct 25 '23 20:10 septatrix

isnt generating oci trivial? i.e. you just have to add some JSON to a tarball, and you are done?

poettering avatar Oct 30 '23 10:10 poettering

Yes. You could use the generated sysroot as the only layer and create the necessary files to conform to this spec: https://github.com/opencontainers/image-spec/blob/main/image-layout.md

The result can either just be a plain directory or could be packaged as a tar.

malt3 avatar Oct 30 '23 12:10 malt3