image

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package image copies and flattens a container image's filesystem to a local directory using skopeo, and reports the image configuration.

Flattening is faithful enough to reason about what the image actually ships: whiteouts are applied (so a file deleted by a later layer is really gone), symlinks are recreated as symlinks (so shared-library soname resolution can follow them), and hardlinks are materialized. Extraction is hostile-input safe: every entry path is resolved inside the destination root, so a layer containing a symlink to /etc cannot write through it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Extractor

type Extractor struct {
	// OS and Arch select the platform variant to pull (default linux/amd64).
	OS   string
	Arch string
	// SkopeoPath overrides the skopeo binary (default: found on PATH).
	SkopeoPath string
}

Extractor flattens container images.

func NewExtractor

func NewExtractor() *Extractor

NewExtractor returns an Extractor with linux/amd64 defaults.

func (*Extractor) Extract

func (e *Extractor) Extract(ctx context.Context, ref, dest string) (*target.Image, error)

Extract copies ref into a temporary OCI dir with skopeo and untars every layer, in order, into dest. Later layers overwrite earlier ones and their whiteouts delete from earlier ones, yielding the final image filesystem state. The returned Image owns no resources: dest stays the caller's to clean up.

Jump to

Keyboard shortcuts

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