container

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2018 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MapToEnv added in v0.2.0

func MapToEnv(data map[string]string) []string

MapToEnv transform a map of key value to a array of env string

func Namespace

func Namespace(ss []string) string

Namespace creates a namespace from a list of string.

Types

type BuildResponse

type BuildResponse struct {
	Stream string `json:"stream"`
	Error  string `json:"error"`
}

BuildResponse is the object that is returned by the docker api in json

type Container added in v0.2.0

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

Container provides high level interactions with Docker API for MESG.

func New added in v0.2.0

func New(options ...Option) (*Container, error)

New creates a new Container with given options.

func (*Container) Build added in v0.2.0

func (c *Container) Build(path string) (tag string, err error)

Build builds a docker image.

func (*Container) CreateNetwork added in v0.2.0

func (c *Container) CreateNetwork(namespace []string) (id string, err error)

CreateNetwork creates a Docker Network with a namespace.

func (*Container) DeleteNetwork added in v0.2.0

func (c *Container) DeleteNetwork(namespace []string) error

DeleteNetwork deletes a Docker Network associated with a namespace.

func (*Container) FindContainer added in v0.2.0

func (c *Container) FindContainer(namespace []string) (types.ContainerJSON, error)

FindContainer returns a docker container.

func (*Container) FindNetwork added in v0.2.0

func (c *Container) FindNetwork(namespace []string) (types.NetworkResource, error)

FindNetwork finds a Docker Network by a namespace. If no network is found, an error is returned.

func (*Container) FindService added in v0.2.0

func (c *Container) FindService(namespace []string) (swarm.Service, error)

FindService returns the Docker Service or an error if not found.

func (*Container) ListServices added in v0.2.0

func (c *Container) ListServices(label string) ([]swarm.Service, error)

ListServices returns existing docker services matching a specific label name.

func (*Container) ListTasks added in v0.2.0

func (c *Container) ListTasks(namespace []string) ([]swarm.Task, error)

ListTasks returns all the docker tasks.

func (*Container) ServiceLogs added in v0.2.0

func (c *Container) ServiceLogs(namespace []string) (io.ReadCloser, error)

ServiceLogs returns the logs of a service.

func (*Container) ServiceStatus added in v0.2.0

func (c *Container) ServiceStatus(namespace []string) (StatusType, error)

ServiceStatus returns the status of the Docker Swarm Servicer.

func (*Container) SharedNetworkID added in v0.2.0

func (c *Container) SharedNetworkID() (networkID string, err error)

SharedNetworkID returns the ID of the shared network.

func (*Container) StartService added in v0.2.0

func (c *Container) StartService(options ServiceOptions) (serviceID string, err error)

StartService starts a docker service.

func (*Container) Status added in v0.2.0

func (c *Container) Status(namespace []string) (StatusType, error)

Status returns the status of a docker container.

func (*Container) StopService added in v0.2.0

func (c *Container) StopService(namespace []string) (err error)

StopService stops a docker service.

func (*Container) TasksError added in v0.2.0

func (c *Container) TasksError(namespace []string) ([]string, error)

TasksError returns the error of matching tasks.

type Mount

type Mount struct {
	Source string
	Target string
}

Mount is a simplify version of mount.Mount.

type Option added in v0.2.0

type Option func(*Container)

Option is a configuration func for Container.

func ClientOption added in v0.2.0

func ClientOption(client docker.CommonAPIClient) Option

ClientOption receives a client which will be used to interact with Docker API.

func TimeoutOption added in v0.2.0

func TimeoutOption(d time.Duration) Option

TimeoutOption receives d which will be set as a timeout value for Docker API calls.

type Port

type Port struct {
	Target    uint32
	Published uint32
}

Port is a simplify version of swarm.PortConfig.

type ServiceOptions

type ServiceOptions struct {
	Image      string
	Namespace  []string
	Ports      []Port
	Mounts     []Mount
	Env        []string // TODO: should be transform to  map[string]string and use the func mapToEnv
	Args       []string
	NetworksID []string
	Labels     map[string]string
}

ServiceOptions is a simplify version of swarm.ServiceSpec.

type StatusType

type StatusType uint

StatusType of the service.

const (
	STOPPED StatusType = 0
	RUNNING StatusType = 1
)

Possible status for services.

Directories

Path Synopsis
Package dockertest provides functionalities for mocking and faking the Docker API.
Package dockertest provides functionalities for mocking and faking the Docker API.

Jump to

Keyboard shortcuts

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