container

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2019 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Container added in v0.2.0

type Container interface {
	Build(path string) (tag string, err error)
	CreateNetwork(namespace string) (id string, err error)
	DeleteNetwork(namespace string) error
	SharedNetworkID() string
	StartService(options ServiceOptions) (serviceID string, err error)
	StopService(namespace string) (err error)
	DeleteVolume(name string) error
}

Container describes the API of container package.

type DockerContainer added in v0.3.0

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

DockerContainer provides high level interactions with Docker API for MESG.

func New added in v0.2.0

func New(nsprefix string) (*DockerContainer, error)

New creates a new Container with given options.

func (*DockerContainer) Build added in v0.3.0

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

Build builds a docker image.

func (*DockerContainer) Cleanup added in v0.16.0

func (c *DockerContainer) Cleanup() error

Cleanup cleans all configuration like shared network of running services.

func (*DockerContainer) CreateNetwork added in v0.3.0

func (c *DockerContainer) CreateNetwork(namespace string) (string, error)

CreateNetwork creates a Docker Network with a namespace. Retruns network id and error.

func (*DockerContainer) DeleteNetwork added in v0.3.0

func (c *DockerContainer) DeleteNetwork(namespace string) error

DeleteNetwork deletes a Docker Network associated with a namespace.

func (*DockerContainer) DeleteVolume added in v0.5.0

func (c *DockerContainer) DeleteVolume(name string) error

DeleteVolume deletes a Docker Volume by name.

func (*DockerContainer) SharedNetworkID added in v0.3.0

func (c *DockerContainer) SharedNetworkID() string

SharedNetworkID returns the ID of the shared network.

func (*DockerContainer) StartService added in v0.3.0

func (c *DockerContainer) StartService(options ServiceOptions) (string, error)

StartService starts a docker service.

func (*DockerContainer) StopService added in v0.3.0

func (c *DockerContainer) StopService(namespace string) error

StopService stops a docker service.

type Mount

type Mount struct {
	Source string
	Target string
	Bind   bool
}

Mount is a simplify version of mount.Mount.

type Network added in v0.4.0

type Network struct {
	// ID of the docker network.
	ID string

	// Alias is an optional attribute to name this service in the
	// network and be able to access to it using this name.
	Alias string
}

Network keeps the network info for service.

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
	Args            []string
	Command         string
	Networks        []Network
	Labels          map[string]string
	StopGracePeriod *time.Duration
}

ServiceOptions is a simplify version of swarm.ServiceSpec.

type Status

type Status uint

Status of the service.

const (
	UNKNOWN Status = iota
	STOPPED
	STARTING
	RUNNING
)

Possible status for services.

Jump to

Keyboard shortcuts

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