image

package
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Created      FlexString  `json:"created,omitempty"`
	Author       string      `json:"author,omitempty"`
	Architecture string      `json:"architecture"`
	OS           string      `json:"os"`
	Config       ImageConfig `json:"config"`
	RootFS       RootFS      `json:"rootfs"`
	History      []History   `json:"history,omitempty"`
}

Config represents an OCI image configuration.

type FlexString added in v0.9.3

type FlexString string

FlexString is a string that can be unmarshaled from either a JSON string or an int64 (unix timestamp). Docker image configs use RFC3339 strings, while OCI image configs may use int64 unix timestamps.

func (*FlexString) UnmarshalJSON added in v0.9.3

func (fs *FlexString) UnmarshalJSON(data []byte) error

type HealthCheckConfig

type HealthCheckConfig struct {
	Test        []string `json:"Test,omitempty"`
	Interval    int64    `json:"Interval,omitempty"`
	Timeout     int64    `json:"Timeout,omitempty"`
	Retries     int      `json:"Retries,omitempty"`
	StartPeriod int64    `json:"StartPeriod,omitempty"`
}

HealthCheckConfig describes a container's health check.

type History

type History struct {
	Id         string     `json:"Id,omitempty"`
	Created    FlexString `json:"created,omitempty"`
	CreatedBy  string     `json:"created_by,omitempty"`
	Size       int64      `json:"Size,omitempty"`
	Comment    string     `json:"comment,omitempty"`
	EmptyLayer bool       `json:"empty_layer,omitempty"`
}

History describes the history of an image layer.

type ImageConfig

type ImageConfig struct {
	User         string              `json:"User,omitempty"`
	ExposedPorts map[string]struct{} `json:"ExposedPorts,omitempty"`
	Env          []string            `json:"Env,omitempty"`
	Entrypoint   []string            `json:"Entrypoint,omitempty"`
	Cmd          []string            `json:"Cmd,omitempty"`
	Volumes      map[string]struct{} `json:"Volumes,omitempty"`
	WorkingDir   string              `json:"WorkingDir,omitempty"`
	Labels       map[string]string   `json:"Labels,omitempty"`
	StopSignal   string              `json:"StopSignal,omitempty"`
	Shell        []string            `json:"Shell,omitempty"`
	HealthCheck  *HealthCheckConfig  `json:"Healthcheck,omitempty"`
}

ImageConfig is the runtime configuration for a container.

type ImageRecord

type ImageRecord struct {
	ID           string               `json:"id"`
	RepoTags     []string             `json:"repo_tags"`
	RepoDigests  []string             `json:"repo_digests"`
	Parent       string               `json:"parent,omitempty"`
	Config       *Config              `json:"config"`
	Manifest     *registry.ManifestV2 `json:"manifest,omitempty"`
	Size         int64                `json:"size"`
	Created      int64                `json:"created"`
	Architecture string               `json:"architecture"`
	OS           string               `json:"os"`
	Layers       []string             `json:"layers"`
}

ImageRecord stores image metadata on disk.

type RootFS

type RootFS struct {
	Type    string   `json:"type"`
	DiffIDs []string `json:"diff_ids"`
}

RootFS describes the image's root filesystem.

type SearchResult

type SearchResult struct {
	Name        string `json:"Name"`
	Description string `json:"Description"`
	StarCount   int    `json:"StarCount"`
	IsOfficial  bool   `json:"IsOfficial"`
	IsAutomated bool   `json:"IsAutomated"`
}

SearchResult represents a Docker Hub search result.

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store manages OCI images on disk.

func NewStore

func NewStore(root string) (*Store, error)

NewStore creates a new image store.

func (*Store) Config

func (s *Store) Config(idOrTag string) (*Config, error)

Config returns the OCI image configuration.

func (*Store) Exists

func (s *Store) Exists(idOrTag string) bool

Exists checks if an image exists locally.

func (*Store) Export

func (s *Store) Export(idOrTag string, writer io.Writer) error

Export exports an image to a Docker-format save tar.

func (*Store) Get

func (s *Store) Get(idOrTag string) (*ImageRecord, error)

Get returns an image record by ID or tag.

func (*Store) GetLayerPath

func (s *Store) GetLayerPath(digest string) string

GetLayerPath returns the path to a layer blob on disk.

func (*Store) GetLayerPaths

func (s *Store) GetLayerPaths(idOrTag string) ([]string, error)

GetLayerPaths returns paths to all layer tarballs for an image.

func (*Store) History

func (s *Store) History(idOrTag string) ([]History, error)

History returns the image build history.

func (*Store) Import

func (s *Store) Import(reader io.Reader) (*ImageRecord, error)

Import imports an image from a Docker-format save tar.

func (*Store) Inspect

func (s *Store) Inspect(idOrTag string) (*Config, error)

Inspect returns the full image config.

func (*Store) List

func (s *Store) List() ([]common.ImageInfo, error)

List returns all locally stored images.

func (*Store) Prune

func (s *Store) Prune() ([]string, error)

Prune removes unused images.

func (*Store) Pull

func (s *Store) Pull(imageRef string) (*ImageRecord, error)

Pull downloads an image from a registry.

func (*Store) Push

func (s *Store) Push(idOrTag string) error

Push uploads an image to a registry.

func (*Store) Remove

func (s *Store) Remove(idOrTag string) error

Remove removes an image.

func (*Store) SaveRecord

func (s *Store) SaveRecord(record *ImageRecord) error

func (*Store) Search

func (s *Store) Search(term string, limit int) ([]SearchResult, error)

Search searches Docker Hub for images.

func (*Store) SetRegistryAuth

func (s *Store) SetRegistryAuth(username, password string)

func (*Store) StartGC

func (s *Store) StartGC(ctx context.Context, interval time.Duration, maxAge time.Duration)

StartGC starts periodic garbage collection of unused blobs.

func (*Store) Tag

func (s *Store) Tag(source, target string) error

Tag adds a tag to an existing image.

Jump to

Keyboard shortcuts

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