oci

package
v3.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 2, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExportImage

func ExportImage(ctx context.Context, imageRef, destDir, platform string) ([]ocispec.Descriptor, []byte, []byte, error)

ExportImage exports one platform of a Docker image to an OCI layout directory. Returns layer descriptors, manifest bytes, and config bytes.

platform selects which one when the daemon holds several; empty means let the daemon choose, which is what it did before this was selectable.

func ImportImage

func ImportImage(ctx context.Context, srcDir string, imageRef string) error

ImportImage loads an OCI image from a local directory into the Docker daemon. It creates a Docker-compatible tar from the OCI layout and calls docker load.

func LocalPlatforms

func LocalPlatforms(ctx context.Context, imageRef string) ([]string, error)

LocalPlatforms reports the platforms of imageRef that the daemon actually holds, as "os/arch" or "os/arch/variant".

It returns nil when the daemon has no per-platform view of the image, which is the normal case: the classic image store keeps one platform per tag, and only the containerd image store can hold several. Attestation manifests are excluded — buildx attaches SBOM and provenance as manifests with platform "unknown/unknown", and publishing those as platforms would be nonsense.

func ParseManifest

func ParseManifest(data []byte) (ocispec.Manifest, error)

ParseManifest parses raw JSON bytes into an OCI Manifest.

func ParsePlatform

func ParsePlatform(s string) (ocispec.Platform, error)

ParsePlatform turns "linux/arm64" or "linux/arm/v7" into an OCI platform.

func PlatformString

func PlatformString(p ocispec.Platform) string

PlatformString renders an OCI platform the way the CLI accepts it.

func SerializeManifest

func SerializeManifest(m ocispec.Manifest) ([]byte, error)

SerializeManifest serializes an OCI Manifest to JSON bytes.

func WriteOCILayout

func WriteOCILayout(dir string, manifestBytes []byte, configBytes []byte) error

WriteOCILayout writes manifest.json, config.json, and index.json to an OCI layout directory.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL