Documentation ¶
Index ¶
- Variables
- func UpdateGlobalConfig(registryConfig string) error
- type Client
- type Config
- type DockerRegistryClient
- func New(store *storage.ImageStore, registry, repository string) *DockerRegistryClient
- func NewWithClient(store *storage.ImageStore, registry, repository string, client *http.Client) *DockerRegistryClient
- func PullClientFixture(ctx *context.BuildContext, manifestPath, imageConfigPath, layerTarPath string) (*DockerRegistryClient, error)
- func PullClientFixtureWithAlpine(ctx *context.BuildContext) (*DockerRegistryClient, error)
- func PullClientFixtureWithAlpineDup(ctx *context.BuildContext) (*DockerRegistryClient, error)
- func PushClientFixture(ctx *context.BuildContext, overrides ...responseOverride) (*DockerRegistryClient, error)
- func (c DockerRegistryClient) Pull(tag string) (*image.DistributionManifest, error)
- func (c DockerRegistryClient) PullImageConfig(layerDigest image.Digest) (os.FileInfo, error)
- func (c DockerRegistryClient) PullLayer(layerDigest image.Digest) (os.FileInfo, error)
- func (c DockerRegistryClient) PullManifest(tag string) (*image.DistributionManifest, error)
- func (c DockerRegistryClient) Push(tag string) error
- func (c DockerRegistryClient) PushImageConfig(layerDigest image.Digest) error
- func (c DockerRegistryClient) PushLayer(layerDigest image.Digest) error
- func (c DockerRegistryClient) PushManifest(tag string, manifest *image.DistributionManifest) error
- type Map
- type RepositoryMap
Constants ¶
This section is empty.
Variables ¶
var ConfigurationMap = Map{}
ConfigurationMap is a global variable that maps registry name to config.
var DefaultDockerHubConfiguration = Config{ Security: security.Config{ TLS: &httputil.TLSConfig{}, BasicAuth: &security.BasicAuthConfig{}, }}
DefaultDockerHubConfiguration contains docker hub registry configuration.
Functions ¶
func UpdateGlobalConfig ¶ added in v0.1.11
UpdateGlobalConfig updates the global registry config given either: - a JSON string of the configuration - a path to a YAML file
Types ¶
type Client ¶
type Client interface { Pull(tag string) (*image.DistributionManifest, error) Push(tag string) error PullManifest(tag string) (*image.DistributionManifest, error) PushManifest(tag string, manifest *image.DistributionManifest) error PullLayer(layerDigest image.Digest) (os.FileInfo, error) PushLayer(layerDigest image.Digest) error PullImageConfig(layerDigest image.Digest) (os.FileInfo, error) PushImageConfig(layerDigest image.Digest) error }
Client is the interface through which we can interact with a docker registry. It is used when pulling and pushing images to that registry.
func NoopClientFixture ¶
func NoopClientFixture() Client
NoopClientFixture inits a new NoopClientFixture object for testing.
type Config ¶
type Config struct { Concurrency int `yaml:"concurrency" json:"concurrency"` Timeout time.Duration `yaml:"timeout" json:"timeout"` RetryDisabled bool `yaml:"retry_disabled" json:"retry_disabled"` Retries uint64 `yaml:"retries" json:"retries"` RetryInterval time.Duration `yaml:"retry_interval" json:"retry_interval"` RetryBackoff float64 `yaml:"retry_backoff" json:"retry_backoff"` RetryBackoffMax time.Duration `yaml:"retry_backoff_max" json:"retry_backoff_max"` PushRate float64 `yaml:"push_rate" json:"push_rate"` // If not specify, a default chunk size will be used. // Set it to -1 to turn off chunk upload. // NOTE: gcr and ecr do not support chunked upload. PushChunk int64 `yaml:"push_chunk" json:"push_chunk"` Security security.Config `yaml:"security" json:"security"` }
Config contains docker registry client configuration.
type DockerRegistryClient ¶
type DockerRegistryClient struct {
// contains filtered or unexported fields
}
DockerRegistryClient is a real registry client that is able to push and pull images. It uses a storage.ImageStore to interact with images on the local filesystem. It implements the Client interface.
func New ¶
func New(store *storage.ImageStore, registry, repository string) *DockerRegistryClient
New returns a new default Client.
func NewWithClient ¶
func NewWithClient(store *storage.ImageStore, registry, repository string, client *http.Client) *DockerRegistryClient
NewWithClient returns a new Client with a customized http.Client.
func PullClientFixture ¶
func PullClientFixture( ctx *context.BuildContext, manifestPath, imageConfigPath, layerTarPath string, ) (*DockerRegistryClient, error)
PullClientFixture returns a new registry client fixture that can handle image pull requests.
func PullClientFixtureWithAlpine ¶ added in v0.1.12
func PullClientFixtureWithAlpine(ctx *context.BuildContext) (*DockerRegistryClient, error)
PullClientFixture returns a new registry client fixture that can handle image pull requests using a local alpine test image.
func PullClientFixtureWithAlpineDup ¶ added in v0.1.12
func PullClientFixtureWithAlpineDup(ctx *context.BuildContext) (*DockerRegistryClient, error)
PullClientFixture returns a new registry client fixture that can handle image pull requests using a local alpine test image that contains duplicate layers.
func PushClientFixture ¶
func PushClientFixture(ctx *context.BuildContext, overrides ...responseOverride) (*DockerRegistryClient, error)
PushClientFixture returns a new registry client fixture that can handle image push requests.
func (DockerRegistryClient) Pull ¶
func (c DockerRegistryClient) Pull(tag string) (*image.DistributionManifest, error)
Pull tries to pull an image from its docker registry. If the pull succeeded, it would store the image in the ImageStore of the client, and returns the distribution manifest.
func (DockerRegistryClient) PullImageConfig ¶ added in v0.1.7
PullImageConfig pulls image config blob from the registry. Same as PullLayer, with slightly different log message.
func (DockerRegistryClient) PullLayer ¶
PullLayer pulls image layer from the registry, and verifies that the contents of that layer match the digest of the manifest. If the layer already exists in the imagestore, the download is skipped.
func (DockerRegistryClient) PullManifest ¶
func (c DockerRegistryClient) PullManifest(tag string) (*image.DistributionManifest, error)
PullManifest pulls docker image manifest from the docker registry. It does not save the manifest to the store.
func (DockerRegistryClient) Push ¶
func (c DockerRegistryClient) Push(tag string) error
Push tries to push an image to docker registry, using the ImageStore of the client.
func (DockerRegistryClient) PushImageConfig ¶ added in v0.1.7
func (c DockerRegistryClient) PushImageConfig(layerDigest image.Digest) error
PushImageConfig pushes image config blob to the registry. Same as PushLayer, with slightly different log message.
func (DockerRegistryClient) PushLayer ¶
func (c DockerRegistryClient) PushLayer(layerDigest image.Digest) error
PushLayer pushes the image layer to the registry.
func (DockerRegistryClient) PushManifest ¶
func (c DockerRegistryClient) PushManifest(tag string, manifest *image.DistributionManifest) error
PushManifest pushes the manifest to the registry.
type RepositoryMap ¶
RepositoryMap contains a map of repo config. Repo name can be a regex.