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

ocidir

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

11 releases (6 breaking)

Uses new Rust 2024

0.7.2 Apr 28, 2026
0.7.1 Mar 5, 2026
0.7.0 Feb 25, 2026
0.6.0 Sep 4, 2025
0.2.0 Jul 23, 2024

#146 in Unix APIs

Download history 3666/week @ 2026-01-23 2560/week @ 2026-01-30 3373/week @ 2026-02-06 1657/week @ 2026-02-13 3381/week @ 2026-02-20 7165/week @ 2026-02-27 5417/week @ 2026-03-06 5465/week @ 2026-03-13 6447/week @ 2026-03-20 6078/week @ 2026-03-27 4535/week @ 2026-04-03 2785/week @ 2026-04-10 3349/week @ 2026-04-17 4968/week @ 2026-04-24 2643/week @ 2026-05-01 3527/week @ 2026-05-08

15,196 downloads per month
Used in 7 crates (5 directly)

MIT/Apache

96KB
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 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

~11–25MB
~366K SLoC