dockerschema2

package
v0.0.0-...-791c70a Latest Latest
Warning

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

Go to latest
Published: May 6, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package dockerschema2 provides a type for parsing and serializing Docker Schema 2 manifest files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UnmarshalImageManifest

func UnmarshalImageManifest(b []byte) (manifest.Manifest, imgspecv1.Descriptor, error)

UnmarshalImageManifest parses a Docker image manifest from the given byte slice.

func UnmarshalManifestList

func UnmarshalManifestList(b []byte) (manifest.Manifest, imgspecv1.Descriptor, error)

UnmarshalManifestList parses a Docker image manifest list from the given byte slice.

Types

type DeserializedManifest

type DeserializedManifest struct {
	Manifest
	// contains filtered or unexported fields
}

DeserializedManifest wraps ManifestList with a copy of the original JSON.

func (DeserializedManifest) Config

Config returns a descriptor of the separate image config blob.

func (DeserializedManifest) Layers

Layers returns a list of LayerDescriptors of layers referenced by the image. Ordered from the root layer first (oldest) to the top layer at last (latest).

func (*DeserializedManifest) MarshalJSON

func (m *DeserializedManifest) MarshalJSON() ([]byte, error)

MarshalJSON returns the contents of canonical. If canonical is empty, marshals the inner contents.

func (DeserializedManifest) Payload

func (m DeserializedManifest) Payload() ([]byte, error)

Payload returns the raw content of the manifest list. The contents can be used to calculate the content identifier.

func (*DeserializedManifest) UnmarshalJSON

func (m *DeserializedManifest) UnmarshalJSON(b []byte) error

UnmarshalJSON populates a new ManifestList struct from JSON data.

type DeserializedManifestList

type DeserializedManifestList struct {
	ManifestList
	// contains filtered or unexported fields
}

DeserializedManifestList wraps ManifestList with a copy of the original JSON.

func (DeserializedManifestList) Manifests

Manifests returns a list of all child manifest descriptors.

func (*DeserializedManifestList) MarshalJSON

func (m *DeserializedManifestList) MarshalJSON() ([]byte, error)

MarshalJSON returns the contents of canonical. If canonical is empty, marshals the inner contents.

func (DeserializedManifestList) Payload

func (m DeserializedManifestList) Payload() ([]byte, error)

Payload returns the raw content of the manifest list. The contents can be used to calculate the content identifier.

func (*DeserializedManifestList) UnmarshalJSON

func (m *DeserializedManifestList) UnmarshalJSON(b []byte) error

UnmarshalJSON populates a new ManifestList struct from JSON data.

type Manifest

type Manifest struct {
	manifest.Versioned

	// Config references the image configuration as a blob.
	Config imgspecv1.Descriptor `json:"config"`

	// Layers lists descriptors for the layers referenced by the
	// configuration.
	Layers []imgspecv1.Descriptor `json:"layers"`
}

Manifest defines a docker version2 schema2 manifest.

func (Manifest) MediaType

func (m Manifest) MediaType() string

MediaType returns the media type of current manifest object.

func (Manifest) References

func (m Manifest) References() []imgspecv1.Descriptor

References returns a list of objects which make up this manifest. A reference is anything which can be represented by a imgspecv1.Descriptor. These can consist of layers, resources or other manifests.

While no particular order is required, implementations should return them from highest to lowest priority. For example, one might want to return the base layer before the top layer.

type ManifestDescriptor

type ManifestDescriptor struct {
	imgspecv1.Descriptor

	// Platform specifies which platform the manifest pointed to by the
	// descriptor runs on.
	Platform PlatformSpec `json:"platform"`
}

ManifestDescriptor references a platform-specific manifest.

type ManifestList

type ManifestList struct {
	manifest.Versioned

	// Manifests references a list of manifests
	Manifests []ManifestDescriptor `json:"manifests"`
}

ManifestList references manifests for various platforms.

func (ManifestList) MediaType

func (m ManifestList) MediaType() string

MediaType returns the media type of current manifest object.

func (ManifestList) References

func (m ManifestList) References() []imgspecv1.Descriptor

References returns the distribution descriptors for the referenced image manifests.

type PlatformSpec

type PlatformSpec struct {
	// Architecture field specifies the CPU architecture, for example
	// `amd64` or `ppc64`.
	Architecture string `json:"architecture"`

	// OS specifies the operating system, for example `linux` or `windows`.
	OS string `json:"os"`

	// OSVersion is an optional field specifying the operating system
	// version, for example `10.0.10586`.
	OSVersion string `json:"os.version,omitempty"`

	// OSFeatures is an optional field specifying an array of strings,
	// each listing a required OS feature (for example on Windows `win32k`).
	OSFeatures []string `json:"os.features,omitempty"`

	// Variant is an optional field specifying a variant of the CPU, for
	// example `ppc64le` to specify a little-endian version of a PowerPC CPU.
	Variant string `json:"variant,omitempty"`

	// Features is an optional field specifying an array of strings, each
	// listing a required CPU feature (for example `sse4` or `aes`).
	Features []string `json:"features,omitempty"`
}

PlatformSpec specifies a platform where a particular image manifest is applicable.

With additional `Features` field compared to imgspecv1.Platform

Jump to

Keyboard shortcuts

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