Documentation ¶
Index ¶
- Constants
- func AddDockerfileToStream(s *tarutil.Stream, content string)
- func BuildImage(c *Client, tag string, tarball io.Reader) error
- func BuildImageConfig(c *Client, tag string, config *BuildConfig) error
- func BuildImageStream(c *Client, tag string, files *tarutil.Stream) error
- func CopyInTarFile(c *Cont, file, toPath string) error
- func CopyInTarGz(c *Cont, f, target string) error
- func CopyInTarStream(c *Cont, files *tarutil.Stream, target string) error
- func CopyOutTarFile(c *Cont, fromPath, file string) error
- func CopyOutTarGz(c *Cont, target, f string) error
- func CreateNetwork(c *Client, name string) error
- func CreateVolume(c *Client, name string, config *VolumeConfig) (string, error)
- func CreateVolumeIfNotExist(c *Client, name string, config *VolumeConfig) (string, error)
- func HasCont(c *Client, name string) (bool, error)
- func HasImage(c *Client, name string) (bool, error)
- func HasNetwork(c *Client, name string) (bool, error)
- func LoadImages(c *Client, r io.Reader) error
- func LoadImagesFromFile(c *Client, f string) error
- func NewTarStream(dockerfile string) *tarutil.Stream
- func ParseImageTag(s string) (image, tag string)
- func PruneImages(c *Client, opt *PruneImagesOption) error
- func PullImage(c *Client, image, tag string) error
- func ReadContFile(c *Cont, f string) ([]byte, error)
- func RemoveImage(c *Client, name string, opts *RemoveImageOptions) error
- func RemoveNetwork(c *Client, name string) error
- func RemoveVolume(c *Client, name string) error
- func RenameCont(client *Client, from, to string) error
- func RunTask(c *Cont, line string) error
- func RunTasks(c *Cont, lines []string) error
- func SaveImageGz(c *Client, name, file string) error
- func SaveImages(c *Client, names []string, w io.Writer) error
- func SaveImagesGz(c *Client, names []string, f string) error
- func TagImage(c *Client, name, repo, tag string) error
- type BuildConfig
- type Client
- type Cont
- func (c *Cont) CopyInTar(r io.Reader, to string) error
- func (c *Cont) CopyOut(src, destDir string) error
- func (c *Cont) CopyOutFile(src, dest string) error
- func (c *Cont) CopyOutTar(fromPath string, w io.Writer) error
- func (c *Cont) Drop() error
- func (c *Cont) Exec(line string) (int, error)
- func (c *Cont) ExecArgs(args []string) (int, error)
- func (c *Cont) ExecWithSetup(s *ExecSetup) (int, error)
- func (c *Cont) Exists() (bool, error)
- func (c *Cont) FollowLogs(out io.Writer) error
- func (c *Cont) ForceRemove() error
- func (c *Cont) ID() string
- func (c *Cont) Inspect() (*ContInfo, error)
- func (c *Cont) Remove() error
- func (c *Cont) SendSIGINT() error
- func (c *Cont) Start() error
- func (c *Cont) Stop() error
- func (c *Cont) Wait(cond string) (int, error)
- type ContConfig
- type ContDevice
- type ContInfo
- type ContListInfo
- type ContMount
- type ContMountInfo
- type ExecSetup
- type GoBuild
- type ImageInfo
- type ImageListInfo
- type JSONLogConfig
- type NetworkIPAM
- type NetworkIPAMConfig
- type NetworkInfo
- type PortBind
- type PruneImagesOption
- type RemoveImageOptions
- type VolumeConfig
- type VolumeInfo
Constants ¶
const ( NotRunning = "not-running" // Wait till a container finishes running. NextExit = "next-exit" // Wait till the next exit event. Removed = "removed" // Wait till a container is removed. )
Container events to wait for.
const ( MountBind = "bind" MountVolume = "volume" MountTemp = "tmpfs" MountNamedPipe = "npipe" )
Mount types.
const Socket = "/var/run/docker.sock"
Socket is the default socket location.
Variables ¶
This section is empty.
Functions ¶
func AddDockerfileToStream ¶
AddDockerfileToStream adds a DockerFile of content with mode 0600.
func BuildImage ¶
BuildImage builds a docker image using the given tarball stream, and assigns the given tag.
func BuildImageConfig ¶
func BuildImageConfig(c *Client, tag string, config *BuildConfig) error
BuildImageConfig builds the image with the given config.
func BuildImageStream ¶
BuildImageStream builds a docker image using the given tarball stream, and assigns the given tag.
func CopyInTarFile ¶
CopyInTarFile copies a tar file into the container.
func CopyInTarGz ¶
CopyInTarGz copies a gzipped tarball into the container.
func CopyInTarStream ¶
CopyInTarStream copies in a tarutil.Stream into the container.
func CopyOutTarFile ¶
CopyOutTarFile copies a file or a directory out of the container into a tarball file.
func CopyOutTarGz ¶
CopyOutTarGz copies out a directory of file into a gzipped tarball.
func CreateNetwork ¶
CreateNetwork creates a network with the given name.
func CreateVolume ¶
func CreateVolume( c *Client, name string, config *VolumeConfig, ) (string, error)
CreateVolume creates a new volume
func CreateVolumeIfNotExist ¶
func CreateVolumeIfNotExist( c *Client, name string, config *VolumeConfig, ) (string, error)
CreateVolumeIfNotExist creates the volume if the volume of the given name does not exist.
func HasNetwork ¶
HasNetwork checks if a network exists.
func LoadImages ¶
LoadImages loads a tarball stream into Docker repository.
func LoadImagesFromFile ¶
LoadImagesFromFile loads a tarball file into Docker repository.
func NewTarStream ¶
NewTarStream creates a stream with a docker file.
func ParseImageTag ¶
ParseImageTag parses "image:tag" into ("image", "tag").
func PruneImages ¶
func PruneImages(c *Client, opt *PruneImagesOption) error
PruneImages prunes the unused images.
func ReadContFile ¶
ReadContFile reads out a single file from a container.
func RemoveImage ¶
func RemoveImage(c *Client, name string, opts *RemoveImageOptions) error
RemoveImage removes a local docker image.
func RemoveNetwork ¶
RemoveNetwork removes a network of the given name.
func RenameCont ¶
RenameCont renames an existing container.
func RunTasks ¶
RunTasks runs a series of command lines. All commands must succeed and return 0 exit value.
func SaveImageGz ¶
SaveImageGz saves a single image to a gzipped tarball file.
func SaveImages ¶
SaveImages saves built images as a tarball stream into the writer.
func SaveImagesGz ¶
SaveImagesGz saves images to a gzipped tarball file.
Types ¶
type BuildConfig ¶
type BuildConfig struct { Tarball io.Reader Files *tarutil.Stream Args map[string]string UseCache bool }
BuildConfig is the configuration for building an image.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a docker daemon client that can be used to issue docker commands.
func NewUnixClient ¶
NewUnixClient creates a new unix domain socket client. When sock is empty, "/var/run/docker.sock" is used.
type Cont ¶
type Cont struct {
// contains filtered or unexported fields
}
Cont wraps a container.
func CreateCont ¶
func CreateCont(c *Client, image string, config *ContConfig) (*Cont, error)
CreateCont creates a new container with the given config.
func (*Cont) CopyOutFile ¶
CopyOutFile copies a single file into the destination.
func (*Cont) CopyOutTar ¶
CopyOutTar copies a file or a directory out of the container into a tarball stream.
func (*Cont) ExecArgs ¶
ExecArgs executes a command with the given args. Returns the exit value or any error.
func (*Cont) ExecWithSetup ¶
ExecWithSetup executes a command with the given setup.
func (*Cont) FollowLogs ¶
FollowLogs follows the container's logs and forwards it into the writer.
func (*Cont) ForceRemove ¶
ForceRemove force removes the container.
func (*Cont) SendSIGINT ¶
SendSIGINT sends SIGINT (Ctrl-C) to the container.
type ContConfig ¶
type ContConfig struct { Name string Hostname string Mounts []*ContMount Devices []*ContDevice TCPBinds []*PortBind UDPBinds []*PortBind Env map[string]string Network string Privileged bool AlwaysRestart bool // Use restart policy "always". AutoRestart bool // Use restart policy "unless-stopped". Cmd []string WorkDir string Labels map[string]string JSONLogConfig *JSONLogConfig }
ContConfig contains the configuration for creating a container.
type ContDevice ¶
ContDevice specifies devices to map into the container.
type ContInfo ¶
type ContInfo struct { ID string `json:"Id"` Image string Config struct { Image string Hostname string Labels map[string]string } State struct { ExitCode int Error string Running bool } HostConfig struct { Mounts []*ContMountInfo } }
ContInfo is the inspection result of a container.
type ContListInfo ¶
type ContListInfo struct { ID string `json:"Id"` Names []string Image string ImageID string Labels map[string]string }
ContListInfo is the container info got from listing.
func ListContsWithLabel ¶
func ListContsWithLabel(c *Client, label string) ([]*ContListInfo, error)
ListContsWithLabel lists all containers with the given label.
type ContMountInfo ¶
type ContMountInfo struct { Type string Target string Source string ReadOnly bool `json:",omitempty"` Consistency string `json:",omitempty"` }
ContMountInfo is the information of a mount in the container.
type ExecSetup ¶
type ExecSetup struct { Cmd []string Env []string `json:",omitempty"` User string `json:",omitempty"` WorkingDir string `json:",omitempty"` Stdin io.Reader Stdout io.Writer Stderr io.Writer }
ExecSetup contains the setup arguments to run a command inside a running container.
type GoBuild ¶
GoBuild is a golang build.
func ShanhuBuild ¶
ShanhuBuild returns the golang build for shanhu releases.
type ImageInfo ¶
type ImageInfo struct { ID string `json:"Id,omitempty"` Parent string VirtualSize int64 RepoTags []string `json:",omitempty"` RepoDigests []string `json:",omitempty"` }
ImageInfo is the inspection result of an image.
type ImageListInfo ¶
type ImageListInfo struct { ID string `json:"Id,omitempty"` RepoTags []string Labels map[string]string }
ImageListInfo is the information of an image listing.
type JSONLogConfig ¶
JSONLogConfig contains the logging option for a docker.
func LimitedJSONLog ¶
func LimitedJSONLog() *JSONLogConfig
LimitedJSONLog returns a log config that has max-size=10 and max-file=3 as json-file logging options.
type NetworkIPAM ¶
type NetworkIPAM struct {
Config []*NetworkIPAMConfig `json:",omitempty"`
}
NetworkIPAM is the configuration section of IP address management.
type NetworkIPAMConfig ¶
NetworkIPAMConfig is the IP address management config entry.
type NetworkInfo ¶
type NetworkInfo struct { Name string ID string `json:"Id"` Driver string IPAM *NetworkIPAM `json:",omitempty"` }
NetworkInfo contains information of a docker network.
func InspectNetwork ¶
func InspectNetwork(c *Client, name string) (*NetworkInfo, error)
InspectNetwork inspects a network.
type PruneImagesOption ¶
type PruneImagesOption struct {
Unused bool
}
PruneImagesOption provides options for unused image pruning.
type RemoveImageOptions ¶
type RemoveImageOptions struct { Force bool // Force remove the image NoPrune bool // NoPrune keeps un-tagged images after removal }
RemoveImageOptions defines options when docker images are removed.
type VolumeConfig ¶
VolumeConfig is the configuration of a new volume.
type VolumeInfo ¶
VolumeInfo contains the information of a volume
func InspectVolume ¶
func InspectVolume(c *Client, name string) (*VolumeInfo, error)
InspectVolume inspects a volume.
func ListVolumesWithLabel ¶
func ListVolumesWithLabel(c *Client, label string) ([]*VolumeInfo, error)
ListVolumesWithLabel lists all volumes with the specific label.
Source Files ¶
- api_version.go
- build.go
- client.go
- cont.go
- cont_config.go
- cont_info.go
- copy.go
- create_cont.go
- env_var.go
- exec.go
- filters.go
- go_build.go
- gzip_file.go
- image_tag.go
- images.go
- inspect_cont.go
- list_cont.go
- log_dispatcher.go
- log_sink.go
- network.go
- paths.go
- pull.go
- read_cont_file.go
- stream_sink.go
- task.go
- url_query.go
- volume.go
- write_tar.go
- write_to_reader.go