{"id":21659693,"url":"https://github.com/youki-dev/oci-spec-rs","last_synced_at":"2025-07-17T22:32:45.381Z","repository":{"id":37007769,"uuid":"391983582","full_name":"youki-dev/oci-spec-rs","owner":"youki-dev","description":"OCI Runtime, Image and Distribution Spec in Rust","archived":false,"fork":false,"pushed_at":"2025-05-19T12:04:15.000Z","size":13823,"stargazers_count":253,"open_issues_count":9,"forks_count":60,"subscribers_count":12,"default_branch":"main","last_synced_at":"2025-06-04T15:49:11.802Z","etag":null,"topics":["oci","rust","spec"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/oci-spec","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/youki-dev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":"GOVERNANCE.md","roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-08-02T14:37:37.000Z","updated_at":"2025-06-01T06:59:54.000Z","dependencies_parsed_at":"2023-01-17T13:00:44.123Z","dependency_job_id":"d2e49057-03fb-40d2-a5fa-318a8ecbd257","html_url":"https://github.com/youki-dev/oci-spec-rs","commit_stats":{"total_commits":188,"total_committers":26,"mean_commits":7.230769230769231,"dds":0.7287234042553192,"last_synced_commit":"d540c0c7ca5821b670082ef8f5faaad9b96c1220"},"previous_names":["youki-dev/oci-spec-rs"],"tags_count":24,"template":false,"template_full_name":null,"purl":"pkg:github/youki-dev/oci-spec-rs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/youki-dev%2Foci-spec-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/youki-dev%2Foci-spec-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/youki-dev%2Foci-spec-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/youki-dev%2Foci-spec-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/youki-dev","download_url":"https://codeload.github.com/youki-dev/oci-spec-rs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/youki-dev%2Foci-spec-rs/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265672342,"owners_count":23808844,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["oci","rust","spec"],"created_at":"2024-11-25T09:31:23.762Z","updated_at":"2025-07-17T22:32:45.376Z","avatar_url":"https://github.com/youki-dev.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"# oci-spec-rs\n\n[![ci](https://github.com/containers/oci-spec-rs/workflows/ci/badge.svg)](https://github.com/containers/oci-spec-rs/actions)\n[![gh-pages](https://github.com/containers/oci-spec-rs/workflows/gh-pages/badge.svg)](https://github.com/containers/oci-spec-rs/actions)\n[![crates.io](https://img.shields.io/crates/v/oci-spec.svg)](https://crates.io/crates/oci-spec)\n[![codecov](https://codecov.io/gh/containers/oci-spec-rs/branch/main/graph/badge.svg)](https://codecov.io/gh/containers/oci-spec-rs)\n[![docs](https://img.shields.io/badge/docs-main-blue.svg)](https://containers.github.io/oci-spec-rs/oci_spec/index.html)\n[![docs.rs](https://docs.rs/oci-spec/badge.svg)](https://docs.rs/oci-spec)\n[![dependencies](https://deps.rs/repo/github/containers/oci-spec-rs/status.svg)](https://deps.rs/repo/github/containers/oci-spec-rs)\n[![license](https://img.shields.io/github/license/containers/oci-spec-rs.svg)](https://github.com/containers/oci-spec-rs/blob/master/LICENSE)\n\n### Open Container Initiative (OCI) Specifications for Rust\n\nThis library provides a convenient way to interact with the specifications defined by the [Open Container Initiative (OCI)](https://opencontainers.org). \n\n- [Image Format Specification](https://github.com/opencontainers/image-spec/blob/main/spec.md)\n- [Runtime Specification](https://github.com/opencontainers/runtime-spec/blob/master/spec.md)\n- [Distribution Specification](https://github.com/opencontainers/distribution-spec/blob/main/spec.md)\n\n```toml\n[dependencies]\noci-spec = \"0.8.1\"\n```\n*Compiler support: requires rustc 1.54+*\n\nIf you want to propose or cut a new release, then please follow our \n[release process documentation](./release.md).\n\n## Image Format Spec Examples\n- Load image manifest from filesystem\n```rust no_run\nuse oci_spec::image::ImageManifest;\n\nlet image_manifest = ImageManifest::from_file(\"manifest.json\").unwrap();\nassert_eq!(image_manifest.layers().len(), 5);\n```\n\n- Create new image manifest using builder\n```rust no_run\nuse std::str::FromStr;\nuse oci_spec::image::{\n    Descriptor, \n    DescriptorBuilder, \n    ImageManifest, \n    ImageManifestBuilder, \n    MediaType, \n    Sha256Digest,\n    SCHEMA_VERSION\n};\n\nlet config = DescriptorBuilder::default()\n            .media_type(MediaType::ImageConfig)\n            .size(7023u64)\n            .digest(Sha256Digest::from_str(\"b5b2b2c507a0944348e0303114d8d93aaaa081732b86451d9bce1f432a537bc7\").unwrap())\n            .build()\n            .expect(\"build config descriptor\");\n\nlet layers: Vec\u003cDescriptor\u003e = [\n    (\n        32654u64,\n        \"9834876dcfb05cb167a5c24953eba58c4ac89b1adf57f28f2f9d09af107ee8f0\",\n    ),\n    (\n        16724,\n        \"3c3a4604a545cdc127456d94e421cd355bca5b528f4a9c1905b15da2eb4a4c6b\",\n    ),\n    (\n        73109,\n        \"ec4b8955958665577945c89419d1af06b5f7636b4ac3da7f12184802ad867736\",\n    ),\n]\n    .iter()\n    .map(|l| {\n    DescriptorBuilder::default()\n        .media_type(MediaType::ImageLayerGzip)\n        .size(l.0)\n        .digest(Sha256Digest::from_str(l.1).unwrap())\n        .build()\n        .expect(\"build layer\")\n    })\n    .collect();\n\nlet image_manifest = ImageManifestBuilder::default()\n    .schema_version(SCHEMA_VERSION)\n    .config(config)\n    .layers(layers)\n    .build()\n    .expect(\"build image manifest\");\n\nimage_manifest.to_file_pretty(\"my-manifest.json\").unwrap();\n```\n\n- Content of my-manifest.json\n```json\n{\n  \"schemaVersion\": 2,\n  \"config\": {\n    \"mediaType\": \"application/vnd.oci.image.config.v1+json\",\n    \"digest\": \"sha256:b5b2b2c507a0944348e0303114d8d93aaaa081732b86451d9bce1f432a537bc7\",\n    \"size\": 7023\n  },\n  \"layers\": [\n    {\n      \"mediaType\": \"application/vnd.oci.image.layer.v1.tar+gzip\",\n      \"digest\": \"sha256:9834876dcfb05cb167a5c24953eba58c4ac89b1adf57f28f2f9d09af107ee8f0\",\n      \"size\": 32654\n    },\n    {\n      \"mediaType\": \"application/vnd.oci.image.layer.v1.tar+gzip\",\n      \"digest\": \"sha256:3c3a4604a545cdc127456d94e421cd355bca5b528f4a9c1905b15da2eb4a4c6b\",\n      \"size\": 16724\n    },\n    {\n      \"mediaType\": \"application/vnd.oci.image.layer.v1.tar+gzip\",\n      \"digest\": \"sha256:ec4b8955958665577945c89419d1af06b5f7636b4ac3da7f12184802ad867736\",\n      \"size\": 73109\n    }\n  ]\n}\n```\n\n## Distribution Spec Examples\n- Create a list of repositories \n```rust\nuse oci_spec::distribution::RepositoryListBuilder;\n\nlet list = RepositoryListBuilder::default()\n            .repositories(vec![\"busybox\".to_owned()])\n            .build().unwrap();\n```\n\n# Contributing\nThis project welcomes your PRs and issues. Should you wish to work on an issue, please claim it first by commenting on the \nissue that you want to work on it. This is to prevent duplicated efforts from contributors on the same issue.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyouki-dev%2Foci-spec-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyouki-dev%2Foci-spec-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyouki-dev%2Foci-spec-rs/lists"}