All Projects → containers → oci-spec-rs

containers / oci-spec-rs

Licence: Apache-2.0 license
OCI Runtime, Image and Distribution Spec in Rust

Programming Languages

rust
11053 projects
shell
77523 projects

Labels

Projects that are alternatives of or similar to oci-spec-rs

Dockerspec
A small Ruby Gem to run RSpec and Serverspec, Infrataster and Capybara tests against Dockerfiles or Docker images easily.
Stars: ✭ 181 (+54.7%)
Mutual labels:  spec
terraform-oci-compute-instance
Terraform Module for creating Oracle Cloud Infrastructure compute instances
Stars: ✭ 29 (-75.21%)
Mutual labels:  oci
dropbox-api-spec
The Official API Spec for Dropbox API V2 SDKs.
Stars: ✭ 36 (-69.23%)
Mutual labels:  spec
Hjson
Hjson, a user interface for JSON
Stars: ✭ 2,330 (+1891.45%)
Mutual labels:  spec
Specs
The Filecoin protocol specification
Stars: ✭ 249 (+112.82%)
Mutual labels:  spec
vilicus
Vilicus is an open source tool that orchestrates security scans of container images(docker/oci) and centralizes all results into a database for further analysis and metrics.
Stars: ✭ 82 (-29.91%)
Mutual labels:  oci
Pinpointer
Pinpointer is yet another clojure.spec error reporter based on a precise error analysis
Stars: ✭ 92 (-21.37%)
Mutual labels:  spec
speck
A concise and composable syntax for your function specs
Stars: ✭ 53 (-54.7%)
Mutual labels:  spec
filegrain
transport-agnostic, fine-grained content-addressable container image layout
Stars: ✭ 23 (-80.34%)
Mutual labels:  oci
project-template
Template Files for New OCI Projects
Stars: ✭ 14 (-88.03%)
Mutual labels:  oci
Inspec
InSpec: Auditing and Testing Framework
Stars: ✭ 2,450 (+1994.02%)
Mutual labels:  spec
Jasmine Spec Reporter
Real time console spec reporter for jasmine testing framework
Stars: ✭ 241 (+105.98%)
Mutual labels:  spec
spec-pattern
Specification design pattern for JavaScript and TypeScript with bonus classes
Stars: ✭ 43 (-63.25%)
Mutual labels:  spec
Proposals
Tracking ECMAScript Proposals
Stars: ✭ 14,444 (+12245.3%)
Mutual labels:  spec
fullmetalupdate
FullMetalUpdate Python client application.
Stars: ✭ 19 (-83.76%)
Mutual labels:  oci
Unwalled.garden
Schemas for a p2p social-media network built on the Dat Web.
Stars: ✭ 126 (+7.69%)
Mutual labels:  spec
api-spec
API Specififications
Stars: ✭ 30 (-74.36%)
Mutual labels:  spec
geojson.specs
a Geojson utility for validating data using Clojure(script)'s spec (RFC 7946)
Stars: ✭ 18 (-84.62%)
Mutual labels:  spec
hauler
Airgap Swiss Army Knife
Stars: ✭ 44 (-62.39%)
Mutual labels:  oci
oci-compute-jenkins-plugin
Jenkins Plugin for Oracle Cloud Infrastructure (Compute)
Stars: ✭ 12 (-89.74%)
Mutual labels:  oci

oci-spec-rs

ci gh-pages crates.io codecov docs docs.rs dependencies license

Open Container Initiative (OCI) Specifications for Rust

This library provides a convenient way to interact with the specifications defined by the Open Container Initiative (OCI).

[dependencies]
oci-spec = "0.5.8"

Compiler support: requires rustc 1.54+

If you want to propose or cut a new release, then please follow our release process documentation.

Image Format Spec Examples

  • Load image manifest from filesystem
use oci_spec::image::ImageManifest;

let image_manifest = ImageManifest::from_file("manifest.json").unwrap();
assert_eq!(image_manifest.layers().len(), 5);
  • Create new image manifest using builder
use oci_spec::image::{
    Descriptor, 
    DescriptorBuilder, 
    ImageManifest, 
    ImageManifestBuilder, 
    MediaType, 
    SCHEMA_VERSION
};

let config = DescriptorBuilder::default()
            .media_type(MediaType::ImageConfig)
            .size(7023)
            .digest("sha256:b5b2b2c507a0944348e0303114d8d93aaaa081732b86451d9bce1f432a537bc7")
            .build()
            .expect("build config descriptor");

let layers: Vec<Descriptor> = [
    (
        32654,
        "sha256:9834876dcfb05cb167a5c24953eba58c4ac89b1adf57f28f2f9d09af107ee8f0",
    ),
    (
        16724,
        "sha256:3c3a4604a545cdc127456d94e421cd355bca5b528f4a9c1905b15da2eb4a4c6b",
    ),
    (
        73109,
        "sha256:ec4b8955958665577945c89419d1af06b5f7636b4ac3da7f12184802ad867736",
    ),
]
    .iter()
    .map(|l| {
    DescriptorBuilder::default()
        .media_type(MediaType::ImageLayerGzip)
        .size(l.0)
        .digest(l.1.to_owned())
        .build()
        .expect("build layer")
    })
    .collect();

let image_manifest = ImageManifestBuilder::default()
    .schema_version(SCHEMA_VERSION)
    .config(config)
    .layers(layers)
    .build()
    .expect("build image manifest");

image_manifest.to_file_pretty("my-manifest.json").unwrap();
  • Content of my-manifest.json
{
  "schemaVersion": 2,
  "config": {
    "mediaType": "application/vnd.oci.image.config.v1+json",
    "digest": "sha256:b5b2b2c507a0944348e0303114d8d93aaaa081732b86451d9bce1f432a537bc7",
    "size": 7023
  },
  "layers": [
    {
      "mediaType": "application/vnd.oci.image.layer.v1.tar+gzip",
      "digest": "sha256:9834876dcfb05cb167a5c24953eba58c4ac89b1adf57f28f2f9d09af107ee8f0",
      "size": 32654
    },
    {
      "mediaType": "application/vnd.oci.image.layer.v1.tar+gzip",
      "digest": "sha256:3c3a4604a545cdc127456d94e421cd355bca5b528f4a9c1905b15da2eb4a4c6b",
      "size": 16724
    },
    {
      "mediaType": "application/vnd.oci.image.layer.v1.tar+gzip",
      "digest": "sha256:ec4b8955958665577945c89419d1af06b5f7636b4ac3da7f12184802ad867736",
      "size": 73109
    }
  ]
}

Distribution Spec Examples

  • Create a list of repositories
use oci_spec::distribution::RepositoryListBuilder;

let list = RepositoryListBuilder::default()
            .repositories(vec!["busybox".to_owned()])
            .build().unwrap();

Contributing

This project welcomes your PRs and issues. Should you wish to work on an issue, please claim it first by commenting on the issue that you want to work on it. This is to prevent duplicated efforts from contributers on the same issue.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].