containers

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package containers is a wrapper around official Docker API.

Index

Constants

View Source
const (
	UNKNOWN = iota
	START   = iota
	STOP    = iota
	KILL    = iota
)

Constatns used inside the DockerCtlMessage struct

View Source
const (
	DefaultTimeout = 45 * time.Second
)

Default values for Docker host endpoint

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client structure contains all info about client

func New

func New(timeout time.Duration) (*Client, error)

New creates new client instance according to endpoint url from ENV with default hostconfig

func (Client) Close

func (c Client) Close() error

func (Client) ContainerStatus

func (c Client) ContainerStatus(ctx context.Context, containerID string) (status string, err error)

ContainerStatus gets information about container's status, Can be one of "created", "running", "paused", "restarting", "removing", "exited", or "dead"

func (Client) GetRawClient

func (c Client) GetRawClient() *client.Client

func (Client) KillContainer

func (c Client) KillContainer(ctx context.Context, containerID string) (status string, err error)

KillContainer kills container specified by the containerID string

func (Client) ListContainers

func (c Client) ListContainers(ctx context.Context) (conts []types.Container, err error)

ListContainers lists all containers running and stopped on the machine

func (Client) PrepareMockContainer

func (c Client) PrepareMockContainer(ctx context.Context) (id string, err error)

func (Client) RemoveMockContainer

func (c Client) RemoveMockContainer(ctx context.Context, containerID string) (err error)

func (Client) StartContainer

func (c Client) StartContainer(ctx context.Context, containerID string) (status string, err error)

StartContainer starts container specified by the containerID string

func (Client) StopContainer

func (c Client) StopContainer(ctx context.Context, containerID string) (status string, err error)

StopContainer stops container specified by the containerID string

type Opts

type Opts struct {
	ContainerID string
}

Jump to

Keyboard shortcuts

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