Expand description
§arcbox-oci
OCI runtime specification support for ArcBox.
This crate provides parsing and management of OCI (Open Container Initiative) runtime specification structures:
- Configuration: Parse and validate
config.jsonaccording to OCI runtime-spec - Bundles: Load and create OCI bundles (directory containing config + rootfs)
- State: Container lifecycle state management
- Hooks: Lifecycle hook definitions and validation
§Example
use arcbox_oci::{Bundle, BundleBuilder, Spec};
// Load an existing bundle
let bundle = Bundle::load("/path/to/bundle")?;
println!("OCI version: {}", bundle.spec().oci_version);
// Create a new bundle with builder
let bundle = BundleBuilder::new()
.hostname("my-container")
.args(vec!["nginx".to_string(), "-g".to_string(), "daemon off;".to_string()])
.add_env("NGINX_HOST", "localhost")
.cwd("/")
.build("/path/to/new-bundle")?;
// Parse config directly
let spec = Spec::load("/path/to/config.json")?;§OCI Runtime Specification
This crate implements the OCI Runtime Specification which defines:
- Container configuration format (
config.json) - Container lifecycle states (creating, created, running, stopped)
- Lifecycle hooks (prestart, poststart, poststop, etc.)
- Platform-specific settings (Linux namespaces, cgroups, etc.)
§Architecture
┌─────────────────────────────────────────────────────────┐
│ arcbox-oci │
│ │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
│ │ config │ │ bundle │ │ state │ │
│ │ │ │ │ │ │ │
│ │ - Spec │ │ - Bundle │ │ - State │ │
│ │ - Process │ │ - Builder │ │ - Status │ │
│ │ - Root │ │ - utils │ │ - Store │ │
│ │ - Mounts │ │ │ │ │ │
│ │ - Linux │ │ │ │ │ │
│ └─────────────┘ └─────────────┘ └─────────────┘ │
│ │
│ ┌─────────────┐ ┌─────────────┐ │
│ │ hooks │ │ error │ │
│ │ │ │ │ │
│ │ - Hooks │ │ - OciError │ │
│ │ - Hook │ │ - Result │ │
│ │ - HookType │ │ │ │
│ └─────────────┘ └─────────────┘ │
└─────────────────────────────────────────────────────────┘Re-exports§
pub use bundle::Bundle;pub use bundle::BundleBuilder;pub use config::Capabilities;pub use config::ConsoleSize;pub use config::CpuResources;pub use config::Device;pub use config::IdMapping;pub use config::Linux;pub use config::MemoryResources;pub use config::Mount;pub use config::Namespace;pub use config::NamespaceType;pub use config::OCI_VERSION;pub use config::Process;pub use config::Resources;pub use config::Rlimit;pub use config::Root;pub use config::Seccomp;pub use config::Spec;pub use config::User;pub use error::OciError;pub use error::Result;pub use hooks::Hook;pub use hooks::HookContext;pub use hooks::HookResult;pub use hooks::HookType;pub use hooks::Hooks;pub use state::ContainerState;pub use state::State;pub use state::StateStore;pub use state::Status;