Expand description
ocipkg consists of executables (ocipkg
and cargo-ocipkg
) and this crate for handling OCI Artifact without container runtime.
See README.md at GitHub for usage of the executables. This reference describes the crate part.
§Layout, Manifest, and Artifact
ocipkg defines original type of OCI Artifact, application/vnd.ocipkg.v1.artifact
to exchange directories containing static libraries.
But this crate is also a general purpose library to handle any kind of OCI Artifact which can contain any kind of data.
Note that current implementation (from ocipkg 0.3.0) is based on OCI Image specification 1.1.0.
§Image Manifest
Every contents in a container are stored as blob, and identified by its hash digest (usually SHA256 is used). OCI Image Manifest describes how these blobs are combined to form a container. From OCI Image specification 1.1.0, OCI Image Manifest can store OCI Artifact in addition to usual executable containers.
In this crate, [oci_spec::image::ImageManifest] is used to represent OCI Image Manifest.
§Image Layout
OCI Image Layout specifies how blobs are stored as a directory.
Blobs are stored in blobs/sha256/
directory with its hash digest as a file name.
OCI Image Manifest is a JSON string and also stored as a blob, thus we have to find the blob storing the manifest first.
index.json
lists the digests of manifests stored in the layout.
There is also a file oci-layout
which contains version of the layout itself.
Two types of layout formats are supported. oci-dir
format is a directory containing blobs as OCI Image Layout format:
{dirname}/
├── blobs/
│ └── sha256/
│ ├── 0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef
│ └── ...
├── index.json
└── oci-layout
oci-archive
format is a tar archive of a oci-dir
format. Creating a new image layout takes following steps:
- Create an empty layout
- Add blobs, and store their digests
- Create a manifest using blob digests, store the manifest itself as blob, and store its digest in
index.json
This process is abstracted by image::ImageBuilder. This yields a layout which implements image::Image trait.
Re-exports§
pub extern crate oci_spec;
Modules§
- Pull and Push images to OCI registry based on OCI distribution specification
- Read and Write ocipkg artifacts defined as
application/vnd.ocipkg.v1.artifact
- Manage container images stored in local storage
Structs§
- A parsed pair of algorithm:digest as defined by https://github.com/opencontainers/image-spec/blob/main/descriptor.md#digests
- Image name
Functions§
- Get and link package in
build.rs
with cargo link instructions.