docker

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2015 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Deprecated environment variable name, specifying where to look for the S2I scripts.
	// It is now being replaced with ScriptsURLLabel.
	ScriptsURLEnvironment = "STI_SCRIPTS_URL"
	// Deprecated environment variable name, specifying where to place artifacts in
	// builder image. It is now being replaced with DestinationLabel.
	LocationEnvironment = "STI_LOCATION"

	// ScriptsURLLabel is the name of the Docker image LABEL that tells S2I where
	// to look for the S2I scripts. This label is also copied into the ouput
	// image.
	// The previous name of this label was 'io.s2i.scripts-url'. This is now
	// deprecated.
	ScriptsURLLabel = api.DefaultNamespace + "scripts-url"
	// DestinationLabel is the name of the Docker image LABEL that tells S2I where
	// to place the artifacts (scripts, sources) in the builder image.
	// The previous name of this label was 'io.s2i.destination'. This is now
	// deprecated
	DestinationLabel = api.DefaultNamespace + "destination"

	// DefaultDestination is the destination where the artifacts will be placed
	// if DestinationLabel was not specified.
	DefaultDestination = "/tmp"
	// DefaultTag is the image tag, being applied if none is specified.
	DefaultTag = "latest"
)

Variables

This section is empty.

Functions

func GetImageRegistryAuth

func GetImageRegistryAuth(auths *client.AuthConfigurations, imageName string) client.AuthConfiguration

GetImageRegistryAuth retrieves the appropriate docker client authentication object for a given image name and a given set of client authentication objects.

func LoadAndGetImageRegistryAuth added in v1.0.2

func LoadAndGetImageRegistryAuth(dockerCfg io.Reader, imageName string) client.AuthConfiguration

LoadAndGetImageRegistryAuth loads the set of client auth objects from a docker config file and returns the appropriate client auth object for a given image name.

func LoadImageRegistryAuth added in v1.0.2

func LoadImageRegistryAuth(dockerCfg io.Reader) *client.AuthConfigurations

LoadImageRegistryAuth loads and returns the set of client auth objects from a docker config json file.

func StreamContainerIO added in v1.0.2

func StreamContainerIO(errStream io.Reader, errOutput *string, log func(...interface{}))

StreamContainerIO takes data from the Reader and redirects to the log functin (typically we pass in glog.Error for stderr and glog.Info for stdout

Types

type BuildImageOptions

type BuildImageOptions struct {
	Name   string
	Stdin  io.Reader
	Stdout io.Writer
}

BuildImageOptions are options passed in to the BuildImage method

type Client

type Client interface {
	RemoveImage(name string) error
	InspectImage(name string) (*docker.Image, error)
	PullImage(opts docker.PullImageOptions, auth docker.AuthConfiguration) error
	CreateContainer(opts docker.CreateContainerOptions) (*docker.Container, error)
	AttachToContainer(opts docker.AttachToContainerOptions) error
	StartContainer(id string, hostConfig *docker.HostConfig) error
	WaitContainer(id string) (int, error)
	RemoveContainer(opts docker.RemoveContainerOptions) error
	CommitContainer(opts docker.CommitContainerOptions) (*docker.Image, error)
	CopyFromContainer(opts docker.CopyFromContainerOptions) error
	BuildImage(opts docker.BuildImageOptions) error
	InspectContainer(id string) (*docker.Container, error)
}

Client contains all methods called on the go Docker client.

type CommitContainerOptions

type CommitContainerOptions struct {
	ContainerID string
	Repository  string
	Command     []string
	Env         []string
	Labels      map[string]string
}

CommitContainerOptions are options passed in to the CommitContainer method

type Docker

type Docker interface {
	IsImageInLocalRegistry(name string) (bool, error)
	IsImageOnBuild(string) bool
	GetOnBuild(string) ([]string, error)
	RemoveContainer(id string) error
	GetScriptsURL(name string) (string, error)
	RunContainer(opts RunContainerOptions) error
	GetImageID(name string) (string, error)
	CommitContainer(opts CommitContainerOptions) (string, error)
	RemoveImage(name string) error
	CheckImage(name string) (*docker.Image, error)
	PullImage(name string) (*docker.Image, error)
	CheckAndPullImage(name string) (*docker.Image, error)
	BuildImage(opts BuildImageOptions) error
	GetImageUser(name string) (string, error)
}

Docker is the interface between STI and the Docker client It contains higher level operations called from the STI build or usage commands

func New

func New(config *api.DockerConfig, auth docker.AuthConfiguration) (Docker, error)

New creates a new implementation of the STI Docker interface

type DockerImageReference

type DockerImageReference struct {
	Registry  string
	Namespace string
	Name      string
	Tag       string
	ID        string
}

DockerImageReference points to a Docker image.

func ParseDockerImageReference

func ParseDockerImageReference(spec string) (DockerImageReference, error)

ParseDockerImageReference parses a Docker pull spec string into a DockerImageReference. FIXME: This code was copied from OpenShift repository

type PostExecutor

type PostExecutor interface {
	PostExecute(containerID, destination string) error
}

type PullResult

type PullResult struct {
	OnBuild bool
	Image   *docker.Image
}

type RunContainerOptions

type RunContainerOptions struct {
	Image           string
	PullImage       bool
	PullAuth        docker.AuthConfiguration
	ExternalScripts bool
	ScriptsURL      string
	Destination     string
	Command         string
	Env             []string
	Stdin           io.Reader
	Stdout          io.Writer
	Stderr          io.Writer
	OnStart         func() error
	PostExec        PostExecutor
	TargetImage     bool
}

RunContainerOptions are options passed in to the RunContainer method

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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