container

package
v1.0.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Build

func Build(path string) (tag string, err error)

Build a docker image

func Client

func Client() (client *docker.Client, err error)

Client create a docker client ready to use

func CreateNetwork

func CreateNetwork(namespace []string) (networkID string, err error)

CreateNetwork creates a Docker Network with a namespace

func DeleteNetwork

func DeleteNetwork(namespace []string) (err error)

DeleteNetwork deletes a Docker Network associated with a namespace

func FindContainer

func FindContainer(namespace []string) (container types.ContainerJSON, err error)

FindContainer returns a docker container if exist

func FindNetwork

func FindNetwork(namespace []string) (network types.NetworkResource, err error)

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

func FindService

func FindService(namespace []string) (service swarm.Service, err error)

FindService returns the Docker Service. Return error if not found.

func ListServices

func ListServices(label string) (services []swarm.Service, err error)

ListServices returns existing docker services matching a specific label name

func ListTasks added in v1.0.0

func ListTasks(namespace []string) (tasks []swarm.Task, err error)

ListTasks returns all docker tasks

func Namespace

func Namespace(ss []string) string

Namespace creates a namespace from a list of string

func ServiceLogs

func ServiceLogs(namespace []string) (reader io.ReadCloser, err error)

ServiceLogs returns the logs of a service

func SharedNetworkID

func SharedNetworkID() (networkID string, err error)

SharedNetworkID returns the id of the shared network

func StartService

func StartService(options ServiceOptions) (serviceID string, err error)

StartService starts a docker service

func StopService

func StopService(namespace []string) (err error)

StopService stops a docker service

func TasksError added in v1.0.0

func TasksError(namespace []string) (errors []string, err error)

TasksError returns the error of matching tasks

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 Mount

type Mount struct {
	Source string
	Target string
}

Mount is a simplify version of mount.Mount

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
	NetworksID []string
	Labels     map[string]string
}

ServiceOptions is a simplify version of swarm.ServiceSpec that can be created it.

type StatusType

type StatusType uint

StatusType of the service

const (
	STOPPED StatusType = 0
	RUNNING StatusType = 1
)

status for services

func ServiceStatus

func ServiceStatus(namespace []string) (status StatusType, err error)

ServiceStatus return the status of the Docker Swarm Servicer

func Status

func Status(namespace []string) (status StatusType, err error)

Status returns the status of a docker container

Jump to

Keyboard shortcuts

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