Documentation ¶
Index ¶
- Constants
- type ErrImageNotFound
- type FormattingWriter
- type ImageManager
- func (d *ImageManager) BuildImage(dockerfileDirPath, name string, stdoutWriter io.WriteCloser) error
- func (d *ImageManager) BuildImageFromCallback(name string, stdoutWriter io.Writer, callback func(*tar.Writer) error) error
- func (d *ImageManager) CreateImage(containerID string, repository string, tag string, message string, ...) (*dockerclient.Image, error)
- func (d *ImageManager) FindBestImageWithLabels(baseImageName string, labels []string, mandatory []string) (string, map[string]string, error)
- func (d *ImageManager) FindImage(imageName string) (*dockerclient.Image, error)
- func (d *ImageManager) HasImage(imageName string) (bool, error)
- func (d *ImageManager) HasLabels(image *dockerclient.APIImages, labels map[string]struct{}) bool
- func (d *ImageManager) ListImages(options dockerclient.ListImagesOptions) ([]dockerclient.APIImages, error)
- func (d *ImageManager) RemoveContainer(containerID string) error
- func (d *ImageManager) RemoveImage(imageName string) error
- func (d *ImageManager) RemoveVolumes(container *dockerclient.Container) error
- func (d *ImageManager) RunInContainer(opts RunInContainerOpts) (int, *dockerclient.Container, error)
- type RunInContainerOpts
- type StringFormatter
Constants ¶
const ( // ContainerInPath is the input path for fissile ContainerInPath = "/fissile-in" // ContainerOutPath is the output path for fissile ContainerOutPath = "/fissile-out" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ErrImageNotFound ¶
type ErrImageNotFound string
ErrImageNotFound is the error returned when an image is not found.
func (ErrImageNotFound) Error ¶
func (e ErrImageNotFound) Error() string
type FormattingWriter ¶
FormattingWriter wraps an io.WriteCloser so lines can be individually formatted.
func NewFormattingWriter ¶
func NewFormattingWriter(writer io.Writer, aColorizer StringFormatter) *FormattingWriter
NewFormattingWriter - Get a FormattingWriter here. aColorizer can be nil
func (*FormattingWriter) Close ¶
func (w *FormattingWriter) Close() error
Close ensures the remaining data is written to the io.Writer
type ImageManager ¶
type ImageManager struct {
// contains filtered or unexported fields
}
ImageManager handles Docker images
func NewImageManager ¶
func NewImageManager() (*ImageManager, error)
NewImageManager creates an instance of ImageManager
func (*ImageManager) BuildImage ¶
func (d *ImageManager) BuildImage(dockerfileDirPath, name string, stdoutWriter io.WriteCloser) error
BuildImage builds a docker image using a directory that contains a Dockerfile
func (*ImageManager) BuildImageFromCallback ¶
func (d *ImageManager) BuildImageFromCallback(name string, stdoutWriter io.Writer, callback func(*tar.Writer) error) error
BuildImageFromCallback builds a docker image by letting a callback populate a tar.Writer; the callback must write a Dockerfile into the tar stream (as well as any additional build context). If stdoutWriter implements io.Closer, it will be closed when done.
func (*ImageManager) CreateImage ¶
func (d *ImageManager) CreateImage(containerID string, repository string, tag string, message string, cmd []string) (*dockerclient.Image, error)
CreateImage will create a Docker image
func (*ImageManager) FindBestImageWithLabels ¶
func (d *ImageManager) FindBestImageWithLabels(baseImageName string, labels []string, mandatory []string) (string, map[string]string, error)
FindBestImageWithLabels finds the best image that has a given base image, and has as many of the given labels as possible. Returns the best matching image name, and all of the matched labels (and their values). Manadatory labels are labels an image must have to be considered as candidate.
func (*ImageManager) FindImage ¶
func (d *ImageManager) FindImage(imageName string) (*dockerclient.Image, error)
FindImage will lookup an image in Docker
func (*ImageManager) HasImage ¶
func (d *ImageManager) HasImage(imageName string) (bool, error)
HasImage determines if the given image already exists in Docker
func (*ImageManager) HasLabels ¶
func (d *ImageManager) HasLabels(image *dockerclient.APIImages, labels map[string]struct{}) bool
HasLabels determines if all of the provided labels (keys of the map) are in the set of the image's labels. It returns true if so, and false otherwise.
func (*ImageManager) ListImages ¶
func (d *ImageManager) ListImages(options dockerclient.ListImagesOptions) ([]dockerclient.APIImages, error)
ListImages will return a list of images matching the options
func (*ImageManager) RemoveContainer ¶
func (d *ImageManager) RemoveContainer(containerID string) error
RemoveContainer will remove a container from Docker
func (*ImageManager) RemoveImage ¶
func (d *ImageManager) RemoveImage(imageName string) error
RemoveImage will remove an image from Docker's internal registry
func (*ImageManager) RemoveVolumes ¶
func (d *ImageManager) RemoveVolumes(container *dockerclient.Container) error
RemoveVolumes removes any temporary volumes associated with a container
func (*ImageManager) RunInContainer ¶
func (d *ImageManager) RunInContainer(opts RunInContainerOpts) (int, *dockerclient.Container, error)
RunInContainer will execute a set of commands within a running Docker container
type RunInContainerOpts ¶
type RunInContainerOpts struct { ContainerName string ImageName string NetworkMode string EntryPoint []string Cmd []string // Mount points, src -> dest // dest may be special values ContainerInPath, ContainerOutPath Mounts map[string]string // Create local volumes. Volumes are destroyed unless KeepContainer is true Volumes map[string]map[string]string KeepContainer bool StdoutWriter io.Writer StderrWriter io.Writer // Directories to stream in/out of the container. StreamIn map[string]string StreamOut map[string]string }
RunInContainerOpts encapsulates the options to RunInContainer()
type StringFormatter ¶
StringFormatter is a formatting string function
func ColoredBuildStringFunc ¶
func ColoredBuildStringFunc(buildName string) StringFormatter
ColoredBuildStringFunc returns a formatting function for colorizing strings.