Categorygithub.com/mg-rast/go-dockerclient
modulepackage
0.0.0-20150504202712-778286bff2fe
Repository: https://github.com/mg-rast/go-dockerclient.git
Documentation: pkg.go.dev

# README

#go-dockerclient

Build Status Build Status

GoDoc

This package presents a client for the Docker remote API.

For more details, check the remote API documentation.

Example

package main

import (
        "fmt"
        "github.com/fsouza/go-dockerclient"
)

func main() {
        endpoint := "unix:///var/run/docker.sock"
        client, _ := docker.NewClient(endpoint)
        imgs, _ := client.ListImages(docker.ListImagesOptions{All: false})
        for _, img := range imgs {
                fmt.Println("ID: ", img.ID)
                fmt.Println("RepoTags: ", img.RepoTags)
                fmt.Println("Created: ", img.Created)
                fmt.Println("Size: ", img.Size)
                fmt.Println("VirtualSize: ", img.VirtualSize)
                fmt.Println("ParentId: ", img.ParentID)
        }
}

Developing

You can run the tests with:

go get -d ./...
go test ./...

# Packages

Package testing provides a fake implementation of the Docker API, useful for testing purpose.

# Functions

AlwaysRestart returns a restart policy that tells the Docker daemon to always restart the container.
NeverRestart returns a restart policy that tells the Docker daemon to never restart the container on failures.
NewAPIVersion returns an instance of APIVersion for the given string.
NewClient returns a Client instance ready for communication with the given server endpoint.
NewTLSClient returns a Client instance ready for TLS communications with the givens server endpoint, key and certificates .
NewVersionedClient returns a Client instance ready for communication with the given server endpoint, using a specific remote API version.
NewVersionnedTLSClient returns a Client instance ready for TLS communications with the givens server endpoint, key and certificates, using a specific remote API version.
ParseRepositoryTag gets the name of the repository and returns it splitted in two parts: the repository and the tag.
RestartOnFailure returns a restart policy that tells the Docker daemon to restart the container on failures, trying at most maxRetry times.

# Constants

ChangeAdd is the ChangeType for additions to a container.
ChangeDelete is the ChangeType for deletions from a container.
ChangeModify is the ChangeType for container modifications.
These values represent all signals available on Linux, where containers will be running.
These values represent all signals available on Linux, where containers will be running.
These values represent all signals available on Linux, where containers will be running.
These values represent all signals available on Linux, where containers will be running.
These values represent all signals available on Linux, where containers will be running.
These values represent all signals available on Linux, where containers will be running.
These values represent all signals available on Linux, where containers will be running.
These values represent all signals available on Linux, where containers will be running.
These values represent all signals available on Linux, where containers will be running.
These values represent all signals available on Linux, where containers will be running.
These values represent all signals available on Linux, where containers will be running.
These values represent all signals available on Linux, where containers will be running.
These values represent all signals available on Linux, where containers will be running.
These values represent all signals available on Linux, where containers will be running.
These values represent all signals available on Linux, where containers will be running.
These values represent all signals available on Linux, where containers will be running.
These values represent all signals available on Linux, where containers will be running.
These values represent all signals available on Linux, where containers will be running.
These values represent all signals available on Linux, where containers will be running.
These values represent all signals available on Linux, where containers will be running.
These values represent all signals available on Linux, where containers will be running.
These values represent all signals available on Linux, where containers will be running.
These values represent all signals available on Linux, where containers will be running.
These values represent all signals available on Linux, where containers will be running.
These values represent all signals available on Linux, where containers will be running.
These values represent all signals available on Linux, where containers will be running.
These values represent all signals available on Linux, where containers will be running.
These values represent all signals available on Linux, where containers will be running.
These values represent all signals available on Linux, where containers will be running.
These values represent all signals available on Linux, where containers will be running.
These values represent all signals available on Linux, where containers will be running.
These values represent all signals available on Linux, where containers will be running.
These values represent all signals available on Linux, where containers will be running.
These values represent all signals available on Linux, where containers will be running.
These values represent all signals available on Linux, where containers will be running.

# Variables

EOFEvent is sent when the event listener receives an EOF error.
ErrConnectionRefused is returned when the client cannot connect to the given endpoint.
ErrInvalidEndpoint is returned when the endpoint is not a valid HTTP URL.
ErrListenerAlreadyExists is the error returned when the listerner already exists.
ErrMissingOutputStream is the error returned when no output stream is provided to some calls, like BuildImage.
ErrMissingRepo is the error returned when the remote repository is missing.
ErrMultipleContexts is the error returned when both a ContextDir and InputStream are provided in BuildImageOptions.
ErrNoListeners is the error returned when no listeners are available to receive an event.
ErrNoSuchImage is the error returned when the image does not exist.

# Structs

APIContainers represents a container.
APIEvents represents an event returned by the API.
APIImages represent an image returned in the ListImages call.
APIImageSearch reflect the result of a search on the dockerHub See http://goo.gl/xI5lLZ for more details.
APIPort is a type that represents a port mapping returned by the Docker API.
AttachToContainerOptions is the set of options that can be used when attaching to a container.
AuthConfiguration represents authentication options to use in the PushImage method.
AuthConfigurations represents authentication options to use for the PushImage method accommodating the new X-Registry-Config header.
BuildImageOptions present the set of informations available for building an image from a tarfile with a Dockerfile in it.
Change represents a change in a container.
Client is the basic type of this package.
CommitContainerOptions aggregates parameters to the CommitContainer method.
Config is the list of configuration options used when creating a container.
Container is the type encompasing everything about a container - its config, hostconfig, etc.
ContainerAlreadyRunning is the error returned when a given container is already running.
ContainerNotRunning is the error returned when a given container is not running.
CopyFromContainerOptions is the set of options that can be used when copying files or folders from a container.
CreateContainerOptions specify parameters to the CreateContainer function.
CreateExecOptions specify parameters to the CreateExecContainer function.
Error represents failures in the API.
Exec is the type representing a `docker exec` instance and containing the instance ID.
ExecInspect is a type with details about a exec instance, including the exit code if the command has finished running.
ExecProcessConfig is a type describing the command associated to a Exec instance.
ExportContainerOptions is the set of parameters to the ExportContainer method.
ExportImageOptions represent the options for ExportImage Docker API call See http://goo.gl/mi6kvk for more details.
HostConfig contains the container options related to starting a container on a given host.
Image is the type representing a docker image and its various properties.
ImageHistory represent a layer in an image's history returned by the ImageHistory call.
ImagePre012 serves the same purpose as the Image type except that it is for earlier versions of the Docker API (pre-012 to be specific).
ImportImageOptions present the set of informations available for importing an image from a source file or the stdin.
KeyValuePair is a type for generic key/value pairs as used in the Lxc configuration.
KillContainerOptions represents the set of options that can be used in a call to KillContainer.
ListContainersOptions specify parameters to the ListContainers function.
ListImagesOptions specify parameters to the ListImages function.
LoadImageOptions represents the options for LoadImage Docker API Call See http://goo.gl/Y8NNCq for more details.
LogsOptions represents the set of options used when getting logs from a container.
NetworkSettings contains network-related information about a container.
NoSuchContainer is the error returned when a given container does not exist.
NoSuchExec is the error returned when a given exec instance does not exist.
PortBinding represents the host/container port mapping as returned in the `docker inspect` json.
PullImageOptions present the set of options available for pulling an image from a registry.
PushImageOptions represents options to use in the PushImage method.
RemoveContainerOptions encapsulates options to remove a container.
RestartPolicy represents the policy for automatically restarting a container.
StartExecOptions specify parameters to the StartExecContainer function.
State represents the state of a container.
TagImageOptions present the set of options to tag an image.
TopResult represents the list of processes running in a container, as returned by /containers/<id>/top.

# Type aliases

APIVersion is an internal representation of a version of the Remote API.
ChangeType is a type for constants indicating the type of change in a container.
Env represents a list of key-pair represented in the form KEY=VALUE.
Port represents the port number and the protocol, in the form <number>/<protocol>.
PortMapping represents a deprecated field in the `docker inspect` output, and its value as found in NetworkSettings should always be nil.
Signal represents a signal that can be send to the container on KillContainer call.