imageref

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: Apache-2.0 Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package imageref resolves an image tag to the digest it points to now, from any registry speaking the Docker Registry HTTP API v2 (Docker Hub, GHCR, ECR, GitLab, Harbor, …), anonymously or with stored credentials.

Index

Constants

View Source
const (
	DockerHub = "docker.io"
)

DockerHub is Docker Hub's name for credentials; its API is at dockerHubAPI.

Variables

View Source
var ErrNotFound = errors.New("image not found in its registry")

ErrNotFound means the registry has no such repository or tag.

Functions

This section is empty.

Types

type Credentials

type Credentials func(ctx context.Context, host string) (username, password string, ok bool)

Credentials returns the username and password stored for a registry host.

type Ref

type Ref struct {
	Host   string // as credentials name it: "docker.io", "ghcr.io", "registry.example.com:5000"
	Repo   string // "library/nginx", "acme/api"
	Tag    string // "latest" when none
	Digest string // when the reference names one
}

Ref is a parsed image reference.

func Parse

func Parse(image string) (Ref, error)

Parse splits an image reference the way Docker reads it: "nginx" is docker.io/library/nginx:latest.

type Resolver

type Resolver struct {
	HTTP  *http.Client
	Creds Credentials
	// PlainHTTP lists hosts reached over http:// (default: localhost only).
	PlainHTTP func(host string) bool
}

Resolver looks up digests.

func (*Resolver) Digest

func (r *Resolver) Digest(ctx context.Context, image string) (string, error)

Digest returns the digest image's tag points to now ("sha256:…"): the one `docker pull` of the tag would get, for every platform.

Jump to

Keyboard shortcuts

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