docker

package
v0.0.0-...-8e8435b Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractAndVisitLayerContents

func ExtractAndVisitLayerContents(ctx context.Context, layer v1.Layer, lcv LayerContentsVisitor) error

ExtractAndVisitLayerContents uncompresses the layer and traverses the tarball contents calling the supplied visitor on each entry.

func GetRegistryHostname

func GetRegistryHostname(imageRef string) (string, error)

GetRegistryHostname extracts the registry hostname from an image reference. For example: "gcr.io/project/image@sha256:abc..." returns "gcr.io"

func ValidateImageReferenceIsShaDigest

func ValidateImageReferenceIsShaDigest(imageRef string) error

ValidateImageReferenceIsShaDigest validates that an image reference uses SHA256 digest format.

Types

type ImagePuller

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

ImagePuller pulls Docker images from container registries.

func NewImagePuller

func NewImagePuller(authConfig map[string]*RegistryAuth, maxImageSizeBytes int64, pullTimeout time.Duration) *ImagePuller

NewImagePuller creates a new ImagePuller with the specified configuration.

func (*ImagePuller) GetImageFromRef

func (p *ImagePuller) GetImageFromRef(imageRef string) (v1.Image, context.CancelFunc, error)

GetImageFromRef pulls a Docker image by its reference (tag or digest). The returned CancelFunc must be called after we're done using the image.

type LayerContentsVisitor

type LayerContentsVisitor interface {
	OnDirectorySeen(ctx context.Context, path string) error
	OnFileSeen(ctx context.Context, path string, data io.Reader, mode int64) error
	OnLinkSeen(ctx context.Context, path, target string) error
	OnSymlinkSeen(ctx context.Context, path, target string) error
	OnLayerComplete(ctx context.Context) error
}

LayerContentsVisitor is called for each entry (directory, file, link, symlink) found in a Docker layer.

type RegistryAuth

type RegistryAuth struct {
	Username       string
	Password       string
	AnonymousToken bool
}

RegistryAuth holds authentication credentials for a Docker registry.

Jump to

Keyboard shortcuts

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