#oci #container #podman #docker #opencontainers

ocidir

A Rust library for reading and writing OCI (opencontainers) layout directories

1 unstable release

0.1.0 Jun 2, 2024

#334 in Unix APIs

Download history 405/week @ 2024-06-02 450/week @ 2024-06-09 800/week @ 2024-06-16

1,655 downloads per month
Used in ostree-ext

MIT/Apache

23KB
451 lines

ocidir

A low level Rust library for reading and writing OCI directories.


lib.rs:

Read and write to OCI image layout directories

This library contains medium and low-level APIs for working with OCI images, which are basically a directory with blobs and JSON files for metadata.

Dependency on cap-std

This library makes use of cap-std to operate in a capability-oriented fashion. In practice, the code in this project is well tested and would not traverse outside its own path root. However, using capabilities is a generally good idea when operating in the container ecosystem, in particular when actively processing tar streams.

Getting started

To access an existing OCI directory:

let d = cap_std::fs::Dir::open_ambient_dir("/path/to/ocidir", cap_std::ambient_authority())?;
let d = ocidir::OciDir::open(&d)?
println!("{:?}", d.get_manifest()?);

Users of this crate are likely to want to perform low-level manipulations such as synthesizing tar layers; OciDir::push_layer for example can be used for this.

Dependencies

~9–19MB
~301K SLoC