Documentation
¶
Overview ¶
Package registry is a fork of github.com/docker/docker/registry, taken at commit moby@49306c6. Git history was not preserved in this fork, but can be found using the URLs provided.
This fork was created to remove the dependency on the "Moby" codebase, and because the CLI only needs a subset of its features. The original package was written specifically for use in the daemon code, and includes functionality that cannot be used in the CLI.
Package registry contains client primitives to interact with a remote Docker registry.
Index ¶
- Constants
- Variables
- func CertsDir() string
- func Headers(userAgent string, metaHeaders http.Header) []transport.RequestModifier
- func NewIndexInfo(reposName reference.Named) *registry.IndexInfo
- func PingV2Registry(endpoint *url.URL, authTransport http.RoundTripper) (challenge.Manager, error)
- func ReadCertsDirectory(tlsConfig *tls.Config, directory string) error
- type APIEndpoint
- type Service
- type ServiceOptions
Constants ¶
const ( // DefaultNamespace is the default namespace DefaultNamespace = "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 search IndexServer = "https://index.docker.io/v1/" // IndexName is the name of the index IndexName = "docker.io" )
TODO(thaJeztah) both the "index.docker.io" and "registry-1.docker.io" domains are here for historic reasons and backward-compatibility. These domains are still supported by Docker Hub (and will continue to be supported), but there are new domains already in use, and plans to consolidate all legacy domains to new "canonical" domains. Once those domains are decided on, we should update these consts (but making sure to preserve compatibility with existing 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 // 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. DefaultV2Registry = &url.URL{Scheme: "https", Host: "registry-1.docker.io"} )
Functions ¶
func CertsDir ¶
func CertsDir() string
CertsDir is the directory where certificates are stored.
- Linux: "/etc/docker/certs.d/" - Linux (with rootlessKit): $XDG_CONFIG_HOME/docker/certs.d/" or "$HOME/.config/docker/certs.d/" - Windows: "%PROGRAMDATA%/docker/certs.d/"
TODO(thaJeztah): certsDir but stored in our config, and passed when needed. For the CLI, we should also default to same path as rootless.
func Headers ¶
func Headers(userAgent string, metaHeaders http.Header) []transport.RequestModifier
Headers returns request modifiers with a User-Agent and metaHeaders
func NewIndexInfo ¶
NewIndexInfo creates a new registry.IndexInfo or the given repository-name, and detects whether the registry is considered "secure" (non-localhost).
func PingV2Registry ¶
PingV2Registry attempts to ping a v2 registry and on success return a challenge manager for the supported authentication types. If a response is received but cannot be interpreted, a PingResponseError will be returned.
Types ¶
type APIEndpoint ¶
APIEndpoint represents a remote API endpoint
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is a registry service. It tracks configuration data such as a list of mirrors.
func NewService ¶
func NewService(options ServiceOptions) (*Service, error)
NewService returns a new instance of Service ready to be installed into an engine.
func (*Service) Auth ¶
func (s *Service) Auth(ctx context.Context, authConfig *registry.AuthConfig, userAgent string) (token string, _ 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.
type ServiceOptions ¶
type ServiceOptions struct {
InsecureRegistries []string `json:"insecure-registries,omitempty"`
}
ServiceOptions holds command line options.
TODO(thaJeztah): add CertsDir as option to replace the CertsDir function, which sets the location magically.