Bump godep for go-dockerclient

This commit is contained in:
Paul Morie 2016-04-19 16:25:56 -04:00
parent 0937e87449
commit d68dd18694
10 changed files with 174 additions and 76 deletions

36
Godeps/Godeps.json generated
View File

@ -154,75 +154,75 @@
}, },
{ {
"ImportPath": "github.com/fsouza/go-dockerclient", "ImportPath": "github.com/fsouza/go-dockerclient",
"Rev": "086d16d0c1428734a75065d2aa64e248093d2790" "Rev": "ff3d4ee4753705a048db1855113026395c26a79a"
}, },
{ {
"ImportPath": "github.com/fsouza/go-dockerclient/external/github.com/Sirupsen/logrus", "ImportPath": "github.com/fsouza/go-dockerclient/external/github.com/Sirupsen/logrus",
"Rev": "086d16d0c1428734a75065d2aa64e248093d2790" "Rev": "ff3d4ee4753705a048db1855113026395c26a79a"
}, },
{ {
"ImportPath": "github.com/fsouza/go-dockerclient/external/github.com/docker/docker/opts", "ImportPath": "github.com/fsouza/go-dockerclient/external/github.com/docker/docker/opts",
"Rev": "086d16d0c1428734a75065d2aa64e248093d2790" "Rev": "ff3d4ee4753705a048db1855113026395c26a79a"
}, },
{ {
"ImportPath": "github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/archive", "ImportPath": "github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/archive",
"Rev": "086d16d0c1428734a75065d2aa64e248093d2790" "Rev": "ff3d4ee4753705a048db1855113026395c26a79a"
}, },
{ {
"ImportPath": "github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/fileutils", "ImportPath": "github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/fileutils",
"Rev": "086d16d0c1428734a75065d2aa64e248093d2790" "Rev": "ff3d4ee4753705a048db1855113026395c26a79a"
}, },
{ {
"ImportPath": "github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/homedir", "ImportPath": "github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/homedir",
"Rev": "086d16d0c1428734a75065d2aa64e248093d2790" "Rev": "ff3d4ee4753705a048db1855113026395c26a79a"
}, },
{ {
"ImportPath": "github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/idtools", "ImportPath": "github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/idtools",
"Rev": "086d16d0c1428734a75065d2aa64e248093d2790" "Rev": "ff3d4ee4753705a048db1855113026395c26a79a"
}, },
{ {
"ImportPath": "github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/ioutils", "ImportPath": "github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/ioutils",
"Rev": "086d16d0c1428734a75065d2aa64e248093d2790" "Rev": "ff3d4ee4753705a048db1855113026395c26a79a"
}, },
{ {
"ImportPath": "github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/longpath", "ImportPath": "github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/longpath",
"Rev": "086d16d0c1428734a75065d2aa64e248093d2790" "Rev": "ff3d4ee4753705a048db1855113026395c26a79a"
}, },
{ {
"ImportPath": "github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/pools", "ImportPath": "github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/pools",
"Rev": "086d16d0c1428734a75065d2aa64e248093d2790" "Rev": "ff3d4ee4753705a048db1855113026395c26a79a"
}, },
{ {
"ImportPath": "github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/promise", "ImportPath": "github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/promise",
"Rev": "086d16d0c1428734a75065d2aa64e248093d2790" "Rev": "ff3d4ee4753705a048db1855113026395c26a79a"
}, },
{ {
"ImportPath": "github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/stdcopy", "ImportPath": "github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/stdcopy",
"Rev": "086d16d0c1428734a75065d2aa64e248093d2790" "Rev": "ff3d4ee4753705a048db1855113026395c26a79a"
}, },
{ {
"ImportPath": "github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/system", "ImportPath": "github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/system",
"Rev": "086d16d0c1428734a75065d2aa64e248093d2790" "Rev": "ff3d4ee4753705a048db1855113026395c26a79a"
}, },
{ {
"ImportPath": "github.com/fsouza/go-dockerclient/external/github.com/docker/go-units", "ImportPath": "github.com/fsouza/go-dockerclient/external/github.com/docker/go-units",
"Rev": "086d16d0c1428734a75065d2aa64e248093d2790" "Rev": "ff3d4ee4753705a048db1855113026395c26a79a"
}, },
{ {
"ImportPath": "github.com/fsouza/go-dockerclient/external/github.com/hashicorp/go-cleanhttp", "ImportPath": "github.com/fsouza/go-dockerclient/external/github.com/hashicorp/go-cleanhttp",
"Rev": "086d16d0c1428734a75065d2aa64e248093d2790" "Rev": "ff3d4ee4753705a048db1855113026395c26a79a"
}, },
{ {
"ImportPath": "github.com/fsouza/go-dockerclient/external/github.com/opencontainers/runc/libcontainer/user", "ImportPath": "github.com/fsouza/go-dockerclient/external/github.com/opencontainers/runc/libcontainer/user",
"Rev": "086d16d0c1428734a75065d2aa64e248093d2790" "Rev": "ff3d4ee4753705a048db1855113026395c26a79a"
}, },
{ {
"ImportPath": "github.com/fsouza/go-dockerclient/external/golang.org/x/net/context", "ImportPath": "github.com/fsouza/go-dockerclient/external/golang.org/x/net/context",
"Rev": "086d16d0c1428734a75065d2aa64e248093d2790" "Rev": "ff3d4ee4753705a048db1855113026395c26a79a"
}, },
{ {
"ImportPath": "github.com/fsouza/go-dockerclient/external/golang.org/x/sys/unix", "ImportPath": "github.com/fsouza/go-dockerclient/external/golang.org/x/sys/unix",
"Rev": "086d16d0c1428734a75065d2aa64e248093d2790" "Rev": "ff3d4ee4753705a048db1855113026395c26a79a"
}, },
{ {
"ImportPath": "github.com/garyburd/redigo/internal", "ImportPath": "github.com/garyburd/redigo/internal",

View File

@ -1,25 +1,24 @@
language: go language: go
sudo: required sudo: required
go: go:
- 1.3.3
- 1.4.2 - 1.4.2
- 1.5.3 - 1.5.4
- 1.6 - 1.6.1
- tip - tip
os:
- linux
- osx
env: env:
- GOARCH=amd64 DOCKER_VERSION=1.7.1
- GOARCH=386 DOCKER_VERSION=1.7.1
- GOARCH=amd64 DOCKER_VERSION=1.8.3
- GOARCH=386 DOCKER_VERSION=1.8.3
- GOARCH=amd64 DOCKER_VERSION=1.9.1 - GOARCH=amd64 DOCKER_VERSION=1.9.1
- GOARCH=386 DOCKER_VERSION=1.9.1 - GOARCH=386 DOCKER_VERSION=1.9.1
- GOARCH=amd64 DOCKER_VERSION=1.10.3 - GOARCH=amd64 DOCKER_VERSION=1.10.3
- GOARCH=386 DOCKER_VERSION=1.10.3 - GOARCH=386 DOCKER_VERSION=1.10.3
- GOARCH=amd64 DOCKER_VERSION=1.11.0
- GOARCH=386 DOCKER_VERSION=1.11.0
install: install:
- travis_retry make prepare_docker - travis_retry travis-scripts/install.bash
script: script:
- travis-scripts/run-tests.bash - travis-scripts/run-tests.bash
- DOCKER_HOST=tcp://127.0.0.1:2375 make integration
services: services:
- docker - docker
matrix: matrix:

View File

@ -101,6 +101,7 @@ Peter Jihoon Kim <raingrove@gmail.com>
Phil Lu <lu@stackengine.com> Phil Lu <lu@stackengine.com>
Philippe Lafoucrière <philippe.lafoucriere@tech-angels.com> Philippe Lafoucrière <philippe.lafoucriere@tech-angels.com>
Rafe Colton <rafael.colton@gmail.com> Rafe Colton <rafael.colton@gmail.com>
Raphaël Pinson <raphael.pinson@camptocamp.com>
Rob Miller <rob@kalistra.com> Rob Miller <rob@kalistra.com>
Robert Williamson <williamson.robert@gmail.com> Robert Williamson <williamson.robert@gmail.com>
Roman Khlystik <roman.khlystik@gmail.com> Roman Khlystik <roman.khlystik@gmail.com>
@ -109,6 +110,7 @@ Sam Rijs <srijs@airpost.net>
Sami Wagiaalla <swagiaal@redhat.com> Sami Wagiaalla <swagiaal@redhat.com>
Samuel Archambault <sarchambault@lapresse.ca> Samuel Archambault <sarchambault@lapresse.ca>
Samuel Karp <skarp@amazon.com> Samuel Karp <skarp@amazon.com>
Seth Jennings <sjenning@redhat.com>
Silas Sewell <silas@sewell.org> Silas Sewell <silas@sewell.org>
Simon Eskildsen <sirup@sirupsen.com> Simon Eskildsen <sirup@sirupsen.com>
Simon Menke <simon.menke@gmail.com> Simon Menke <simon.menke@gmail.com>

View File

@ -28,7 +28,6 @@ lint:
exit $${status:-0} exit $${status:-0}
vet: vet:
@-go get -v golang.org/x/tools/cmd/vet
$(foreach pkg,$(PKGS),go vet $(pkg);) $(foreach pkg,$(PKGS),go vet $(pkg);)
fmt: fmt:
@ -39,15 +38,6 @@ fmtcheck:
[ -n "$${output}" ] && echo "$${output}" && export status=1; \ [ -n "$${output}" ] && echo "$${output}" && export status=1; \
exit $${status:-0} exit $${status:-0}
prepare_docker:
sudo stop docker || true
sudo rm -rf /var/lib/docker
sudo rm -f `which docker`
sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main" | sudo tee /etc/apt/sources.list.d/docker.list
sudo apt-get update
sudo apt-get install docker-engine=$(DOCKER_VERSION)-0~$(shell lsb_release -cs) -y --force-yes -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold"
pretest: lint vet fmtcheck pretest: lint vet fmtcheck
gotest: gotest:

View File

@ -1,10 +1,11 @@
# go-dockerclient # go-dockerclient
[![Travis](https://img.shields.io/travis/fsouza/go-dockerclient.svg?style=flat-square)](https://travis-ci.org/fsouza/go-dockerclient) [![Travis](https://img.shields.io/travis/fsouza/go-dockerclient/master.svg?style=flat-square)](https://travis-ci.org/fsouza/go-dockerclient)
[![GoDoc](https://img.shields.io/badge/api-Godoc-blue.svg?style=flat-square)](https://godoc.org/github.com/fsouza/go-dockerclient) [![GoDoc](https://img.shields.io/badge/api-Godoc-blue.svg?style=flat-square)](https://godoc.org/github.com/fsouza/go-dockerclient)
This package presents a client for the Docker remote API. It also provides This package presents a client for the Docker remote API. It also provides
support for the extensions in the [Swarm API](https://docs.docker.com/swarm/swarm-api/). support for the extensions in the [Swarm API](https://docs.docker.com/swarm/swarm-api/).
It currently supports the Docker API up to version 1.23.
This package also provides support for docker's network API, which is a simple This package also provides support for docker's network API, which is a simple
passthrough to the libnetwork remote API. Note that docker's network API is passthrough to the libnetwork remote API. Note that docker's network API is

View File

@ -11,6 +11,7 @@ import (
"errors" "errors"
"fmt" "fmt"
"io" "io"
"io/ioutil"
"os" "os"
"path" "path"
"strings" "strings"
@ -122,17 +123,36 @@ func authConfigs(confs map[string]dockerConfig) (*AuthConfigurations, error) {
return c, nil return c, nil
} }
// AuthStatus returns the authentication status for Docker API versions >= 1.23.
type AuthStatus struct {
Status string `json:"Status,omitempty" yaml:"Status,omitempty"`
IdentityToken string `json:"IdentityToken,omitempty" yaml:"IdentityToken,omitempty"`
}
// AuthCheck validates the given credentials. It returns nil if successful. // AuthCheck validates the given credentials. It returns nil if successful.
// //
// See https://goo.gl/m2SleN for more details. // For Docker API versions >= 1.23, the AuthStatus struct will be populated, otherwise it will be empty.`
func (c *Client) AuthCheck(conf *AuthConfiguration) error { //
// See https://goo.gl/6nsZkH for more details.
func (c *Client) AuthCheck(conf *AuthConfiguration) (AuthStatus, error) {
var authStatus AuthStatus
if conf == nil { if conf == nil {
return fmt.Errorf("conf is nil") return authStatus, fmt.Errorf("conf is nil")
} }
resp, err := c.do("POST", "/auth", doOptions{data: conf}) resp, err := c.do("POST", "/auth", doOptions{data: conf})
if err != nil { if err != nil {
return err return authStatus, err
} }
resp.Body.Close() defer resp.Body.Close()
return nil data, err := ioutil.ReadAll(resp.Body)
if err != nil {
return authStatus, err
}
if len(data) == 0 {
return authStatus, nil
}
if err := json.Unmarshal(data, &authStatus); err != nil {
return authStatus, err
}
return authStatus, nil
} }

View File

@ -14,6 +14,8 @@ import (
"strconv" "strconv"
"strings" "strings"
"time" "time"
"github.com/fsouza/go-dockerclient/external/github.com/docker/go-units"
) )
// ErrContainerAlreadyExists is the error returned by CreateContainer when the // ErrContainerAlreadyExists is the error returned by CreateContainer when the
@ -40,6 +42,17 @@ type APIPort struct {
IP string `json:"IP,omitempty" yaml:"IP,omitempty"` IP string `json:"IP,omitempty" yaml:"IP,omitempty"`
} }
// APIMount represents a mount point for a container.
type APIMount struct {
Name string `json:"Name,omitempty" yaml:"Name,omitempty"`
Source string `json:"Source,omitempty" yaml:"Source,omitempty"`
Destination string `json:"Destination,omitempty" yaml:"Destination,omitempty"`
Driver string `json:"Driver,omitempty" yaml:"Driver,omitempty"`
Mode string `json:"Mode,omitempty" yaml:"Mode,omitempty"`
RW bool `json:"RW,omitempty" yaml:"RW,omitempty"`
Propogation string `json:"Propogation,omitempty" yaml:"Propogation,omitempty"`
}
// APIContainers represents each container in the list returned by // APIContainers represents each container in the list returned by
// ListContainers. // ListContainers.
type APIContainers struct { type APIContainers struct {
@ -47,6 +60,7 @@ type APIContainers struct {
Image string `json:"Image,omitempty" yaml:"Image,omitempty"` Image string `json:"Image,omitempty" yaml:"Image,omitempty"`
Command string `json:"Command,omitempty" yaml:"Command,omitempty"` Command string `json:"Command,omitempty" yaml:"Command,omitempty"`
Created int64 `json:"Created,omitempty" yaml:"Created,omitempty"` Created int64 `json:"Created,omitempty" yaml:"Created,omitempty"`
State string `json:"State,omitempty" yaml:"State,omitempty"`
Status string `json:"Status,omitempty" yaml:"Status,omitempty"` Status string `json:"Status,omitempty" yaml:"Status,omitempty"`
Ports []APIPort `json:"Ports,omitempty" yaml:"Ports,omitempty"` Ports []APIPort `json:"Ports,omitempty" yaml:"Ports,omitempty"`
SizeRw int64 `json:"SizeRw,omitempty" yaml:"SizeRw,omitempty"` SizeRw int64 `json:"SizeRw,omitempty" yaml:"SizeRw,omitempty"`
@ -54,6 +68,7 @@ type APIContainers struct {
Names []string `json:"Names,omitempty" yaml:"Names,omitempty"` Names []string `json:"Names,omitempty" yaml:"Names,omitempty"`
Labels map[string]string `json:"Labels,omitempty" yaml:"Labels,omitempty"` Labels map[string]string `json:"Labels,omitempty" yaml:"Labels,omitempty"`
Networks NetworkList `json:"NetworkSettings,omitempty" yaml:"NetworkSettings,omitempty"` Networks NetworkList `json:"NetworkSettings,omitempty" yaml:"NetworkSettings,omitempty"`
Mounts []APIMount `json:"Mounts,omitempty" yaml:"Mounts,omitempty"`
} }
// NetworkList encapsulates a map of networks, as returned by the Docker API in // NetworkList encapsulates a map of networks, as returned by the Docker API in
@ -99,26 +114,73 @@ func (p Port) Proto() string {
// State represents the state of a container. // State represents the state of a container.
type State struct { type State struct {
Running bool `json:"Running,omitempty" yaml:"Running,omitempty"` Status string `json:"Status,omitempty" yaml:"Status,omitempty"`
Paused bool `json:"Paused,omitempty" yaml:"Paused,omitempty"` Running bool `json:"Running,omitempty" yaml:"Running,omitempty"`
Restarting bool `json:"Restarting,omitempty" yaml:"Restarting,omitempty"` Paused bool `json:"Paused,omitempty" yaml:"Paused,omitempty"`
OOMKilled bool `json:"OOMKilled,omitempty" yaml:"OOMKilled,omitempty"` Restarting bool `json:"Restarting,omitempty" yaml:"Restarting,omitempty"`
Pid int `json:"Pid,omitempty" yaml:"Pid,omitempty"` OOMKilled bool `json:"OOMKilled,omitempty" yaml:"OOMKilled,omitempty"`
ExitCode int `json:"ExitCode,omitempty" yaml:"ExitCode,omitempty"` RemovalInProgress bool `json:"RemovalInProgress,omitempty" yaml:"RemovalInProgress,omitempty"`
Error string `json:"Error,omitempty" yaml:"Error,omitempty"` Dead bool `json:"Dead,omitempty" yaml:"Dead,omitempty"`
StartedAt time.Time `json:"StartedAt,omitempty" yaml:"StartedAt,omitempty"` Pid int `json:"Pid,omitempty" yaml:"Pid,omitempty"`
FinishedAt time.Time `json:"FinishedAt,omitempty" yaml:"FinishedAt,omitempty"` ExitCode int `json:"ExitCode,omitempty" yaml:"ExitCode,omitempty"`
Error string `json:"Error,omitempty" yaml:"Error,omitempty"`
StartedAt time.Time `json:"StartedAt,omitempty" yaml:"StartedAt,omitempty"`
FinishedAt time.Time `json:"FinishedAt,omitempty" yaml:"FinishedAt,omitempty"`
} }
// String returns the string representation of a state. // String returns a human-readable description of the state
func (s *State) String() string { func (s *State) String() string {
if s.Running {
if s.Paused {
return fmt.Sprintf("Up %s (Paused)", units.HumanDuration(time.Now().UTC().Sub(s.StartedAt)))
}
if s.Restarting {
return fmt.Sprintf("Restarting (%d) %s ago", s.ExitCode, units.HumanDuration(time.Now().UTC().Sub(s.FinishedAt)))
}
return fmt.Sprintf("Up %s", units.HumanDuration(time.Now().UTC().Sub(s.StartedAt)))
}
if s.RemovalInProgress {
return "Removal In Progress"
}
if s.Dead {
return "Dead"
}
if s.StartedAt.IsZero() {
return "Created"
}
if s.FinishedAt.IsZero() {
return ""
}
return fmt.Sprintf("Exited (%d) %s ago", s.ExitCode, units.HumanDuration(time.Now().UTC().Sub(s.FinishedAt)))
}
// StateString returns a single string to describe state
func (s *State) StateString() string {
if s.Running { if s.Running {
if s.Paused { if s.Paused {
return "paused" return "paused"
} }
return fmt.Sprintf("Up %s", time.Now().UTC().Sub(s.StartedAt)) if s.Restarting {
return "restarting"
}
return "running"
} }
return fmt.Sprintf("Exit %d", s.ExitCode)
if s.Dead {
return "dead"
}
if s.StartedAt.IsZero() {
return "created"
}
return "exited"
} }
// PortBinding represents the host/container port mapping as returned in the // PortBinding represents the host/container port mapping as returned in the
@ -213,6 +275,7 @@ type Config struct {
MemorySwap int64 `json:"MemorySwap,omitempty" yaml:"MemorySwap,omitempty"` MemorySwap int64 `json:"MemorySwap,omitempty" yaml:"MemorySwap,omitempty"`
MemoryReservation int64 `json:"MemoryReservation,omitempty" yaml:"MemoryReservation,omitempty"` MemoryReservation int64 `json:"MemoryReservation,omitempty" yaml:"MemoryReservation,omitempty"`
KernelMemory int64 `json:"KernelMemory,omitempty" yaml:"KernelMemory,omitempty"` KernelMemory int64 `json:"KernelMemory,omitempty" yaml:"KernelMemory,omitempty"`
PidsLimit int64 `json:"PidsLimit,omitempty" yaml:"PidsLimit,omitempty"`
CPUShares int64 `json:"CpuShares,omitempty" yaml:"CpuShares,omitempty"` CPUShares int64 `json:"CpuShares,omitempty" yaml:"CpuShares,omitempty"`
CPUSet string `json:"Cpuset,omitempty" yaml:"Cpuset,omitempty"` CPUSet string `json:"Cpuset,omitempty" yaml:"Cpuset,omitempty"`
AttachStdin bool `json:"AttachStdin,omitempty" yaml:"AttachStdin,omitempty"` AttachStdin bool `json:"AttachStdin,omitempty" yaml:"AttachStdin,omitempty"`
@ -279,6 +342,12 @@ type SwarmNode struct {
Labels map[string]string `json:"Labels,omitempty" yaml:"Labels,omitempty"` Labels map[string]string `json:"Labels,omitempty" yaml:"Labels,omitempty"`
} }
// GraphDriver contains information about the GraphDriver used by the container
type GraphDriver struct {
Name string `json:"Name,omitempty" yaml:"Name,omitempty"`
Data map[string]string `json:"Data,omitempty" yaml:"Data,omitempty"`
}
// Container is the type encompasing everything about a container - its config, // Container is the type encompasing everything about a container - its config,
// hostconfig, etc. // hostconfig, etc.
type Container struct { type Container struct {
@ -306,10 +375,11 @@ type Container struct {
Driver string `json:"Driver,omitempty" yaml:"Driver,omitempty"` Driver string `json:"Driver,omitempty" yaml:"Driver,omitempty"`
Mounts []Mount `json:"Mounts,omitempty" yaml:"Mounts,omitempty"` Mounts []Mount `json:"Mounts,omitempty" yaml:"Mounts,omitempty"`
Volumes map[string]string `json:"Volumes,omitempty" yaml:"Volumes,omitempty"` Volumes map[string]string `json:"Volumes,omitempty" yaml:"Volumes,omitempty"`
VolumesRW map[string]bool `json:"VolumesRW,omitempty" yaml:"VolumesRW,omitempty"` VolumesRW map[string]bool `json:"VolumesRW,omitempty" yaml:"VolumesRW,omitempty"`
HostConfig *HostConfig `json:"HostConfig,omitempty" yaml:"HostConfig,omitempty"` HostConfig *HostConfig `json:"HostConfig,omitempty" yaml:"HostConfig,omitempty"`
ExecIDs []string `json:"ExecIDs,omitempty" yaml:"ExecIDs,omitempty"` ExecIDs []string `json:"ExecIDs,omitempty" yaml:"ExecIDs,omitempty"`
GraphDriver *GraphDriver `json:"GraphDriver,omitempty" yaml:"GraphDriver,omitempty"`
RestartCount int `json:"RestartCount,omitempty" yaml:"RestartCount,omitempty"` RestartCount int `json:"RestartCount,omitempty" yaml:"RestartCount,omitempty"`
@ -320,16 +390,17 @@ type Container struct {
// //
// See https://goo.gl/Y6fXUy for more details. // See https://goo.gl/Y6fXUy for more details.
type UpdateContainerOptions struct { type UpdateContainerOptions struct {
BlkioWeight int `json:"BlkioWeight"` BlkioWeight int `json:"BlkioWeight"`
CPUShares int `json:"CpuShares"` CPUShares int `json:"CpuShares"`
CPUPeriod int `json:"CpuPeriod"` CPUPeriod int `json:"CpuPeriod"`
CPUQuota int `json:"CpuQuota"` CPUQuota int `json:"CpuQuota"`
CpusetCpus string `json:"CpusetCpus"` CpusetCpus string `json:"CpusetCpus"`
CpusetMems string `json:"CpusetMems"` CpusetMems string `json:"CpusetMems"`
Memory int `json:"Memory"` Memory int `json:"Memory"`
MemorySwap int `json:"MemorySwap"` MemorySwap int `json:"MemorySwap"`
MemoryReservation int `json:"MemoryReservation"` MemoryReservation int `json:"MemoryReservation"`
KernelMemory int `json:"KernelMemory"` KernelMemory int `json:"KernelMemory"`
RestartPolicy RestartPolicy `json:"RestartPolicy,omitempty"`
} }
// UpdateContainer updates the container at ID with the options // UpdateContainer updates the container at ID with the options
@ -541,6 +612,7 @@ type HostConfig struct {
DNSSearch []string `json:"DnsSearch,omitempty" yaml:"DnsSearch,omitempty"` DNSSearch []string `json:"DnsSearch,omitempty" yaml:"DnsSearch,omitempty"`
ExtraHosts []string `json:"ExtraHosts,omitempty" yaml:"ExtraHosts,omitempty"` ExtraHosts []string `json:"ExtraHosts,omitempty" yaml:"ExtraHosts,omitempty"`
VolumesFrom []string `json:"VolumesFrom,omitempty" yaml:"VolumesFrom,omitempty"` VolumesFrom []string `json:"VolumesFrom,omitempty" yaml:"VolumesFrom,omitempty"`
UsernsMode string `json:"UsernsMode,omitempty" yaml:"UsernsMode,omitempty"`
NetworkMode string `json:"NetworkMode,omitempty" yaml:"NetworkMode,omitempty"` NetworkMode string `json:"NetworkMode,omitempty" yaml:"NetworkMode,omitempty"`
IpcMode string `json:"IpcMode,omitempty" yaml:"IpcMode,omitempty"` IpcMode string `json:"IpcMode,omitempty" yaml:"IpcMode,omitempty"`
PidMode string `json:"PidMode,omitempty" yaml:"PidMode,omitempty"` PidMode string `json:"PidMode,omitempty" yaml:"PidMode,omitempty"`
@ -697,7 +769,10 @@ func (c *Client) TopContainer(id string, psArgs string) (TopResult, error) {
// //
// See https://goo.gl/GNmLHb for more details. // See https://goo.gl/GNmLHb for more details.
type Stats struct { type Stats struct {
Read time.Time `json:"read,omitempty" yaml:"read,omitempty"` Read time.Time `json:"read,omitempty" yaml:"read,omitempty"`
PidsStats struct {
Current uint64 `json:"current,omitempty" yaml:"current,omitempty"`
} `json:"pids_stats,omitempty" yaml:"pids_stats,omitempty"`
Network NetworkStats `json:"network,omitempty" yaml:"network,omitempty"` Network NetworkStats `json:"network,omitempty" yaml:"network,omitempty"`
Networks map[string]NetworkStats `json:"networks,omitempty" yaml:"networks,omitempty"` Networks map[string]NetworkStats `json:"networks,omitempty" yaml:"networks,omitempty"`
MemoryStats struct { MemoryStats struct {

View File

@ -29,6 +29,12 @@ type APIImages struct {
Labels map[string]string `json:"Labels,omitempty" yaml:"Labels,omitempty"` Labels map[string]string `json:"Labels,omitempty" yaml:"Labels,omitempty"`
} }
// RootFS represents the underlying layers used by an image
type RootFS struct {
Type string `json:"Type,omitempty" yaml:"Type,omitempty"`
Layers []string `json:"Layers,omitempty" yaml:"Layers,omitempty"`
}
// Image is the type representing a docker image and its various properties // Image is the type representing a docker image and its various properties
type Image struct { type Image struct {
ID string `json:"Id" yaml:"Id"` ID string `json:"Id" yaml:"Id"`
@ -45,6 +51,7 @@ type Image struct {
Size int64 `json:"Size,omitempty" yaml:"Size,omitempty"` Size int64 `json:"Size,omitempty" yaml:"Size,omitempty"`
VirtualSize int64 `json:"VirtualSize,omitempty" yaml:"VirtualSize,omitempty"` VirtualSize int64 `json:"VirtualSize,omitempty" yaml:"VirtualSize,omitempty"`
RepoDigests []string `json:"RepoDigests,omitempty" yaml:"RepoDigests,omitempty"` RepoDigests []string `json:"RepoDigests,omitempty" yaml:"RepoDigests,omitempty"`
RootFS *RootFS `json:"RootFS,omitempty" yaml:"RootFS,omitempty"`
} }
// ImagePre012 serves the same purpose as the Image type except that it is for // ImagePre012 serves the same purpose as the Image type except that it is for
@ -585,10 +592,10 @@ type APIImageSearch struct {
// See https://goo.gl/AYjyrF for more details. // See https://goo.gl/AYjyrF for more details.
func (c *Client) SearchImages(term string) ([]APIImageSearch, error) { func (c *Client) SearchImages(term string) ([]APIImageSearch, error) {
resp, err := c.do("GET", "/images/search?term="+term, doOptions{}) resp, err := c.do("GET", "/images/search?term="+term, doOptions{})
defer resp.Body.Close()
if err != nil { if err != nil {
return nil, err return nil, err
} }
defer resp.Body.Close()
var searchResult []APIImageSearch var searchResult []APIImageSearch
if err := json.NewDecoder(resp.Body).Decode(&searchResult); err != nil { if err := json.NewDecoder(resp.Body).Decode(&searchResult); err != nil {
return nil, err return nil, err

View File

@ -28,6 +28,7 @@ type Network struct {
Containers map[string]Endpoint Containers map[string]Endpoint
Options map[string]string Options map[string]string
Internal bool Internal bool
EnableIPv6 bool `json:"EnableIPv6"`
} }
// Endpoint contains network resources allocated and used for a container in a network // Endpoint contains network resources allocated and used for a container in a network
@ -111,7 +112,9 @@ type CreateNetworkOptions struct {
CheckDuplicate bool `json:"CheckDuplicate"` CheckDuplicate bool `json:"CheckDuplicate"`
Driver string `json:"Driver"` Driver string `json:"Driver"`
IPAM IPAMOptions `json:"IPAM"` IPAM IPAMOptions `json:"IPAM"`
Options map[string]interface{} `json:"options"` Options map[string]interface{} `json:"Options"`
Internal bool `json:"Internal"`
EnableIPv6 bool `json:"EnableIPv6"`
} }
// IPAMOptions controls IP Address Management when creating a network // IPAMOptions controls IP Address Management when creating a network

View File

@ -22,9 +22,10 @@ var (
// //
// See https://goo.gl/FZA4BK for more details. // See https://goo.gl/FZA4BK for more details.
type Volume struct { type Volume struct {
Name string `json:"Name" yaml:"Name"` Name string `json:"Name" yaml:"Name"`
Driver string `json:"Driver,omitempty" yaml:"Driver,omitempty"` Driver string `json:"Driver,omitempty" yaml:"Driver,omitempty"`
Mountpoint string `json:"Mountpoint,omitempty" yaml:"Mountpoint,omitempty"` Mountpoint string `json:"Mountpoint,omitempty" yaml:"Mountpoint,omitempty"`
Labels map[string]string `json:"Labels,omitempty" yaml:"Labels,omitempty"`
} }
// ListVolumesOptions specify parameters to the ListVolumes function. // ListVolumesOptions specify parameters to the ListVolumes function.