Documentation ¶
Index ¶
- Variables
- 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, testdataDir string) (*DockerRegistryClient, error)
- func PushClientFixture(ctx *context.BuildContext) (*DockerRegistryClient, error)
- func (c DockerRegistryClient) Pull(tag string) (*image.DistributionManifest, 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) 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{ image.DockerHubRegistry: RepositoryMap{"library/*": DefaultDockerHubConfiguration}, }
ConfigurationMap is a global variable that maps registry name to config.
var DefaultDockerHubConfiguration = Config{ Security: security.Config{ TLS: &httputil.TLSConfig{}, BasicAuth: &types.AuthConfig{}, }}
DefaultDockerHubConfiguration contains docker hub registry configuration.
Functions ¶
This section is empty.
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 }
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"` Timeout time.Duration `yaml:"timeout"` Retries int `yaml:"retries"` RetryInterval time.Duration `yaml:"retry_interval"` RetryBackoff float64 `yaml:"retry_backoff"` PushRate float64 `yaml:"push_rate"` // If not specify, a default chunk size will be used. // Set it to -1 to turn off chunk upload. // NOTE: gcr does not support chunked upload. PushChunk int64 `yaml:"push_chunk"` Security security.Config `yaml:"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, testdataDir string) (*DockerRegistryClient, error)
PullClientFixture returns a new registry client fixture that can handle image pull requests.
func PushClientFixture ¶
func PushClientFixture(ctx *context.BuildContext) (*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) PullLayer ¶
PullLayer pulls the layer of the docker image from the registry, and verifies that the contents of that layer match the digest of the manifest. If the layer is already in the imagestore of the client, 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) PushLayer ¶
func (c DockerRegistryClient) PushLayer(layerDigest image.Digest) error
PushLayer pushes the layer from the ImageStore of the client to the registry specified.
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.