Documentation ¶
Index ¶
- Constants
- func EncodeRegistryAuth(username, password string) string
- func FindDigest(s string) string
- func PullImage(ctx context.Context, puller ImagePuller, image, registryAuth string, ...) (string, error)
- func PushImage(ctx context.Context, pusher ImagePusher, image, registryAuth string, ...) (string, error)
- type ImagePuller
- type ImagePusher
- type PullOrPush
- type Userinfo
Constants ¶
View Source
const ( DefaultDomain = "docker.io" OfficialRepoName = "library" )
Defaults useful when constructing fully qualified image refs. Sourced from https://github.com/moby/moby/blob/master/vendor/github.com/docker/distribution/reference/normalize.go#L14
Variables ¶
This section is empty.
Functions ¶
func EncodeRegistryAuth ¶
func FindDigest ¶
FindDigest finds a digest within a string. If it is found the digest is returned, otherwise returns the empty string.
func PullImage ¶
func PullImage(ctx context.Context, puller ImagePuller, image, registryAuth string, onUpdate func(*PullOrPush)) (string, error)
func PushImage ¶
func PushImage(ctx context.Context, pusher ImagePusher, image, registryAuth string, onUpdate func(*PullOrPush)) (string, error)
Types ¶
type ImagePuller ¶
type ImagePuller interface {
ImagePull(ctx context.Context, image string, pushOptions dockerTypes.ImagePullOptions) (io.ReadCloser, error)
}
type ImagePusher ¶
type ImagePusher interface {
ImagePush(ctx context.Context, image string, pushOptions dockerTypes.ImagePushOptions) (io.ReadCloser, error)
}
type PullOrPush ¶
type PullOrPush struct {
// contains filtered or unexported fields
}
func NewPull ¶
func NewPull(r io.Reader) *PullOrPush
func NewPush ¶
func NewPush(r io.Reader) *PullOrPush
func (*PullOrPush) Progress ¶
func (d *PullOrPush) Progress() float64
func (*PullOrPush) Wait ¶
func (d *PullOrPush) Wait(onUpdate func(*PullOrPush)) (string, error)
Wait processes a JSON stream (the body of an image pull docker HTTP response) and returns an error as soon as an error is encountered in the stream, or the digest could not be parsd aftere processing the entire stream. Otherwise, it returns the digest string and a no error. onUpdate is called whenever d.Progress() may return a different value from the previous call.
Click to show internal directories.
Click to hide internal directories.