docker

package
v0.0.0-...-9340bfe Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 7, 2016 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DeisCIDockerOrg represents the "deisci" docker organization on quay and the docker hub
	DeisCIDockerOrg = "deisci"
	// DeisDockerOrg represents the "deis" docker organization on quay and the docker hub
	DeisDockerOrg = "deis"
)
View Source
const (
	DockerHubRegistry = "index.docker.io"
)

Variables

This section is empty.

Functions

func PullImages

func PullImages(cl Client, images []*Image) (<-chan Image, <-chan ErrPullImage, <-chan struct{})

PullImages pulls each image in images concurrently. The first returned channel receives on each image successfully pulled, and the second receives on each image that failed to pull for any reason. The total recieves across both channels will equal len(images), and the third channel will be closed only after all of those receives occur.

func PushImages

func PushImages(cl Client, images []*Image) []error

PushImages pushes docker images, each of which is based on the items in images

func RetagImages

func RetagImages(cl Client, pairs []ImageTagPair) (<-chan ImageTagPair, <-chan ErrTag, <-chan struct{})

RetagImages concurrently retags all of the images in pairs. The first returned chan recieves on each image that successfully is retagged and the second on each image that can't be retagged. The total number of receives on the first and second channels will equal len(pairs), and after all receives happen, the 3rd chan will be closed

Types

type Client

type Client interface {
	Push(*Image) error
	Pull(*Image) error
	Retag(*Image, *Image) error
}

Client is the interface to interact with the docker daemon.

func NewCmdClient

func NewCmdClient() Client

NewCmdClient creates a new Client that does all of its operations by shelling out to the docker CLI

func NewSDKClient

func NewSDKClient(cl *dlib.Client) Client

NewSDKClient creates a new Client that uses the SDK under the hood

type ErrInvalidImageName

type ErrInvalidImageName struct {
	Str string
}

ErrInvalidImageName is the error returned when a func couldn't parse a string into an Image struct

func (ErrInvalidImageName) Error

func (e ErrInvalidImageName) Error() string

Error is the error interface implementation

type ErrPullImage

type ErrPullImage struct {
	Img *Image
	Err error
}

ErrPullImage is the error returned when an image couldn't be pulled

func (ErrPullImage) Error

func (e ErrPullImage) Error() string

Error is the error interface implementation

type ErrTag

type ErrTag struct {
	SourceImage *Image
	TargetImage *Image
	Err         error
}

ErrTag is the error returned when an image couldn't be retagged

func (ErrTag) Error

func (e ErrTag) Error() string

Error is the error interface implementation

type Image

type Image struct {
	// contains filtered or unexported fields
}

Image represents a single image name, including all information about its registry, repository and tag

func ParseImageFromName

func ParseImageFromName(name string) (*Image, error)

ParseImageFromName parses a raw image name string into an Image

func ParseImageFromRepoAndSha

func ParseImageFromRepoAndSha(
	dockerRegistries []string,
	dockerRegistryOrg string,
	ras git.RepoAndSha,
) ([]*Image, error)

ParseImageFromRepoAndSha attempts to convert ras into a set of docker images, each of which points to a registry in registries and uses dockerRegistryOrg. Any registry that matches DockerHubRegistry will be converted to empty

func ParseImagesFromRepoAndShaList

func ParseImagesFromRepoAndShaList(
	dockerRegistries []string,
	dockerRegistryOrg string,
	rasl *git.RepoAndShaList,
) ([]*Image, error)

ParseImagesFromRepoAndShaList returns a slice of parsed Images in the same order as they appear in rasl.Slice(). Returns an empty slice and a non-nil error if any one of the git.RepoAndShas couldn't be parsed

func (Image) FullWithoutTag

func (i Image) FullWithoutTag() string

FullWithoutTag returns the full image name without its tag

func (*Image) SetRepo

func (i *Image) SetRepo(repo string)

SetRepo sets the image repository of i to repo

func (*Image) SetTag

func (i *Image) SetTag(tag string)

SetTag sets the image tag of i to tag

func (Image) String

func (i Image) String() string

String is the fmt.Stringer interface implementation. It returns the full image name and its tag

type ImageTagPair

type ImageTagPair struct {
	Source *Image
	Target *Image
}

ImageTagPair represents a source image that will be re-tagged to a target image

func CreateImageTagPairsFromTransform

func CreateImageTagPairsFromTransform(images []*Image, transform func(Image) *Image) []ImageTagPair

CreateImageTagPairsFromTransform returns a slice of ImageTagPairs where each source is images[i] and each target is transform(images[i])

type MemoryClient

type MemoryClient struct {
	Pushes []*Image
	Pulls  []*Image
	Retags []ImageTagPair
	// contains filtered or unexported fields
}

MemoryClient is a purely in-memory implementation of Client. It's meant for mocking in unit tests. Create one with NewMemoryClient, not by manually creating a struct instance

func NewMemoryClient

func NewMemoryClient() *MemoryClient

NewMemoryClient creates a new MemoryClient. Always call this function instead of manually creating a MemoryClient struct

func (*MemoryClient) Pull

func (m *MemoryClient) Pull(i *Image) error

Pull is the Client interface implementation

func (*MemoryClient) Push

func (m *MemoryClient) Push(i *Image) error

Push is the Client interface implementation

func (*MemoryClient) Retag

func (m *MemoryClient) Retag(src *Image, tar *Image) error

Retag is the Client interface implementation

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL