Help us shape the future of Go! Take the 2026 Go Developer Survey

registrylimit

package
v0.17.2 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2026 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package registrylimit says what to do when a registry refuses an image because this server has downloaded too many.

Docker Hub limits downloads: 100 every 6 hours from one IPv4 address (or IPv6 /64) without signing in, 200 for a signed-in Personal account, none on a paid plan. A manifest GET counts; a HEAD does not; a multi-platform image counts once per platform pulled. Other registries limit too, with a 429 and the OCI distribution code TOOMANYREQUESTS.

The refusal reaches Pando four ways — the registry read before a deploy (core/oci), the Docker daemon's pull, a Kubernetes node's pull and a BuildKit build's base image — and each says the same thing (R-105), so the wording lives here, in a leaf package core and the adapters can both import.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DockerHub

func DockerHub(host string) bool

DockerHub reports whether a registry host is Docker Hub, under any of the names it answers to.

func Host

func Host(image string) string

Host is the registry an image reference names, docker.io when it names none.

func Mentioned

func Mentioned(text string) bool

Mentioned reports whether an error's text is a registry's rate-limit refusal: the distribution error code, or the HTTP status as Docker, the kubelet and BuildKit print it.

func RetryAt

func RetryAt(h http.Header, now time.Time) time.Time

RetryAt reads when a 429 response says to try again: Retry-After, in seconds or as a date, then the ratelimit-reset header (seconds from now, or a Unix time). Zero when neither is there.

Types

type Refusal

type Refusal struct {
	// Registry is the registry's host, as the reference or the error named it.
	// Empty when neither said.
	Registry string
	// Image is the reference refused, empty when it is not known.
	Image string
	// RetryAt is when the registry said it accepts downloads again; zero when
	// it did not say.
	RetryAt time.Time
	Signed  Signed
	// Build is a base image a build needed. BuildKit pulls those without the
	// app's credential, so adding one does not help.
	Build bool
}

Refusal is one registry refusing a download for its rate limit.

func FromText

func FromText(text, image string) Refusal

FromText reads a refusal out of an error's text. image is the reference the caller pulled, or empty for a build, where the text names the base image.

func (Refusal) Error

func (r Refusal) Error(now time.Time, cause error) *errs.Error

Error is the refusal as a person reads it (R-105). now places RetryAt.

type Signed

type Signed int

Signed says whose limit was reached.

const (
	// Unknown: the caller cannot tell whether a credential was used.
	Unknown Signed = iota
	// Anonymous: no credential, so the limit is this server's address.
	Anonymous
	// SignedIn: the app's registry credential was used, so the limit is that
	// account's.
	SignedIn
)

Jump to

Keyboard shortcuts

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