Skip to contentSkip to conversation

Add support to OCI images

PATCH New Sergio Prado 1 participant 3 messages Apr 10, 2021 VFS

lore
Share & tools
lore
#0 lore raw

v2 cover Add support to OCI images

This patch set adds support to OCI images.

The OCI image format is a specification for container images defined and maintained as an open standard by the Open Container Initiative [1].

To generate the image according to the specification [2], a tool called sloci-image is used.

The OCI image is generated (by default) in a directory called rootfs-oci:

$ ls output/images/rootfs-oci/
blobs  index.json  oci-layout

It can be pushed to a container registry using tools like skopeo:

$ skopeo copy --dest-creds <user>:<pass> oci:rootfs-oci:<tag> \
         docker://<user>/<image>[:tag]

And then we can pull/run the container image with tools like docker:

$ docker run --rm -it <user>/<image>[:tag]

[1] https://opencontainers.org/
[2] https://github.com/opencontainers/image-spec/blob/master/spec.md

---
Changes v1 -> v2:
- bump sloci-image version to 0.1.1 abd drop patch applied upstream
- improve usage comments
- fix check-package warnings

---
Sergio Prado (2):
package/sloci-image: new host package
oci: add new filesystem type

 DEVELOPERS                           |  1 +
 fs/Config.in                         |  1 +
 fs/oci/Config.in                     | 88 +++++++++++++++++++++++++
 fs/oci/oci.mk                        | 99 ++++++++++++++++++++++++++++
 package/Config.in.host               |  1 +
 package/sloci-image/Config.in.host   |  7 ++
 package/sloci-image/sloci-image.hash |  5 ++
 package/sloci-image/sloci-image.mk   | 19 ++++++
 8 files changed, 221 insertions(+)
 create mode 100644 fs/oci/Config.in
 create mode 100644 fs/oci/oci.mk
 create mode 100644 package/sloci-image/Config.in.host
 create mode 100644 package/sloci-image/sloci-image.hash
 create mode 100644 package/sloci-image/sloci-image.mk
Signature · 1 line
2.17.1
#1 lore raw

PATCH v2 1/2 package/sloci-image: new host package

sloci-image is a simple CLI tool for packing rootfs into a single-layer OCI image.

---
 DEVELOPERS                           |  1 +
 package/Config.in.host               |  1 +
 package/sloci-image/Config.in.host   |  7 +++++++
 package/sloci-image/sloci-image.hash |  5 +++++
 package/sloci-image/sloci-image.mk   | 19 +++++++++++++++++++
 5 files changed, 33 insertions(+)
 create mode 100644 package/sloci-image/Config.in.host
 create mode 100644 package/sloci-image/sloci-image.hash
 create mode 100644 package/sloci-image/sloci-image.mk
DEVELOPERS +1 -0
index 7699c471d3f4..956636aff93c 100644
@@ -2406,6 +2406,7 @@ F:	package/curlpp/
 F:	package/daq/
 F:	package/libgdiplus/
 F:	package/pimd/
+F:	package/sloci-image/
 F:	package/snort/
 F:	package/stella/
 F:	package/tio/
package/Config.in.host +1 -0
index ba6a68c728c2..1a2c082b9d37 100644
@@ -78,6 +78,7 @@ menu "Host utilities"
 	source "package/sam-ba/Config.in.host"
 	source "package/sdbusplus/Config.in.host"
 	source "package/sentry-cli/Config.in.host"
+	source "package/sloci-image/Config.in.host"
 	source "package/squashfs/Config.in.host"
 	source "package/sunxi-tools/Config.in.host"
 	source "package/swig/Config.in.host"
package/sloci-image/Config.in.host new file +7 -0
new file mode 100644
index 000000000000..d809f1f3c786
@@ -0,0 +1,7 @@
+config BR2_PACKAGE_HOST_SLOCI_IMAGE
+	bool "host sloci-image"
+	help
+	  A simple CLI tool for packing rootfs into a single-layer OCI
+	  image.
+
+	  https://github.com/jirutka/sloci-image
package/sloci-image/sloci-image.hash new file +5 -0
new file mode 100644
index 000000000000..117f0ba6e01f
@@ -0,0 +1,5 @@
+# Locally computed
+sha256  56fbc335c193eccc3992f0a723c6dabe762f6d4854fc52059be074bdf5060d9e  sloci-image-0.1.1.tar.gz
+
+# Hash for license files:
+sha256  8ea53673b084576813fc40cd63817c5a1619438942b5e6c30dac1d10707c27e4  LICENSE
package/sloci-image/sloci-image.mk new file +19 -0
new file mode 100644
index 000000000000..f6db7e206088
@@ -0,0 +1,19 @@
+################################################################################
+#
+# sloci-image
+#
+################################################################################
+
+SLOCI_IMAGE_VERSION = 0.1.1
+SLOCI_IMAGE_SITE = $(call github,jirutka,sloci-image,v$(SLOCI_IMAGE_VERSION))
+
+SLOCI_IMAGE_LICENSE = MIT
+SLOCI_IMAGE_LICENSE_FILES = LICENSE
+
+HOST_SLOCI_IMAGE_DEPENDENCIES = host-gawk
+
+define HOST_SLOCI_IMAGE_INSTALL_CMDS
+	$(HOST_MAKE_ENV) $(MAKE) DESTDIR=$(HOST_DIR) PREFIX=/usr -C $(@D) install
+endef
+
+$(eval $(host-generic-package))
Signature · 1 line
2.17.1
#2 lore raw

PATCH v2 2/2 oci: add new filesystem type

In reply to Sergio Prado

Add support to generate OCI (Open Container Initiative) images.

An OCI image consists of a manifest, an image index (optional), a set of filesystem layers, and a configuration. The complete specification is available in the link below:

https://github.com/opencontainers/image-spec/blob/master/spec.md

The image is generated with the host tool sloci-image, and config options can be used to configure image parameters.

By default, the image is generated in a directory called rootfs-oci:

$ cd output/images
$ ls rootfs-oci/
blobs  index.json  oci-layout

Optionally, the image can be packed into a tar archive.

The image can be pushed to a registry using containers tools like skopeo:

$ skopeo copy --dest-creds <user>:<pass> oci:rootfs-oci:<tag> \
	docker://<user>/<image>[:tag]

And then we can pull/run the container image with tools like docker:

$ docker run -it <user>/<image>[:tag]
---
 fs/Config.in     |  1 +
 fs/oci/Config.in | 88 ++++++++++++++++++++++++++++++++++++++++++
 fs/oci/oci.mk    | 99 ++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 188 insertions(+)
 create mode 100644 fs/oci/Config.in
 create mode 100644 fs/oci/oci.mk
fs/Config.in +1 -0
index 37a2aa21f8ac..eee5e26bb2b3 100644
@@ -11,6 +11,7 @@ source "fs/f2fs/Config.in"
 source "fs/initramfs/Config.in"
 source "fs/iso9660/Config.in"
 source "fs/jffs2/Config.in"
+source "fs/oci/Config.in"
 source "fs/romfs/Config.in"
 source "fs/squashfs/Config.in"
 source "fs/tar/Config.in"
fs/oci/Config.in new file +88 -0

88 lines not on this page · raw message

fs/oci/oci.mk new file +99 -0

99 lines not on this page · raw message

Signature · 1 line
2.17.1