Movatterモバイル変換


[0]ホーム

URL:


registry

package
v28.5.2+incompatibleLatest Latest
Warning

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

Go to latest
Published: Nov 5, 2025 License:Apache-2.0Imports:31Imported by:3,276

Details

Repository

github.com/docker/docker

Links

Documentation

Overview

Package registry contains client primitives to interact with a remote Docker registry.

Index

Constants

View Source
const (// DefaultNamespace is the default namespaceDefaultNamespace = "docker.io"// DefaultRegistryHost is the hostname for the default (Docker Hub) registry// used for pushing and pulling images. This hostname is hard-coded to handle// the conversion from image references without registry name (e.g. "ubuntu",// or "ubuntu:latest"), as well as references using the "docker.io" domain// name, which is used as canonical reference for images on Docker Hub, but// does not match the domain-name of Docker Hub's registry.DefaultRegistryHost = "registry-1.docker.io"// IndexHostname is the index hostname, used for authentication and image search.IndexHostname = "index.docker.io"// IndexServer is used for user auth and image searchIndexServer = "https://" +IndexHostname + "/v1/"// IndexName is the name of the indexIndexName = "docker.io")

TODO(thaJeztah) both the "index.docker.io" and "registry-1.docker.io" domainsare here for historic reasons and backward-compatibility. These domainsare still supported by Docker Hub (and will continue to be supported), butthere are new domains already in use, and plans to consolidate all legacydomains to new "canonical" domains. Once those domains are decided on, weshould update these consts (but making sure to preserve compatibility withexisting installs, clients, and user configuration).

View Source
const AuthClientID = "docker"

AuthClientID is used the ClientID used for the token server

Variables

View Source
var (// DefaultV2Registry is the URI of the default (Docker Hub) registry.DefaultV2Registry = &url.URL{Scheme: "https",Host:DefaultRegistryHost,})

Functions

funcCertsDiradded inv1.8.0

func CertsDir()string

CertsDir is the directory where certificates are stored.

funcConvertToHostnameadded inv1.13.0

func ConvertToHostname(urlstring)string

ConvertToHostname normalizes a registry URL which has http|https prependedto just its hostname. It is used to match credentials, which may be eitherstored as hostname or as hostname including scheme (in legacy configurationfiles).

funcGetAuthConfigKeyadded inv1.10.0

func GetAuthConfigKey(index *registry.IndexInfo)string

GetAuthConfigKey special-cases using the full index address of the officialindex as the AuthConfig key, and uses the (host)name[:port] for private indexes.

funcHeaders

func Headers(userAgentstring, metaHeadershttp.Header) []transport.RequestModifier

Headers returns request modifiers with a User-Agent and metaHeaders

funcHostCertsDirdeprecated

func HostCertsDir(hostnamestring)string

HostCertsDir returns the config directory for a specific host.

Deprecated: this function was only used internally, and will be removed in a future release.

funcNewStaticCredentialStoreadded inv1.12.0

func NewStaticCredentialStore(auth *registry.AuthConfig)auth.CredentialStore

NewStaticCredentialStore returns a credential storewhich always returns the same credential values.

funcParseSearchIndexInfoadded inv1.10.0

func ParseSearchIndexInfo(reposNamestring) (*registry.IndexInfo,error)

ParseSearchIndexInfo will use repository name to get back an indexInfo.

TODO(thaJeztah) this function is only used by the CLI, and used to getinformation of the registry (to provide credentials if needed). We shouldmove this function (or equivalent) to the CLI, as it's doing too much justfor that.

funcPingV2Registryadded inv1.11.0

func PingV2Registry(endpoint *url.URL, transporthttp.RoundTripper) (challenge.Manager,error)

PingV2Registry attempts to ping a v2 registry and on success return achallenge manager for the supported authentication types.If a response is received but cannot be interpreted, a PingResponseError will be returned.

funcReadCertsDirectoryadded inv1.8.0

func ReadCertsDirectory(tlsConfig *tls.Config, directorystring)error

ReadCertsDirectory reads the directory for TLS certificatesincluding roots and certificate pairs and updates theprovided TLS configuration.

funcResolveAuthConfigadded inv1.7.0

func ResolveAuthConfig(authConfigs map[string]registry.AuthConfig, index *registry.IndexInfo)registry.AuthConfig

ResolveAuthConfig matches an auth configuration to a server address or a URL

funcSetCertsDirdeprecated

func SetCertsDir(pathstring)

SetCertsDir allows the default certs directory to be changed. This functionis used at daemon startup to set the correct location when running inrootless mode.

Deprecated: the cert-directory is now automatically selected when running with rootlessKit, and should no longer be set manually.

funcValidateIndexNameadded inv1.5.0

func ValidateIndexName(valstring) (string,error)

ValidateIndexName validates an index name. It is used by the daemon tovalidate the daemon configuration.

funcValidateMirroradded inv1.5.0

func ValidateMirror(mirrorURLstring) (string,error)

ValidateMirror validates and normalizes an HTTP(S) registry mirror. Itreturns an error if the given mirrorURL is invalid, or the normalizedformat for the URL otherwise.

It is used by the daemon to validate the daemon configuration.

Types

typeAPIEndpointadded inv1.8.0

type APIEndpoint struct {MirrorboolURL                            *url.URLAllowNondistributableArtifactsbool// Deprecated: non-distributable artifacts are deprecated and enabled by default. This field will be removed in the next release.Officialbool// Deprecated: this field was only used internally, and will be removed in the next release.TrimHostnamebool// Deprecated: hostname is now trimmed unconditionally for remote names. This field will be removed in the next release.TLSConfig                      *tls.Config}

APIEndpoint represents a remote API endpoint

typePingResponseErroradded inv1.11.0

type PingResponseError struct {Errerror}

PingResponseError is used when the response from a pingwas received but invalid.

func (PingResponseError)Erroradded inv1.11.0

func (errPingResponseError) Error()string

typeRepositoryInfoadded inv1.5.0

type RepositoryInfo struct {Namereference.Named// Index points to registry informationIndex *registry.IndexInfo// Official indicates whether the repository is considered official.// If the registry is official, and the normalized name does not// contain a '/' (e.g. "foo"), then it is considered an official repo.//// Deprecated: this field is no longer used and will be removed in the next release. The information captured in this field can be obtained from the [Name] field instead.Officialbool// Class represents the class of the repository, such as "plugin"// or "image".//// Deprecated: this field is no longer used, and will be removed in the next release.Classstring}

RepositoryInfo describes a repository

funcParseRepositoryInfoadded inv1.5.0

func ParseRepositoryInfo(reposNamereference.Named) (*RepositoryInfo,error)

ParseRepositoryInfo performs the breakdown of a repository name into aRepositoryInfo, but lacks registry configuration.

It is used by the Docker cli to interact with registry-related endpoints.

typeServiceadded inv0.11.0

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

Service is a registry service. It tracks configuration data such as a listof mirrors.

funcNewServiceadded inv0.11.0

func NewService(optionsServiceOptions) (*Service,error)

NewService returns a new instance ofService ready to be installed intoan engine.

func (*Service)Authadded inv0.11.0

func (s *Service) Auth(ctxcontext.Context, authConfig *registry.AuthConfig, userAgentstring) (statusMessage, tokenstring, _error)

Auth contacts the public registry with the provided credentials,and returns OK if authentication was successful.It can be used to verify the validity of a client's credentials.

func (*Service)IsInsecureRegistry

func (s *Service) IsInsecureRegistry(hoststring)bool

IsInsecureRegistry returns true if the registry at given host is configured asinsecure registry.

func (*Service)LookupPullEndpointsadded inv1.8.0

func (s *Service) LookupPullEndpoints(hostnamestring) ([]APIEndpoint,error)

LookupPullEndpoints creates a list of v2 endpoints to try to pull from, in order of preference.It gives preference to mirrors over the actual registry, and HTTPS over plain HTTP.

func (*Service)LookupPushEndpointsadded inv1.8.0

func (s *Service) LookupPushEndpoints(hostnamestring) ([]APIEndpoint,error)

LookupPushEndpoints creates a list of v2 endpoints to try to push to, in order of preference.It gives preference to HTTPS over plain HTTP. Mirrors are not included.

func (*Service)ReplaceConfig

func (s *Service) ReplaceConfig(optionsServiceOptions) (commit func(), _error)

ReplaceConfig prepares a transaction which will atomically replace theregistry service's configuration when the returned commit function is called.

func (*Service)ResolveAuthConfig

func (s *Service) ResolveAuthConfig(authConfigs map[string]registry.AuthConfig, refreference.Named)registry.AuthConfig

ResolveAuthConfig looks up authentication for the given reference from thegiven authConfigs.

IMPORTANT: This function is for internal use and should not be used by external projects.

func (*Service)ResolveRepositorydeprecatedadded inv1.5.0

func (s *Service) ResolveRepository(namereference.Named) (*RepositoryInfo,error)

ResolveRepository splits a repository name into its componentsand configuration of the associated registry.

Deprecated: this function was only used internally and is no longer used. It will be removed in the next release.

func (*Service)Searchadded inv0.11.0

func (s *Service) Search(ctxcontext.Context, searchFiltersfilters.Args, termstring, limitint, authConfig *registry.AuthConfig, headers map[string][]string) ([]registry.SearchResult,error)

Search queries the public registry for repositories matching the specifiedsearch term and filters.

func (*Service)ServiceConfigadded inv1.11.0

func (s *Service) ServiceConfig() *registry.ServiceConfig

ServiceConfig returns a copy of the public registry service's configuration.

typeServiceOptionsadded inv1.11.0

type ServiceOptions struct {Mirrors            []string `json:"registry-mirrors,omitempty"`InsecureRegistries []string `json:"insecure-registries,omitempty"`}

ServiceOptions holds command line options.

Source Files

View all Source files

Directories

PathSynopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp