puller

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func VerifyRootOwned added in v0.19.2

func VerifyRootOwned(rootfsPath string) error

VerifyRootOwned checks that an extracted rootfs really is owned by uid 0.

Extraction runs `sudo tar`/`umoci` and faithfully preserves whatever UIDs the archive carries. If the pull ran inside a nested user namespace — a rootless container, `podman unshare`, distrobox/toolbox, a sandboxed shell — then "root" in that namespace is the invoking host user, and every container-root file lands owned by that user instead of 0. Nothing later in provisioning notices: the container still boots, but `sudo` inside it is broken (`/usr/bin/sudo must be owned by uid 0`), and since the container runs without --private-users, container root IS host root — so the host user can write code that later executes as real root.

Fail loudly here rather than hand back a silently poisoned rootfs.

Types

type DockerPuller

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

DockerPuller pulls and extracts using docker.

func NewDockerPuller added in v0.16.0

func NewDockerPuller() *DockerPuller

func (*DockerPuller) Name

func (c *DockerPuller) Name() string

func (*DockerPuller) PullAndExtract

func (c *DockerPuller) PullAndExtract(r runner.Runner, image string, rootfsPath string, tmpDir string) error

type PodmanPuller

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

PodmanPuller pulls and extracts using podman. For locally-built images (localhost/ prefix) it uses --policy=missing so podman doesn't try to reach a registry that doesn't exist.

func NewPodmanPuller added in v0.16.0

func NewPodmanPuller() *PodmanPuller

func (*PodmanPuller) Name

func (c *PodmanPuller) Name() string

func (*PodmanPuller) PullAndExtract

func (c *PodmanPuller) PullAndExtract(r runner.Runner, image string, rootfsPath string, tmpDir string) error

type Puller

type Puller interface {
	// Name returns a human-readable name for the backend (e.g. "podman").
	Name() string
	// PullAndExtract pulls image from a registry and extracts it to rootfsPath.
	// tmpDir overrides the directory used for intermediate files (e.g. exported
	// tars). When empty, os.TempDir() is used.
	PullAndExtract(r runner.Runner, image string, rootfsPath string, tmpDir string) error
}

Puller pulls a container image from a registry and extracts it to a rootfs directory.

func Detect

func Detect(r runner.Runner) (Puller, error)

Detect returns the first available Puller in preference order: podman, skopeo+umoci, docker. Returns an error if none are available.

type SkopeoPuller

type SkopeoPuller struct{}

SkopeoPuller pulls and extracts using skopeo + umoci.

func (*SkopeoPuller) Name

func (p *SkopeoPuller) Name() string

func (*SkopeoPuller) PullAndExtract

func (p *SkopeoPuller) PullAndExtract(r runner.Runner, image string, rootfsPath string, tmpDir string) error

Jump to

Keyboard shortcuts

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