docker

package
v0.8.15 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2020 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildArgs added in v0.8.2

func BuildArgs(dockerfile Dockerfile) (map[string]*string, error)

BuildArgs returns build args with host environment values

func NewBuildLog

func NewBuildLog(r io.Reader) job.Log

NewBuildLog return a instance of Log.

func NewRunLog

func NewRunLog(r io.Reader) job.Log

NewRunLog returns a instance of Log

Types

type Command

type Command []string

Command describes a docker CMD

func (Command) Slice

func (c Command) Slice() []string

Slice returns slice values

type ContainerID

type ContainerID string

ContainerID describes a container id of docker

func (ContainerID) String

func (c ContainerID) String() string

ToString returns string value

type Docker

type Docker interface {
	Build(ctx context.Context, file io.Reader, tag Tag, dockerfile Dockerfile) (job.Log, error)
	Run(ctx context.Context, opts RuntimeOptions, tag Tag, cmd Command) (ContainerID, job.Log, error)
	RemoveContainer(ctx context.Context, containerID ContainerID) error
	RemoveImage(ctx context.Context, tag Tag) error
	ExitCode(ctx context.Context, containerID ContainerID) (ExitCode, error)
	Status() error
}

Docker is a interface describe docker service.

func New

func New() (Docker, error)

New returns instance of docker dockerImpl

type Dockerfile

type Dockerfile struct {
	Dir  string
	Path string
}

Dockerfile represents a path to dockerfile

func (*Dockerfile) Open added in v0.8.2

func (d *Dockerfile) Open() (io.Reader, error)

Open dockerfile

type Environments

type Environments map[string]interface{}

Environments represents a docker `-e` option.

func (Environments) Array

func (e Environments) Array() []string

Array returns string array of environments

type ExitCode

type ExitCode int64

ExitCode describes a exit code

func (ExitCode) IsFailure

func (c ExitCode) IsFailure() bool

IsFailure returns whether failure code or not

type Moby

type Moby interface {
	ImageBuild(
		ctx context.Context,
		buildContext io.Reader,
		options types.ImageBuildOptions,
	) (types.ImageBuildResponse, error)
	ContainerCreate(
		ctx context.Context,
		config *container.Config,
		hostConfig *container.HostConfig,
		networkingConfig *network.NetworkingConfig,
		containerName string,
	) (container.ContainerCreateCreatedBody, error)
	ContainerStart(
		ctx context.Context,
		containerID string,
		options types.ContainerStartOptions,
	) error
	ContainerLogs(
		ctx context.Context,
		container string,
		options types.ContainerLogsOptions,
	) (io.ReadCloser, error)
	ContainerRemove(
		ctx context.Context,
		containerID string,
		options types.ContainerRemoveOptions,
	) error
	ImageRemove(
		ctx context.Context,
		imageID string,
		options types.ImageRemoveOptions,
	) ([]types.ImageDeleteResponseItem, error)
	ContainerWait(
		ctx context.Context,
		containerID string,
		condition container.WaitCondition,
	) (<-chan container.ContainerWaitOKBody, <-chan error)
	Info(
		ctx context.Context,
	) (types.Info, error)
}

Moby is a interface of docker client see also github.com/moby/moby/client

type RuntimeOptions

type RuntimeOptions struct {
	Environments Environments
	Volumes      Volumes
}

RuntimeOptions is a docker options.

type Tag

type Tag string

Tag describes a docker tag

func (Tag) String

func (t Tag) String() string

ToString return string value

type Volumes

type Volumes []string

Volumes represents a docker `-v` option.

func (Volumes) Map

func (v Volumes) Map() map[string]struct{}

Map returns map of volumes.

Directories

Path Synopsis
Package mock_docker is a generated GoMock package.
Package mock_docker is a generated GoMock package.

Jump to

Keyboard shortcuts

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