Documentation ¶
Index ¶
- func GetDigest(ctx context.Context, c Client, registry, repository, tag string) (string, error)
- func SplitImage(image string) (registry, repository, tagOrDigest string, err error)
- type Client
- type ClientImpl
- func (c *ClientImpl) GetConfig(ctx context.Context, registry, repository, configDigest string) (*ImageConfig, error)
- func (c *ClientImpl) GetManifest(ctx context.Context, registry, repository, reference string) (*Manifest, error)
- func (c *ClientImpl) ListInstances(ctx context.Context, registry, repository string) (map[string]*ImageInstance, error)
- func (c *ClientImpl) ListRepositories(ctx context.Context, registry string) ([]string, error)
- func (c *ClientImpl) ListTags(ctx context.Context, registry, repository string) ([]string, error)
- func (c *ClientImpl) SetTag(ctx context.Context, registry, repository, reference, newTag string) error
- type ImageConfig
- type ImageConfig_Config
- type ImageConfig_History
- type ImageConfig_RootFS
- type ImageInstance
- type ImageInstanceSlice
- type Manifest
- type MediaConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetDigest ¶
GetDigest retrieves the digest for the given image from the registry. It is a shortcut for Client.GetManifest and Manifest.Digest.
Note: This could instead be part of Client, and we could send a HEAD request to the manifests URL. This would be a little more efficient in that it would send less data over the network.
func SplitImage ¶
SplitImage splits a full Docker image path into registry, repository, and tag or digest components. It is not an error for the tag or digest to be missing.
Types ¶
type Client ¶
type Client interface { // GetManifest retrieves the manifest for the given image. The reference may // be a tag or a digest. GetManifest(ctx context.Context, registry, repository, reference string) (*Manifest, error) // GetConfig retrieves an image config based on the config.digest from its // Manifest. GetConfig(ctx context.Context, registry, repository, configDigest string) (*ImageConfig, error) // ListRepositories lists all repositories in the given registry. Because there // may be many results, this can be quite slow. ListRepositories(ctx context.Context, registry string) ([]string, error) // ListInstances lists all image instances for the given repository, keyed by // their digests. Because there may be many results, this can be quite slow. ListInstances(ctx context.Context, registry, repository string) (map[string]*ImageInstance, error) // ListTags lists all known tags for the given repository. Because there may be // many results, this can be quite slow. ListTags(ctx context.Context, registry, repository string) ([]string, error) // SetTag sets the given tag on the image. SetTag(ctx context.Context, registry, repository, reference, newTag string) error }
Client is used for interacting with a Docker registry.
type ClientImpl ¶
type ClientImpl struct {
// contains filtered or unexported fields
}
ClientImpl implements Client.
func NewClient ¶
func NewClient(ctx context.Context) (*ClientImpl, error)
NewClient returns a Client instance which interacts with the given registry. The passed-in http.Client should handle redirects.
func (*ClientImpl) GetConfig ¶
func (c *ClientImpl) GetConfig(ctx context.Context, registry, repository, configDigest string) (*ImageConfig, error)
GetConfig implements Client.
func (*ClientImpl) GetManifest ¶
func (c *ClientImpl) GetManifest(ctx context.Context, registry, repository, reference string) (*Manifest, error)
GetManifest implements Client.
func (*ClientImpl) ListInstances ¶
func (c *ClientImpl) ListInstances(ctx context.Context, registry, repository string) (map[string]*ImageInstance, error)
ListInstances implements Client.
func (*ClientImpl) ListRepositories ¶
ListRepositories implements Client.
type ImageConfig ¶
type ImageConfig struct { Architecture string `json:"architecture"` Author string `json:"author"` Config ImageConfig_Config `json:"config"` Container string `json:"container"` Created time.Time `json:"created"` DockerVersion string `json:"docker_version"` History []ImageConfig_History `json:"history"` OS string `json:"os"` RootFS ImageConfig_RootFS `json:"rootfs"` }
ImageConfig is the configuration blob for a Docker image instance.
func GetConfig ¶
func GetConfig(ctx context.Context, c *ClientImpl, registry, repository, reference string) (*ImageConfig, error)
GetConfig retrieves an image config. It is a shortcut for Client.GetManifest and Client.GetConfig.
type ImageConfig_Config ¶
type ImageConfig_History ¶
type ImageConfig_RootFS ¶
type ImageInstance ¶
type ImageInstance struct { Digest string `json:"digest"` SizeBytes int64 `json:"imageSizeBytes"` Tags []string `json:"tag"` Created time.Time `json:"timeCreatedMs"` Uploaded time.Time `json:"timeUploadedMs"` }
ImageInstance describes one instance of an image.
type ImageInstanceSlice ¶
type ImageInstanceSlice []*ImageInstance
ImageInstanceSlice implements sort.Interface.
func (ImageInstanceSlice) Len ¶
func (s ImageInstanceSlice) Len() int
Len implements sort.Interface.
func (ImageInstanceSlice) Less ¶
func (s ImageInstanceSlice) Less(i, j int) bool
Less implements sort.Interface.
func (ImageInstanceSlice) Swap ¶
func (s ImageInstanceSlice) Swap(i, j int)
Swap implements sort.Interface.
type Manifest ¶
type Manifest struct { SchemaVersion int `json:"schemaVersion"` MediaType string `json:"mediaType"` Digest string `json:"-"` Config MediaConfig `json:"config"` Layers []MediaConfig `json:"layers"` }
Manifest represents a Docker image manifest.