dockerclient

package
v0.0.0-...-b425644 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2019 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

A docker client library.

Index

Constants

View Source
const FAKE_AUTH = `
{
	"Auth": "fakeauth",
	"Email": "fake@email.xx"
}
`

Variables

View Source
var ErrorNotFound = fmt.Errorf("resource not found")

Functions

This section is empty.

Types

type AttachOptions

type AttachOptions struct {
	Logs   bool
	Stream bool
	Stdout io.Writer
	Stderr io.Writer
}

func (*AttachOptions) Encode

func (opts *AttachOptions) Encode() string

type BuildImageOptions

type BuildImageOptions struct {
	Tag     string
	Quite   bool
	NoCache bool

	Callback func(s *JSONMessage)
}

type BuildResponse

type BuildResponse []*JSONMessage

func (BuildResponse) ImageId

func (rsp BuildResponse) ImageId() string

func (BuildResponse) Last

func (rsp BuildResponse) Last() *JSONMessage

type DockerHost

type DockerHost struct {
	Registry string // Registry to use with this docker host.
	// contains filtered or unexported fields
}

func New

func New(host string, port int) (*DockerHost, error)

Create a new connection to a docker host reachable at the given host and port.

func NewViaTunnel

func NewViaTunnel(host, user, password string) (*DockerHost, error)

Create a new connection to a docker host using a SSH tunnel at the given user and host. This is useful as making the docker API public isn't recommended (allows to do stuff you don't want to allow publicly). A SSH connection will be set up and utilized for all communication to the docker API.

func (*DockerHost) AttachContainer

func (dh *DockerHost) AttachContainer(containerId string, opts *AttachOptions) (e error)

Attach to the given container with the given writer.

func (*DockerHost) Build

func (dh *DockerHost) Build(r io.Reader, opts *BuildImageOptions) (imageId string, e error)

Build a container image from a tar or tar.gz Reader

func (*DockerHost) BuildDockerfile

func (dh *DockerHost) BuildDockerfile(dockerfile string, opts *BuildImageOptions) (imageId string, e error)

Create a new image from the given dockerfile. If name is non empty the new image is named accordingly. If a writer is given it is used to send the docker output to.

func (*DockerHost) Container

func (dh *DockerHost) Container(containerId string) (containerInfo *docker.ContainerInfo, e error)

Get the information for the container with the given id.

func (*DockerHost) Containers

func (dh *DockerHost) Containers() (containers []*docker.Container, e error)

Get a list of all ontainers available on the host.

func (*DockerHost) CreateContainer

func (dh *DockerHost) CreateContainer(options *docker.ContainerConfig, name string) (containerId string, e error)

For the given image name and the given container configuration, create a container. If the image name deosn't contain a tag "latest" is used by default.

func (*DockerHost) DeleteImage

func (dh *DockerHost) DeleteImage(name string) error

Delete the given image from the docker host.

func (*DockerHost) HostInfo

func (dh *DockerHost) HostInfo() (*DockerHostInfo, error)

func (*DockerHost) ImageDetails

func (dh *DockerHost) ImageDetails(id string) (imageDetails *docker.ImageDetails, e error)

Get the details for image with the given id (either hash or name).

func (*DockerHost) ImageHistory

func (dh *DockerHost) ImageHistory(id string) (imageHistory *docker.ImageHistory, e error)

Get the given image's history.

func (*DockerHost) Images

func (dh *DockerHost) Images() (images []*docker.Image, e error)

Get the list of all images available on the this host.

func (*DockerHost) ListContainers

func (dh *DockerHost) ListContainers(opts *ListContainersOptions) (containers []*docker.Container, e error)

func (*DockerHost) PullImage

func (dh *DockerHost) PullImage(name string) error

Pull the given image from the registry (part of the image name).

func (*DockerHost) PushImage

func (dh *DockerHost) PushImage(name string, opts *PushImageOptions) error

Push the given image to the registry. The name should be <registry>/<repository>.

func (*DockerHost) RemoveContainer

func (dh *DockerHost) RemoveContainer(containerId string) error

func (*DockerHost) ServerVersion

func (dh *DockerHost) ServerVersion() (*Version, error)

func (*DockerHost) StartContainer

func (dh *DockerHost) StartContainer(containerId string, hostConfig *docker.HostConfig) (e error)

Start the container with the given identifier. The hostConfig can safely be set to nil to use the defaults.

func (*DockerHost) StopContainer

func (dh *DockerHost) StopContainer(containerId string) (e error)

Kill the container with the given identifier.

func (*DockerHost) TagImage

func (dh *DockerHost) TagImage(imageId, repository, tag string) (e error)

Tag the image with the given repository and tag. The tag is optional.

type DockerHostInfo

type DockerHostInfo struct {
	Containers         int
	Images             int
	Driver             string
	DriverStatus       [][]string
	ExecutionDriver    string
	KernelVersion      string
	NCPU               int
	MemTotal           int
	Name               string
	ID                 string
	NFd                int
	NGoroutines        int
	NEventsListener    int
	InitPath           string
	InitSha1           string
	IndexServerAddress string
	MemoryLimit        int
	SwapLimit          int
	Labels             []string
	DockerRootDir      string
	OperatingSystem    string
}

type ErrorDetail

type ErrorDetail struct {
	Code    int
	Message string
}

type JSONError

type JSONError struct {
	Code    int    `json:"code,omitempty"`
	Message string `json:"message,omitempty"`
}

type JSONMessage

type JSONMessage struct {
	Stream   string        `json:"stream,omitempty"`
	Status   string        `json:"status,omitempty"`
	Progress *JSONProgress `json:"progressDetail,omitempty"`
	Id       string        `json:"id,omitempty"`
	From     string        `json:"from,omitempty"`
	Time     int64         `json:"time,omitempty"`
	Error    *JSONError    `json:"errorDetail,omitempty"`
}

func (*JSONMessage) Err

func (msg *JSONMessage) Err() error

type JSONProgress

type JSONProgress struct {
	Current int   `json:"current,omitempty"`
	Total   int   `json:"total,omitempty"`
	Start   int64 `json:"start,omitempty"`
	// contains filtered or unexported fields
}

type ListContainersOptions

type ListContainersOptions struct {
	All    bool
	Limit  int
	Since  string
	Before string
	Size   bool
}

func (*ListContainersOptions) Encode

func (opts *ListContainersOptions) Encode() string

type ProgressDetail

type ProgressDetail struct {
	Current int64
	Total   int64
	Start   int64
}

type PushImageOptions

type PushImageOptions struct {
	Callback func(s *JSONMessage)
}

type Version

type Version struct {
	Arch          string
	GitCommit     string
	GoVersion     string
	KernelVersion string
	Os            string
	Version       string
}

Directories

Path Synopsis
docker related datastructures.
docker related datastructures.

Jump to

Keyboard shortcuts

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