Documentation
¶
Overview ¶
Package dockerhub implements a minimal client for Docker Hub's public, unauthenticated Hub API: repository search and tag listing, used to let an operator discover a well-known public image from the app-creation "docker image" step (RegistryImagePicker.tsx) instead of typing a reference blind. Deliberately scoped to those two read-only endpoints, the same narrow-surface shape internal/registrycatalog draws for the built-in registry's own catalog.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = errors.New("dockerhub: repository not found")
ErrNotFound reports that Docker Hub has no such repository, the Hub API's own signal (a 404) for a namespace/name nothing was ever published under, distinct from an unreachable host or a rate limit.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
HTTP *http.Client
// BaseURL overrides defaultBaseURL, for tests only.
BaseURL string
}
Client queries Docker Hub's public Hub API over plain HTTPS: no authentication, so no credentials to manage or leak.
func NewClient ¶
func NewClient() *Client
NewClient returns a Client with a bounded per-request timeout, the same shape registrycatalog.NewClient establishes for its own single small JSON requests.
func (*Client) ListTags ¶
func (c *Client) ListTags(ctx context.Context, namespace, repository string, pageSize int) ([]Tag, error)
ListTags queries GET /v2/repositories/{namespace}/{repo}/tags. An empty namespace defaults to "library", the namespace Docker Hub's own search results omit for official images.
func (*Client) SearchRepositories ¶
func (c *Client) SearchRepositories(ctx context.Context, query string, pageSize int) ([]Repository, error)
SearchRepositories queries GET /v2/search/repositories/?query=..., returning Docker Hub's own relevance-ranked order unchanged.
type Repository ¶
type Repository struct {
Name string `json:"repo_name"`
ShortDescription string `json:"short_description"`
StarCount int `json:"star_count"`
IsOfficial bool `json:"is_official"`
IsAutomated bool `json:"is_automated"`
}
Repository is one GET /v2/search/repositories/ result: the fields the picker's search results list needs (name, description, popularity, official/automated flags), not the full upstream payload.