registry
packageThis package is not in the latest version of its module.
Details
Valid go.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
Documentation¶
Overview¶
Package registry contains client primitives to interact with a remote Docker registry.
Index¶
- Constants
- Variables
- func CertsDir() string
- func ConvertToHostname(url string) string
- func GetAuthConfigKey(index *registry.IndexInfo) string
- func Headers(userAgent string, metaHeaders http.Header) []transport.RequestModifier
- func HostCertsDir(hostname string) stringdeprecated
- func NewStaticCredentialStore(auth *registry.AuthConfig) auth.CredentialStore
- func ParseSearchIndexInfo(reposName string) (*registry.IndexInfo, error)
- func PingV2Registry(endpoint *url.URL, transport http.RoundTripper) (challenge.Manager, error)
- func ReadCertsDirectory(tlsConfig *tls.Config, directory string) error
- func ResolveAuthConfig(authConfigs map[string]registry.AuthConfig, index *registry.IndexInfo) registry.AuthConfig
- func SetCertsDir(path string)deprecated
- func ValidateIndexName(val string) (string, error)
- func ValidateMirror(mirrorURL string) (string, error)
- type APIEndpoint
- type PingResponseError
- type RepositoryInfo
- type Service
- func (s *Service) Auth(ctx context.Context, authConfig *registry.AuthConfig, userAgent string) (statusMessage, token string, _ error)
- func (s *Service) IsInsecureRegistry(host string) bool
- func (s *Service) LookupPullEndpoints(hostname string) ([]APIEndpoint, error)
- func (s *Service) LookupPushEndpoints(hostname string) ([]APIEndpoint, error)
- func (s *Service) ReplaceConfig(options ServiceOptions) (commit func(), _ error)
- func (s *Service) ResolveAuthConfig(authConfigs map[string]registry.AuthConfig, ref reference.Named) registry.AuthConfig
- func (s *Service) ResolveRepository(name reference.Named) (*RepositoryInfo, error)deprecated
- func (s *Service) Search(ctx context.Context, searchFilters filters.Args, term string, limit int, ...) ([]registry.SearchResult, error)
- func (s *Service) ServiceConfig() *registry.ServiceConfig
- type ServiceOptions
Constants¶
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).
const AuthClientID = "docker"AuthClientID is used the ClientID used for the token server
Variables¶
var (// DefaultV2Registry is the URI of the default (Docker Hub) registry.DefaultV2Registry = &url.URL{Scheme: "https",Host:DefaultRegistryHost,})
Functions¶
funcCertsDir¶added inv1.8.0
func CertsDir()string
CertsDir is the directory where certificates are stored.
funcConvertToHostname¶added inv1.13.0
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).
funcGetAuthConfigKey¶added inv1.10.0
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
funcNewStaticCredentialStore¶added inv1.12.0
func NewStaticCredentialStore(auth *registry.AuthConfig)auth.CredentialStore
NewStaticCredentialStore returns a credential storewhich always returns the same credential values.
funcParseSearchIndexInfo¶added inv1.10.0
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.
funcPingV2Registry¶added inv1.11.0
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.
funcReadCertsDirectory¶added inv1.8.0
ReadCertsDirectory reads the directory for TLS certificatesincluding roots and certificate pairs and updates theprovided TLS configuration.
funcResolveAuthConfig¶added 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.
funcValidateIndexName¶added inv1.5.0
ValidateIndexName validates an index name. It is used by the daemon tovalidate the daemon configuration.
funcValidateMirror¶added inv1.5.0
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¶
typeAPIEndpoint¶added 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
typePingResponseError¶added inv1.11.0
type PingResponseError struct {Errerror}PingResponseError is used when the response from a pingwas received but invalid.
func (PingResponseError)Error¶added inv1.11.0
func (errPingResponseError) Error()string
typeRepositoryInfo¶added 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
funcParseRepositoryInfo¶added 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.
typeService¶added 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.
funcNewService¶added inv0.11.0
func NewService(optionsServiceOptions) (*Service,error)
NewService returns a new instance ofService ready to be installed intoan engine.
func (*Service)Auth¶added 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¶
IsInsecureRegistry returns true if the registry at given host is configured asinsecure registry.
func (*Service)LookupPullEndpoints¶added 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)LookupPushEndpoints¶added 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)Search¶added 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)ServiceConfig¶added inv1.11.0
func (s *Service) ServiceConfig() *registry.ServiceConfig
ServiceConfig returns a copy of the public registry service's configuration.
typeServiceOptions¶added inv1.11.0
type ServiceOptions struct {Mirrors []string `json:"registry-mirrors,omitempty"`InsecureRegistries []string `json:"insecure-registries,omitempty"`}ServiceOptions holds command line options.