#oci #docker #podman-container #podman #open-containers

ocidir

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

12 releases (7 breaking)

Uses new Rust 2024

0.8.0 Jul 1, 2026
0.7.1 Mar 5, 2026
0.6.0 Sep 4, 2025
0.5.0 Jul 10, 2025
0.2.0 Jul 23, 2024

#226 in Unix APIs

Download history 3743/week @ 2026-04-20 4393/week @ 2026-04-27 2912/week @ 2026-05-04 3553/week @ 2026-05-11 3162/week @ 2026-05-18 3733/week @ 2026-05-25 3986/week @ 2026-06-01 3875/week @ 2026-06-08 2126/week @ 2026-06-15 3246/week @ 2026-06-22 4104/week @ 2026-06-29 4986/week @ 2026-07-06 3052/week @ 2026-07-13 2518/week @ 2026-07-20 4568/week @ 2026-07-27 4135/week @ 2026-08-03

14,505 downloads per month
Used in 10 crates (7 directly)

MIT/Apache

105KB
2K SLoC

ocidir

Crates.io

docs.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.

Examples

To access an existing OCI directory:

# use ocidir::cap_std;
# use ocidir::prelude::*;
# use anyhow::{anyhow, Result};
# fn main() -> anyhow::Result<()> {
let d = cap_std::fs::Dir::open_ambient_dir("/path/to/ocidir", cap_std::ambient_authority())?;
let d = ocidir::OciDir::open(d)?;
println!("{:?}", d.read_index()?);
# Ok(())
# }

Dependencies

~12–28MB
~385K SLoC