docker

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2018 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const CmdEnvKey = "MUFAASSOURCECMD"
View Source
const DefaultLabel = "mufaas"

DefaultLabel for containers

Variables

This section is empty.

Functions

func GetByName

func GetByName(name string) (*types.Container, error)

GetByName return a container by name

func ImageBuild

func ImageBuild(opts ImageBuildOptions) (*types.ImageSummary, error)

ImageBuild builds a docker image from the image directory

func ImageList

func ImageList(listFilters []string) ([]types.ImageSummary, error)

List return built images, filtered by a list of docker compatible filters (key=value) eg. [id=..., name=...]

func ImageRemove

func ImageRemove(id string, force bool) (err error)

ImageRemove remove an image

func Kill

func Kill(containerID string) (err error)

Kill a running container

func List

func List(listFilters []string) (list []types.Container, err error)

List containers

func Remove

func Remove(containerID string, forceRemove bool) (err error)

Remove a container

func Start

Start a container

Types

type ContainerCreated

type ContainerCreated struct {
	ID   string
	Name string
}

func Create

func Create(opts *CreateOptions) (*ContainerCreated, error)

Create a new container

type ContainerEvent

type ContainerEvent struct {
	ID      string
	Name    string
	Action  string
	Message events.Message
}

ContainerEvent store a container event

type ContainerStartOptions

type ContainerStartOptions struct {
	Name      string
	ImageName string
}

type CreateOptions

type CreateOptions struct {
	Name       string
	Image      string
	Cmd        []string
	Env        []string
	Privileged bool
}

type ExecOptions

type ExecOptions struct {
	Name       string
	Cmd        []string
	Env        []string
	Stdin      []byte
	Args       []string
	Privileged bool
	// Timeout in second to stop the container
	Timeout int64
	Remove  bool
}

ExecOptions control how a container is executed

type ExecResult

type ExecResult struct {
	ID     string
	Stdout *bytes.Buffer
	Stderr *bytes.Buffer
}

ExecResult return the execution results

func Exec

func Exec(opts ExecOptions) (*ExecResult, error)

Exec spawn a container and wait for its output

type ImageBuildOptions

type ImageBuildOptions struct {
	Name       string
	Type       string
	TypesPath  []string
	Archive    string
	Dockerfile string
	Labels     map[string]string
}

Jump to

Keyboard shortcuts

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