Help us shape the future of Go! Take the 2026 Go Developer Survey

oci

package
v5.6.1 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ComposeProjectArtifactType is the OCI 1.1-compliant artifact type value
	// for the generated image manifest.
	ComposeProjectArtifactType = "application/vnd.docker.compose.project"
	// ComposeYAMLMediaType is the media type for each layer (Compose file)
	// in the image manifest.
	ComposeYAMLMediaType = "application/vnd.docker.compose.file+yaml"
	// ComposeEmptyConfigMediaType is a media type used for the config descriptor
	// when doing OCI 1.0-style pushes.
	//
	// The content is always `{}`, the same as a normal empty descriptor, but
	// the specific media type allows clients to fall back to the config media
	// type to recognize the manifest as a Compose project since the artifact
	// type field is not available in OCI 1.0.
	//
	// This is based on guidance from the OCI 1.1 spec:
	//	> Implementers note: artifacts have historically been created without
	// 	> an artifactType field, and tooling to work with artifacts should
	//	> fallback to the config.mediaType value.
	ComposeEmptyConfigMediaType = "application/vnd.docker.compose.config.empty.v1+json"
	// ComposeEnvFileMediaType is the media type for each Env File layer in the image manifest.
	ComposeEnvFileMediaType = "application/vnd.docker.compose.envfile"
)

Variables

This section is empty.

Functions

func Copy

func Copy(ctx context.Context, resolver remotes.Resolver, image reference.Named, named reference.Named) (spec.Descriptor, error)

func DescriptorForComposeFile

func DescriptorForComposeFile(path string, content []byte) v1.Descriptor

func DescriptorForEnvFile

func DescriptorForEnvFile(path string, content []byte) v1.Descriptor

func Get

func Get(ctx context.Context, resolver remotes.Resolver, ref reference.Named) (spec.Descriptor, []byte, error)

Get retrieves a Named OCI resource and returns OCI Descriptor and Manifest

func GetBlob added in v5.4.0

func GetBlob(ctx context.Context, resolver remotes.Resolver, ref reference.Named, descriptor spec.Descriptor) ([]byte, error)

GetBlob retrieves the content of a blob descriptor (e.g. an artifact layer) from the repository ref belongs to. Unlike Get it doesn't Resolve the digest, as the registry manifests endpoint only serves actual manifests; blob content must be fetched directly from the blobs endpoint.

func NewResolver

func NewResolver(config *configfile.ConfigFile, transport http.RoundTripper, insecureRegistries ...string) remotes.Resolver

NewResolver sets up an OCI Resolver based on docker/cli config to provide registry credentials. When transport is non-nil it is used as the HTTP transport for both registry calls and the authorizer's token fetches (e.g. to route both through Docker Desktop's PAC-aware proxy); nil falls back to containerd's default transport.

func Push

func Push(ctx context.Context, resolver remotes.Resolver, ref reference.Named, descriptor spec.Descriptor) error

func PushManifest

func PushManifest(ctx context.Context, resolver remotes.Resolver, named reference.Named, layers []v1.Descriptor, ociVersion api.OCIVersion) (v1.Descriptor, bool, error)

PushManifest pushes the manifest for a Compose OCI artifact. The returned bool reports whether the push fell back from OCI 1.1 to OCI 1.0; it is only meaningful when err == nil.

Types

This section is empty.

Jump to

Keyboard shortcuts

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