diff options
Diffstat (limited to 'vendor/github.com/fsouza')
31 files changed, 776 insertions, 224 deletions
diff --git a/vendor/github.com/fsouza/go-dockerclient/.gitignore b/vendor/github.com/fsouza/go-dockerclient/.gitignore new file mode 100644 index 000000000..ef22245ea --- /dev/null +++ b/vendor/github.com/fsouza/go-dockerclient/.gitignore @@ -0,0 +1,4 @@ +# temporary symlink for testing +testing/data/symlink +Gopkg.lock +vendor/ diff --git a/vendor/github.com/fsouza/go-dockerclient/.travis.yml b/vendor/github.com/fsouza/go-dockerclient/.travis.yml new file mode 100644 index 000000000..74e54aa77 --- /dev/null +++ b/vendor/github.com/fsouza/go-dockerclient/.travis.yml @@ -0,0 +1,33 @@ +dist: xenial +language: go +go: + - 1.11.x + - 1.12.x +os: + - linux + - osx + - windows +env: + matrix: + - GOARCH=amd64 DEP_TOOL=mod GO111MODULE=on + - GOARCH=386 DEP_TOOL=mod GO111MODULE=on + - GOARCH=amd64 DEP_TOOL=dep GO111MODULE=off + - GOARCH=386 DEP_TOOL=dep GO111MODULE=off + global: + - GOPROXY=https://proxy.golang.org +install: + - travis-scripts/win-setup.bash + - make testdeps DEP_TOOL=${DEP_TOOL} +script: + - travis_wait 25 travis-scripts/run-tests.bash +services: + - docker +matrix: + fast_finish: true + exclude: + - os: osx + env: GOARCH=386 DEP_TOOL=dep GO111MODULE=off + - os: osx + env: GOARCH=386 DEP_TOOL=mod GO111MODULE=on + allow_failures: + - os: windows diff --git a/vendor/github.com/fsouza/go-dockerclient/AUTHORS b/vendor/github.com/fsouza/go-dockerclient/AUTHORS new file mode 100644 index 000000000..4e9f7b8e8 --- /dev/null +++ b/vendor/github.com/fsouza/go-dockerclient/AUTHORS @@ -0,0 +1,200 @@ +# This is the official list of go-dockerclient authors for copyright purposes. + +Abhishek Chanda +Adam Bell-Hanssen +Adnan Khan +Adrien Kohlbecker +Aithal +Aldrin Leal +Alex Dadgar +Alfonso Acosta +André Carvalho +Andreas Jaekle +Andrew Snodgrass +Andrews Medina +Andrey Sibiryov +Andy Goldstein +Anirudh Aithal +Antonio Murdaca +Artem Sidorenko +Arthur Rodrigues +Ben Marini +Ben McCann +Ben Parees +Benno van den Berg +Bradley Cicenas +Brendan Fosberry +Brett Buddin +Brian Lalor +Brian P. Hamachek +Brian Palmer +Bryan Boreham +Burke Libbey +Carlos Diaz-Padron +Carson A +Cássio Botaro +Cesar Wong +Cezar Sa Espinola +Changping Chen +Cheah Chu Yeow +cheneydeng +Chris Bednarski +Chris Stavropoulos +Christian Stewart +Christophe Mourette +Clayton Coleman +Clint Armstrong +CMGS +Colin Hebert +Craig Jellick +Damien Lespiau +Damon Wang +Dan Williams +Daniel, Dao Quang Minh +Daniel Garcia +Daniel Hess +Daniel Hiltgen +Daniel Nephin +Daniel Tsui +Darren Shepherd +Dave Choi +David Huie +Dawn Chen +Denis Makogon +Derek Petersen +Dinesh Subhraveti +Drew Wells +Ed +Elias G. Schneevoigt +Erez Horev +Eric Anderson +Eric Fode +Eric J. Holmes +Eric Mountain +Erwin van Eyk +Ethan Mosbaugh +Ewout Prangsma +Fabio Rehm +Fatih Arslan +Faye Salwin +Felipe Oliveira +Flavia Missi +Florent Aide +Francisco Souza +Frank Groeneveld +George MacRorie +George Moura +Grégoire Delattre +Guilherme Rezende +Guillermo Álvarez Fernández +Harry Zhang +He Simei +Isaac Schnitzer +Ivan Mikushin +James Bardin +James Nugent +Jamie Snell +Januar Wayong +Jari Kolehmainen +Jason Wilder +Jawher Moussa +Jean-Baptiste Dalido +Jeff Mitchell +Jeffrey Hulten +Jen Andre +Jérôme Laurens +Jim Minter +Johan Euphrosine +Johannes Scheuermann +John Hughes +Jorge Marey +Julian Einwag +Kamil Domanski +Karan Misra +Ken Herner +Kevin Lin +Kevin Xu +Kim, Hirokuni +Kostas Lekkas +Kyle Allan +Yunhee Lee +Liron Levin +Lior Yankovich +Liu Peng +Lorenz Leutgeb +Lucas Clemente +Lucas Weiblen +Lyon Hill +Mantas Matelis +Manuel Vogel +Marguerite des Trois Maisons +Mariusz Borsa +Martin Sweeney +Máximo Cuadros Ortiz +Michael Schmatz +Michal Fojtik +Mike Dillon +Mrunal Patel +Nate Jones +Nguyen Sy Thanh Son +Nicholas Van Wiggeren +Nick Ethier +niko83 +Omeid Matten +Orivej Desh +Paul Bellamy +Paul Morie +Paul Weil +Peng Yin +Peter Edge +Peter Jihoon Kim +Peter Teich +Phil Lu +Philippe Lafoucrière +Radek Simko +Rafe Colton +Raphaël Pinson +Reed Allman +RJ Catalano +Rob Miller +Robbert Klarenbeek +Robert Williamson +Roman Khlystik +Russell Haering +Salvador Gironès +Sam Rijs +Sami Wagiaalla +Samuel Archambault +Samuel Karp +Sebastian Borza +Seth Jennings +Shane Xie +Silas Sewell +Simon Eskildsen +Simon Menke +Skolos +Soulou +Sridhar Ratnakumar +Steven Jack +Summer Mousa +Sunjin Lee +Sunny +Swaroop Ramachandra +Tarsis Azevedo +Tim Schindler +Timothy St. Clair +Tobi Knaup +Tom Wilkie +Tonic +ttyh061 +upccup +Victor Marmol +Vijay Krishnan +Vincenzo Prignano +Vlad Alexandru Ionescu +Weitao Zhou +Wiliam Souza +Ye Yin +Yosuke Otosu +Yu, Zou +Yuriy Bogdanov diff --git a/vendor/github.com/fsouza/go-dockerclient/Gopkg.toml b/vendor/github.com/fsouza/go-dockerclient/Gopkg.toml new file mode 100644 index 000000000..4be9ee73a --- /dev/null +++ b/vendor/github.com/fsouza/go-dockerclient/Gopkg.toml @@ -0,0 +1,23 @@ +[[constraint]] + name = "github.com/Microsoft/go-winio" + version = "v0.4.11" + +[[constraint]] + branch = "master" + name = "github.com/docker/docker" + +[[constraint]] + name = "github.com/docker/go-units" + version = "v0.3.3" + +[[constraint]] + name = "github.com/google/go-cmp" + version = "v0.2.0" + +[[constraint]] + name = "github.com/gorilla/mux" + version = "v1.6.2 - v1.7.0" + +[[override]] + name = "github.com/docker/libnetwork" + revision = "19279f0492417475b6bfbd0aa529f73e8f178fb5" diff --git a/vendor/github.com/fsouza/go-dockerclient/LICENSE b/vendor/github.com/fsouza/go-dockerclient/LICENSE index fc7e73f8f..80d56fc05 100644 --- a/vendor/github.com/fsouza/go-dockerclient/LICENSE +++ b/vendor/github.com/fsouza/go-dockerclient/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2013-2018, go-dockerclient authors +Copyright (c) 2013-2019, go-dockerclient authors All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/vendor/github.com/fsouza/go-dockerclient/Makefile b/vendor/github.com/fsouza/go-dockerclient/Makefile new file mode 100644 index 000000000..be71a3c26 --- /dev/null +++ b/vendor/github.com/fsouza/go-dockerclient/Makefile @@ -0,0 +1,41 @@ +.PHONY: \ + all \ + staticcheck \ + fmt \ + fmtcheck \ + pretest \ + test \ + integration + +DEP_TOOL ?= mod + +all: test + +staticcheck: + GO111MODULE=off go get honnef.co/go/tools/cmd/staticcheck + staticcheck ./... + +fmtcheck: + if [ -z "$${SKIP_FMT_CHECK}" ]; then [ -z "$$(gofumpt -s -d . | tee /dev/stderr)" ]; fi + +fmt: + GO111MODULE=off go get mvdan.cc/gofumpt + gofumpt -s -w . + +testdeps: +ifeq ($(DEP_TOOL), dep) + GO111MODULE=off go get -u github.com/golang/dep/cmd/dep + dep ensure -v +else + go mod download +endif + +pretest: staticcheck fmtcheck + +gotest: + go test -race -vet all ./... + +test: testdeps pretest gotest + +integration: + go test -tags docker_integration -run TestIntegration -v diff --git a/vendor/github.com/fsouza/go-dockerclient/README.markdown b/vendor/github.com/fsouza/go-dockerclient/README.md index 86824d6c5..501b967f7 100644 --- a/vendor/github.com/fsouza/go-dockerclient/README.markdown +++ b/vendor/github.com/fsouza/go-dockerclient/README.md @@ -1,19 +1,30 @@ # go-dockerclient -[![Travis Build Status](https://travis-ci.org/fsouza/go-dockerclient.svg?branch=master)](https://travis-ci.org/fsouza/go-dockerclient) -[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/4m374pti06ubg2l7?svg=true)](https://ci.appveyor.com/project/fsouza/go-dockerclient) +[![Travis Build Status](https://travis-ci.com/fsouza/go-dockerclient.svg?branch=master)](https://travis-ci.com/fsouza/go-dockerclient) +[![AppVeyor Build status](https://ci.appveyor.com/api/projects/status/4yusq1f9dqbicobt?svg=true)](https://ci.appveyor.com/project/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 support for the extensions in the [Swarm API](https://docs.docker.com/swarm/swarm-api/). 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 -only available in docker 1.8 and above, and only enabled in docker if -DOCKER_EXPERIMENTAL is defined during the docker build process. +passthrough to the libnetwork remote API. For more details, check the [remote API -documentation](http://docs.docker.com/engine/reference/api/docker_remote_api/). +documentation](https://docs.docker.com/engine/api/latest/). + +## Difference between go-dockerclient and the official SDK + +Link for the official SDK: https://docs.docker.com/develop/sdk/ + +go-dockerclient was created before Docker had an official Go SDK and is +still maintained and relatively active because it's still used out there. New +features in the Docker API do not get automatically implemented here: it's +based on demand, if someone wants it, they can file an issue or a PR and the +feature may get implemented/merged. + +For new projects, using the official SDK is probably more appropriate as +go-dockerclient lags behind the official SDK. ## Example @@ -23,12 +34,11 @@ package main import ( "fmt" - "github.com/fsouza/go-dockerclient" + docker "github.com/fsouza/go-dockerclient" ) func main() { - endpoint := "unix:///var/run/docker.sock" - client, err := docker.NewClient(endpoint) + client, err := docker.NewClientFromEnv() if err != nil { panic(err) } @@ -59,11 +69,11 @@ package main import ( "fmt" - "github.com/fsouza/go-dockerclient" + docker "github.com/fsouza/go-dockerclient" ) func main() { - endpoint := "tcp://[ip]:[port]" + const endpoint = "tcp://[ip]:[port]" path := os.Getenv("DOCKER_CERT_PATH") ca := fmt.Sprintf("%s/ca.pem", path) cert := fmt.Sprintf("%s/cert.pem", path) @@ -84,7 +94,7 @@ package main import ( "fmt" - "github.com/fsouza/go-dockerclient" + docker "github.com/fsouza/go-dockerclient" ) func main() { @@ -101,20 +111,19 @@ All development commands can be seen in the [Makefile](Makefile). Commited code must pass: -* [golint](https://github.com/golang/lint) (with some exceptions, see the Makefile). -* [go vet](https://golang.org/cmd/vet/) -* [gofmt](https://golang.org/cmd/gofmt) +* [staticcheck](https://staticcheck.io/) +* [gofumpt](https://github.com/mvdan/gofumpt) * [go test](https://golang.org/cmd/go/#hdr-Test_packages) -Running `make test` will check all of these. If your editor does not -automatically call ``gofmt -s``, `make fmt` will format all go files in this -repository. +Running ``make test`` will check all of these. You can reformat the code with +``make fmt``. -## Vendoring +## Vendoring / Modules -go-dockerclient uses [dep](https://github.com/golang/dep/) for vendoring. If -you're using dep, you should be able to pick go-dockerclient releases and get -the proper dependencies. +go-dockerclient supports [dep](https://github.com/golang/dep/) for vendoring +and can also be installed as a module. If you're using dep or Go modules, you +should be able to pick go-dockerclient releases and get the proper +dependencies. With other vendoring tools, users might need to specify go-dockerclient's dependencies manually. diff --git a/vendor/github.com/fsouza/go-dockerclient/appveyor.yml b/vendor/github.com/fsouza/go-dockerclient/appveyor.yml new file mode 100644 index 000000000..6f49a8b84 --- /dev/null +++ b/vendor/github.com/fsouza/go-dockerclient/appveyor.yml @@ -0,0 +1,33 @@ +version: "{build}" +platform: x64 +clone_depth: 2 +clone_folder: c:\gopath\src\github.com\fsouza\go-dockerclient +environment: + GOPATH: c:\gopath + GOPROXY: https://proxy.golang.org + SKIP_FMT_CHECK: 1 + matrix: + - GOVERSION: &go111 "1.11.10" + DEP_TOOL: dep + GO111MODULE: off + - GOVERSION: &go112 "1.12.5" + DEP_TOOL: dep + GO111MODULE: off + - GOVERSION: *go111 + DEP_TOOL: mod + GO111MODULE: on + - GOVERSION: *go112 + DEP_TOOL: mod + GO111MODULE: on +install: + - choco install make + - set PATH=%GOPATH%\bin;c:\go\bin;%PATH% + - rmdir c:\go /s /q + - appveyor DownloadFile https://storage.googleapis.com/golang/go%GOVERSION%.windows-amd64.zip + - 7z x go%GOVERSION%.windows-amd64.zip -y -oC:\ > NUL +build_script: + - make testdeps DEP_TOOL=%DEP_TOOL% +test_script: + - make pretest gotest DEP_TOOL=%DEP_TOOL% +matrix: + fast_finish: true diff --git a/vendor/github.com/fsouza/go-dockerclient/auth.go b/vendor/github.com/fsouza/go-dockerclient/auth.go index 4335d6e06..e7de97701 100644 --- a/vendor/github.com/fsouza/go-dockerclient/auth.go +++ b/vendor/github.com/fsouza/go-dockerclient/auth.go @@ -18,7 +18,7 @@ import ( ) // ErrCannotParseDockercfg is the error returned by NewAuthConfigurations when the dockercfg cannot be parsed. -var ErrCannotParseDockercfg = errors.New("Failed to read authentication from dockercfg") +var ErrCannotParseDockercfg = errors.New("failed to read authentication from dockercfg") // AuthConfiguration represents authentication options to use in the PushImage // method. It represents the authentication in the Docker index server. @@ -37,16 +37,40 @@ type AuthConfiguration struct { RegistryToken string `json:"registrytoken,omitempty"` } +func (c AuthConfiguration) isEmpty() bool { + return c == AuthConfiguration{} +} + +func (c AuthConfiguration) headerKey() string { + return "X-Registry-Auth" +} + // AuthConfigurations represents authentication options to use for the // PushImage method accommodating the new X-Registry-Config header type AuthConfigurations struct { Configs map[string]AuthConfiguration `json:"configs"` } +func (c AuthConfigurations) isEmpty() bool { + return len(c.Configs) == 0 +} + +func (c AuthConfigurations) headerKey() string { + return "X-Registry-Config" +} + // AuthConfigurations119 is used to serialize a set of AuthConfigurations // for Docker API >= 1.19. type AuthConfigurations119 map[string]AuthConfiguration +func (c AuthConfigurations119) isEmpty() bool { + return len(c) == 0 +} + +func (c AuthConfigurations119) headerKey() string { + return "X-Registry-Config" +} + // dockerConfig represents a registry authentation configuration from the // .dockercfg file. type dockerConfig struct { @@ -84,7 +108,7 @@ func cfgPaths(dockerConfigEnv string, homeEnv string) []string { // - $HOME/.docker/config.json // - $HOME/.dockercfg func NewAuthConfigurationsFromDockerCfg() (*AuthConfigurations, error) { - err := fmt.Errorf("No docker configuration found") + err := fmt.Errorf("no docker configuration found") var auths *AuthConfigurations pathsToTry := cfgPaths(os.Getenv("DOCKER_CONFIG"), os.Getenv("HOME")) diff --git a/vendor/github.com/fsouza/go-dockerclient/client.go b/vendor/github.com/fsouza/go-dockerclient/client.go index 581e31417..9953e3253 100644 --- a/vendor/github.com/fsouza/go-dockerclient/client.go +++ b/vendor/github.com/fsouza/go-dockerclient/client.go @@ -31,7 +31,6 @@ import ( "sync/atomic" "time" - "github.com/docker/docker/opts" "github.com/docker/docker/pkg/homedir" "github.com/docker/docker/pkg/stdcopy" "github.com/fsouza/go-dockerclient/internal/jsonmessage" @@ -70,7 +69,7 @@ type APIVersion []int // <minor> and <patch> are integer numbers. func NewAPIVersion(input string) (APIVersion, error) { if !strings.Contains(input, ".") { - return nil, fmt.Errorf("Unable to parse version %q", input) + return nil, fmt.Errorf("unable to parse version %q", input) } raw := strings.Split(input, "-") arr := strings.Split(raw[0], ".") @@ -79,7 +78,7 @@ func NewAPIVersion(input string) (APIVersion, error) { for i, val := range arr { ret[i], err = strconv.Atoi(val) if err != nil { - return nil, fmt.Errorf("Unable to parse version %q: %q is not an integer", input, val) + return nil, fmt.Errorf("unable to parse version %q: %q is not an integer", input, val) } } return ret, nil @@ -329,7 +328,7 @@ func NewVersionedTLSClientFromBytes(endpoint string, certPEMBlock, keyPEMBlock, } else { caPool := x509.NewCertPool() if !caPool.AppendCertsFromPEM(caPEMCert) { - return nil, errors.New("Could not add RootCA pem") + return nil, errors.New("could not add RootCA pem") } tlsConfig.RootCAs = caPool } @@ -387,7 +386,7 @@ func (c *Client) Endpoint() string { // // See https://goo.gl/wYfgY1 for more details. func (c *Client) Ping() error { - return c.PingWithContext(nil) + return c.PingWithContext(context.TODO()) } // PingWithContext pings the docker server @@ -414,7 +413,7 @@ func (c *Client) getServerAPIVersionString() (version string, err error) { } defer resp.Body.Close() if resp.StatusCode != http.StatusOK { - return "", fmt.Errorf("Received unexpected status %d while trying to retrieve the server version", resp.StatusCode) + return "", fmt.Errorf("received unexpected status %d while trying to retrieve the server version", resp.StatusCode) } var versionResponse map[string]interface{} if err := json.NewDecoder(resp.Body).Decode(&versionResponse); err != nil { @@ -639,11 +638,7 @@ func handleStreamResponse(resp *http.Response, streamOptions *streamOptions) err _, err = io.Copy(streamOptions.stdout, resp.Body) return err } - if st, ok := streamOptions.stdout.(interface { - io.Writer - FD() uintptr - IsTerminal() bool - }); ok { + if st, ok := streamOptions.stdout.(stream); ok { err = jsonmessage.DisplayJSONMessagesToStream(resp.Body, st, nil) } else { err = jsonmessage.DisplayJSONMessagesStream(resp.Body, streamOptions.stdout, 0, false, nil) @@ -651,6 +646,12 @@ func handleStreamResponse(resp *http.Response, streamOptions *streamOptions) err return err } +type stream interface { + io.Writer + FD() uintptr + IsTerminal() bool +} + type proxyReader struct { io.ReadCloser calls uint64 @@ -760,6 +761,7 @@ func (c *Client) hijack(method, path string, hijackOptions hijackOptions) (Close errs := make(chan error, 1) quit := make(chan struct{}) go func() { + //lint:ignore SA1019 this is needed here clientconn := httputil.NewClientConn(dial, nil) defer clientconn.Close() clientconn.Do(req) @@ -872,13 +874,6 @@ func (c *Client) getFakeNativeURL(path string) string { return fmt.Sprintf("%s%s", urlStr, path) } -type jsonMessage struct { - Status string `json:"status,omitempty"` - Progress string `json:"progress,omitempty"` - Error string `json:"error,omitempty"` - Stream string `json:"stream,omitempty"` -} - func queryString(opts interface{}) string { if opts == nil { return "" @@ -1029,7 +1024,7 @@ func getDockerEnv() (*dockerEnv, error) { dockerHost := os.Getenv("DOCKER_HOST") var err error if dockerHost == "" { - dockerHost = opts.DefaultHost + dockerHost = defaultHost } dockerTLSVerify := os.Getenv("DOCKER_TLS_VERIFY") != "" var dockerCertPath string diff --git a/vendor/github.com/fsouza/go-dockerclient/client_unix.go b/vendor/github.com/fsouza/go-dockerclient/client_unix.go index 57d7904ea..cd2034304 100644 --- a/vendor/github.com/fsouza/go-dockerclient/client_unix.go +++ b/vendor/github.com/fsouza/go-dockerclient/client_unix.go @@ -12,6 +12,8 @@ import ( "net/http" ) +const defaultHost = "unix:///var/run/docker.sock" + // initializeNativeClient initializes the native Unix domain socket client on // Unix-style operating systems func (c *Client) initializeNativeClient(trFunc func() *http.Transport) { @@ -21,11 +23,8 @@ func (c *Client) initializeNativeClient(trFunc func() *http.Transport) { sockPath := c.endpointURL.Path tr := trFunc() - - tr.Dial = func(network, addr string) (net.Conn, error) { - return c.Dialer.Dial(unixProtocol, sockPath) - } - tr.DialContext = func(ctx context.Context, network, addr string) (net.Conn, error) { + tr.Proxy = nil + tr.DialContext = func(_ context.Context, network, addr string) (net.Conn, error) { return c.Dialer.Dial(unixProtocol, sockPath) } c.HTTPClient.Transport = tr diff --git a/vendor/github.com/fsouza/go-dockerclient/client_windows.go b/vendor/github.com/fsouza/go-dockerclient/client_windows.go index 8e7b457d7..63d97ec65 100644 --- a/vendor/github.com/fsouza/go-dockerclient/client_windows.go +++ b/vendor/github.com/fsouza/go-dockerclient/client_windows.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build windows - package docker import ( @@ -12,10 +10,13 @@ import ( "net/http" "time" - "github.com/Microsoft/go-winio" + winio "github.com/Microsoft/go-winio" ) -const namedPipeConnectTimeout = 2 * time.Second +const ( + defaultHost = "npipe:////./pipe/docker_engine" + namedPipeConnectTimeout = 2 * time.Second +) type pipeDialer struct { dialFunc func(network, addr string) (net.Conn, error) @@ -36,7 +37,7 @@ func (c *Client) initializeNativeClient(trFunc func() *http.Transport) { return winio.DialPipe(namedPipePath, &timeout) } tr := trFunc() - tr.Dial = dialFunc + tr.Proxy = nil tr.DialContext = func(ctx context.Context, network, addr string) (net.Conn, error) { return dialFunc(network, addr) } diff --git a/vendor/github.com/fsouza/go-dockerclient/container.go b/vendor/github.com/fsouza/go-dockerclient/container.go index b48bc2cf6..e40c9c2e4 100644 --- a/vendor/github.com/fsouza/go-dockerclient/container.go +++ b/vendor/github.com/fsouza/go-dockerclient/container.go @@ -16,7 +16,7 @@ import ( "strings" "time" - "github.com/docker/go-units" + units "github.com/docker/go-units" ) // ErrContainerAlreadyExists is the error returned by CreateContainer when the @@ -52,7 +52,7 @@ type APIMount struct { Driver string `json:"Driver,omitempty" yaml:"Driver,omitempty" toml:"Driver,omitempty"` Mode string `json:"Mode,omitempty" yaml:"Mode,omitempty" toml:"Mode,omitempty"` RW bool `json:"RW,omitempty" yaml:"RW,omitempty" toml:"RW,omitempty"` - Propogation string `json:"Propogation,omitempty" yaml:"Propogation,omitempty" toml:"Propogation,omitempty"` + Propagation string `json:"Propagation,omitempty" yaml:"Propagation,omitempty" toml:"Propagation,omitempty"` } // APIContainers represents each container in the list returned by @@ -627,7 +627,7 @@ func (c *Client) CreateContainer(opts CreateContainerOptions) (*Container, error ) if e, ok := err.(*Error); ok { - if e.Status == http.StatusNotFound { + if e.Status == http.StatusNotFound && strings.Contains(e.Message, "No such image") { return nil, ErrNoSuchImage } if e.Status == http.StatusConflict { @@ -754,7 +754,6 @@ type HostConfig struct { MemoryReservation int64 `json:"MemoryReservation,omitempty" yaml:"MemoryReservation,omitempty" toml:"MemoryReservation,omitempty"` KernelMemory int64 `json:"KernelMemory,omitempty" yaml:"KernelMemory,omitempty" toml:"KernelMemory,omitempty"` MemorySwap int64 `json:"MemorySwap,omitempty" yaml:"MemorySwap,omitempty" toml:"MemorySwap,omitempty"` - MemorySwappiness int64 `json:"MemorySwappiness,omitempty" yaml:"MemorySwappiness,omitempty" toml:"MemorySwappiness,omitempty"` CPUShares int64 `json:"CpuShares,omitempty" yaml:"CpuShares,omitempty" toml:"CpuShares,omitempty"` CPUSet string `json:"Cpuset,omitempty" yaml:"Cpuset,omitempty" toml:"Cpuset,omitempty"` CPUSetCPUs string `json:"CpusetCpus,omitempty" yaml:"CpusetCpus,omitempty" toml:"CpusetCpus,omitempty"` @@ -772,14 +771,11 @@ type HostConfig struct { Ulimits []ULimit `json:"Ulimits,omitempty" yaml:"Ulimits,omitempty" toml:"Ulimits,omitempty"` VolumeDriver string `json:"VolumeDriver,omitempty" yaml:"VolumeDriver,omitempty" toml:"VolumeDriver,omitempty"` OomScoreAdj int `json:"OomScoreAdj,omitempty" yaml:"OomScoreAdj,omitempty" toml:"OomScoreAdj,omitempty"` - PidsLimit int64 `json:"PidsLimit,omitempty" yaml:"PidsLimit,omitempty" toml:"PidsLimit,omitempty"` + MemorySwappiness *int64 `json:"MemorySwappiness,omitempty" yaml:"MemorySwappiness,omitempty" toml:"MemorySwappiness,omitempty"` + PidsLimit *int64 `json:"PidsLimit,omitempty" yaml:"PidsLimit,omitempty" toml:"PidsLimit,omitempty"` + OOMKillDisable *bool `json:"OomKillDisable,omitempty" yaml:"OomKillDisable,omitempty" toml:"OomKillDisable,omitempty"` ShmSize int64 `json:"ShmSize,omitempty" yaml:"ShmSize,omitempty" toml:"ShmSize,omitempty"` Tmpfs map[string]string `json:"Tmpfs,omitempty" yaml:"Tmpfs,omitempty" toml:"Tmpfs,omitempty"` - Privileged bool `json:"Privileged,omitempty" yaml:"Privileged,omitempty" toml:"Privileged,omitempty"` - PublishAllPorts bool `json:"PublishAllPorts,omitempty" yaml:"PublishAllPorts,omitempty" toml:"PublishAllPorts,omitempty"` - ReadonlyRootfs bool `json:"ReadonlyRootfs,omitempty" yaml:"ReadonlyRootfs,omitempty" toml:"ReadonlyRootfs,omitempty"` - OOMKillDisable bool `json:"OomKillDisable,omitempty" yaml:"OomKillDisable,omitempty" toml:"OomKillDisable,omitempty"` - AutoRemove bool `json:"AutoRemove,omitempty" yaml:"AutoRemove,omitempty" toml:"AutoRemove,omitempty"` StorageOpt map[string]string `json:"StorageOpt,omitempty" yaml:"StorageOpt,omitempty" toml:"StorageOpt,omitempty"` Sysctls map[string]string `json:"Sysctls,omitempty" yaml:"Sysctls,omitempty" toml:"Sysctls,omitempty"` CPUCount int64 `json:"CpuCount,omitempty" yaml:"CpuCount,omitempty"` @@ -787,8 +783,12 @@ type HostConfig struct { IOMaximumBandwidth int64 `json:"IOMaximumBandwidth,omitempty" yaml:"IOMaximumBandwidth,omitempty"` IOMaximumIOps int64 `json:"IOMaximumIOps,omitempty" yaml:"IOMaximumIOps,omitempty"` Mounts []HostMount `json:"Mounts,omitempty" yaml:"Mounts,omitempty" toml:"Mounts,omitempty"` - Init bool `json:",omitempty" yaml:",omitempty"` Runtime string `json:"Runtime,omitempty" yaml:"Runtime,omitempty" toml:"Runtime,omitempty"` + Init bool `json:",omitempty" yaml:",omitempty"` + Privileged bool `json:"Privileged,omitempty" yaml:"Privileged,omitempty" toml:"Privileged,omitempty"` + PublishAllPorts bool `json:"PublishAllPorts,omitempty" yaml:"PublishAllPorts,omitempty" toml:"PublishAllPorts,omitempty"` + ReadonlyRootfs bool `json:"ReadonlyRootfs,omitempty" yaml:"ReadonlyRootfs,omitempty" toml:"ReadonlyRootfs,omitempty"` + AutoRemove bool `json:"AutoRemove,omitempty" yaml:"AutoRemove,omitempty" toml:"AutoRemove,omitempty"` } // NetworkingConfig represents the container's networking configuration for each of its interfaces @@ -1103,13 +1103,8 @@ func (c *Client) Stats(opts StatsOptions) (retErr error) { defer func() { close(opts.Stats) - select { - case err := <-errC: - if err != nil && retErr == nil { - retErr = err - } - default: - // No errors + if err := <-errC; err != nil && retErr == nil { + retErr = err } if err := readCloser.Close(); err != nil && retErr == nil { @@ -1119,6 +1114,7 @@ func (c *Client) Stats(opts StatsOptions) (retErr error) { reqSent := make(chan struct{}) go func() { + defer close(errC) err := c.stream("GET", fmt.Sprintf("/containers/%s/stats?stream=%v", opts.ID, opts.Stream), streamOptions{ rawJSONStream: true, useJSONDecoder: true, @@ -1140,7 +1136,6 @@ func (c *Client) Stats(opts StatsOptions) (retErr error) { err = closeErr } errC <- err - close(errC) }() quit := make(chan struct{}) diff --git a/vendor/github.com/fsouza/go-dockerclient/event.go b/vendor/github.com/fsouza/go-dockerclient/event.go index 18ae5d5a6..3a3364d9d 100644 --- a/vendor/github.com/fsouza/go-dockerclient/event.go +++ b/vendor/github.com/fsouza/go-dockerclient/event.go @@ -330,6 +330,7 @@ func (c *Client) eventHijack(startTime int64, eventChan chan *APIEvents, errChan if err != nil { return err } + //lint:ignore SA1019 this is needed here conn := httputil.NewClientConn(dial, nil) req, err := http.NewRequest("GET", uri, nil) if err != nil { @@ -339,6 +340,7 @@ func (c *Client) eventHijack(startTime int64, eventChan chan *APIEvents, errChan if err != nil { return err } + //lint:ignore SA1019 ClientConn is needed here go func(res *http.Response, conn *httputil.ClientConn) { defer conn.Close() defer res.Body.Close() diff --git a/vendor/github.com/fsouza/go-dockerclient/exec.go b/vendor/github.com/fsouza/go-dockerclient/exec.go index 5e7ea87f6..d804b10b8 100644 --- a/vendor/github.com/fsouza/go-dockerclient/exec.go +++ b/vendor/github.com/fsouza/go-dockerclient/exec.go @@ -25,16 +25,16 @@ type Exec struct { // // See https://goo.gl/60TeBP for more details type CreateExecOptions struct { - AttachStdin bool `json:"AttachStdin,omitempty" yaml:"AttachStdin,omitempty" toml:"AttachStdin,omitempty"` - AttachStdout bool `json:"AttachStdout,omitempty" yaml:"AttachStdout,omitempty" toml:"AttachStdout,omitempty"` - AttachStderr bool `json:"AttachStderr,omitempty" yaml:"AttachStderr,omitempty" toml:"AttachStderr,omitempty"` - Tty bool `json:"Tty,omitempty" yaml:"Tty,omitempty" toml:"Tty,omitempty"` Env []string `json:"Env,omitempty" yaml:"Env,omitempty" toml:"Env,omitempty"` Cmd []string `json:"Cmd,omitempty" yaml:"Cmd,omitempty" toml:"Cmd,omitempty"` Container string `json:"Container,omitempty" yaml:"Container,omitempty" toml:"Container,omitempty"` User string `json:"User,omitempty" yaml:"User,omitempty" toml:"User,omitempty"` WorkingDir string `json:"WorkingDir,omitempty" yaml:"WorkingDir,omitempty" toml:"WorkingDir,omitempty"` Context context.Context `json:"-"` + AttachStdin bool `json:"AttachStdin,omitempty" yaml:"AttachStdin,omitempty" toml:"AttachStdin,omitempty"` + AttachStdout bool `json:"AttachStdout,omitempty" yaml:"AttachStdout,omitempty" toml:"AttachStdout,omitempty"` + AttachStderr bool `json:"AttachStderr,omitempty" yaml:"AttachStderr,omitempty" toml:"AttachStderr,omitempty"` + Tty bool `json:"Tty,omitempty" yaml:"Tty,omitempty" toml:"Tty,omitempty"` Privileged bool `json:"Privileged,omitempty" yaml:"Privileged,omitempty" toml:"Privileged,omitempty"` } @@ -177,13 +177,13 @@ type ExecProcessConfig struct { type ExecInspect struct { ID string `json:"ID,omitempty" yaml:"ID,omitempty" toml:"ID,omitempty"` ExitCode int `json:"ExitCode,omitempty" yaml:"ExitCode,omitempty" toml:"ExitCode,omitempty"` + ProcessConfig ExecProcessConfig `json:"ProcessConfig,omitempty" yaml:"ProcessConfig,omitempty" toml:"ProcessConfig,omitempty"` + ContainerID string `json:"ContainerID,omitempty" yaml:"ContainerID,omitempty" toml:"ContainerID,omitempty"` + DetachKeys string `json:"DetachKeys,omitempty" yaml:"DetachKeys,omitempty" toml:"DetachKeys,omitempty"` Running bool `json:"Running,omitempty" yaml:"Running,omitempty" toml:"Running,omitempty"` OpenStdin bool `json:"OpenStdin,omitempty" yaml:"OpenStdin,omitempty" toml:"OpenStdin,omitempty"` OpenStderr bool `json:"OpenStderr,omitempty" yaml:"OpenStderr,omitempty" toml:"OpenStderr,omitempty"` OpenStdout bool `json:"OpenStdout,omitempty" yaml:"OpenStdout,omitempty" toml:"OpenStdout,omitempty"` - ProcessConfig ExecProcessConfig `json:"ProcessConfig,omitempty" yaml:"ProcessConfig,omitempty" toml:"ProcessConfig,omitempty"` - ContainerID string `json:"ContainerID,omitempty" yaml:"ContainerID,omitempty" toml:"ContainerID,omitempty"` - DetachKeys string `json:"DetachKeys,omitempty" yaml:"DetachKeys,omitempty" toml:"DetachKeys,omitempty"` CanRemove bool `json:"CanRemove,omitempty" yaml:"CanRemove,omitempty" toml:"CanRemove,omitempty"` } diff --git a/vendor/github.com/fsouza/go-dockerclient/go.mod b/vendor/github.com/fsouza/go-dockerclient/go.mod index bcf549c21..b4e75afc8 100644 --- a/vendor/github.com/fsouza/go-dockerclient/go.mod +++ b/vendor/github.com/fsouza/go-dockerclient/go.mod @@ -1,42 +1,26 @@ module github.com/fsouza/go-dockerclient +go 1.11 + require ( github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 - github.com/Microsoft/go-winio v0.4.11 - github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 - github.com/containerd/continuity v0.0.0-20180814194400-c7c5070e6f6e // indirect - github.com/davecgh/go-spew v1.1.1 // indirect - github.com/docker/docker v0.7.3-0.20180827131323-0c5f8d2b9b23 + github.com/Microsoft/go-winio v0.4.12 + github.com/containerd/continuity v0.0.0-20181203112020-004b46473808 // indirect + github.com/docker/docker v0.7.3-0.20190309235953-33c3200e0d16 github.com/docker/go-connections v0.4.0 // indirect - github.com/docker/go-units v0.3.3 - github.com/docker/libnetwork v0.8.0-dev.2.0.20180608203834-19279f049241 // indirect - github.com/fsnotify/fsnotify v1.4.7 // indirect - github.com/gogo/protobuf v1.1.1 // indirect - github.com/golang/protobuf v1.2.0 // indirect - github.com/google/go-cmp v0.2.0 - github.com/gorilla/context v1.1.1 // indirect - github.com/gorilla/mux v1.6.2 - github.com/hpcloud/tail v1.0.0 // indirect - github.com/onsi/ginkgo v1.6.0 // indirect - github.com/onsi/gomega v1.4.1 // indirect + github.com/docker/go-units v0.4.0 + github.com/gogo/protobuf v1.2.1 // indirect + github.com/golang/protobuf v1.3.0 // indirect + github.com/google/go-cmp v0.3.0 + github.com/gorilla/mux v1.7.2 + github.com/ijc/Gotty v0.0.0-20170406111628-a8b993ba6abd github.com/opencontainers/go-digest v1.0.0-rc1 // indirect github.com/opencontainers/image-spec v1.0.1 // indirect github.com/opencontainers/runc v0.1.1 // indirect - github.com/pkg/errors v0.8.0 // indirect - github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/sirupsen/logrus v1.0.6 - github.com/stretchr/testify v1.2.2 // indirect - github.com/vishvananda/netlink v1.0.0 // indirect - github.com/vishvananda/netns v0.0.0-20180720170159-13995c7128cc // indirect - golang.org/x/crypto v0.0.0-20180820150726-614d502a4dac // indirect - golang.org/x/net v0.0.0-20180826012351-8a410e7b638d // indirect - golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f // indirect - golang.org/x/sys v0.0.0-20180824143301-4910a1d54f87 - golang.org/x/text v0.3.0 // indirect - gopkg.in/airbrake/gobrake.v2 v2.0.9 // indirect - gopkg.in/fsnotify.v1 v1.4.7 // indirect - gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2 // indirect - gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect - gopkg.in/yaml.v2 v2.2.1 // indirect - gotest.tools v2.1.0+incompatible // indirect + github.com/pkg/errors v0.8.1 // indirect + github.com/sirupsen/logrus v1.3.0 // indirect + golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 + golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 // indirect + golang.org/x/sys v0.0.0-20190310054646-10058d7d4faa + gotest.tools v2.2.0+incompatible // indirect ) diff --git a/vendor/github.com/fsouza/go-dockerclient/go.sum b/vendor/github.com/fsouza/go-dockerclient/go.sum new file mode 100644 index 000000000..bc93f2dae --- /dev/null +++ b/vendor/github.com/fsouza/go-dockerclient/go.sum @@ -0,0 +1,60 @@ +github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 h1:w+iIsaOQNcT7OZ575w+acHgRric5iCyQh+xv+KJ4HB8= +github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8= +github.com/Microsoft/go-winio v0.4.12 h1:xAfWHN1IrQ0NJ9TBC0KBZoqLjzDTr1ML+4MywiUOryc= +github.com/Microsoft/go-winio v0.4.12/go.mod h1:VhR8bwka0BXejwEJY73c50VrPtXAaKcyvVC4A4RozmA= +github.com/containerd/continuity v0.0.0-20181203112020-004b46473808 h1:4BX8f882bXEDKfWIf0wa8HRvpnBoPszJJXL+TVbBw4M= +github.com/containerd/continuity v0.0.0-20181203112020-004b46473808/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/docker/docker v0.7.3-0.20190309235953-33c3200e0d16 h1:dmUn0SuGx7unKFwxyeQ/oLUHhEfZosEDrpmYM+6MTuc= +github.com/docker/docker v0.7.3-0.20190309235953-33c3200e0d16/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= +github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= +github.com/docker/go-units v0.4.0 h1:3uh0PgVws3nIA0Q+MwDC8yjEPf9zjRfZZWXZYDct3Tw= +github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= +github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= +github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= +github.com/golang/protobuf v1.3.0 h1:kbxbvI4Un1LUWKxufD+BiE6AEExYYgkQLQmLFqA1LFk= +github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0= +github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/gorilla/mux v1.7.1 h1:Dw4jY2nghMMRsh1ol8dv1axHkDwMQK2DHerMNJsIpJU= +github.com/gorilla/mux v1.7.1/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= +github.com/gorilla/mux v1.7.2 h1:zoNxOV7WjqXptQOVngLmcSQgXmgk4NMz1HibBchjl/I= +github.com/gorilla/mux v1.7.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= +github.com/ijc/Gotty v0.0.0-20170406111628-a8b993ba6abd h1:anPrsicrIi2ColgWTVPk+TrN42hJIWlfPHSBP9S0ZkM= +github.com/ijc/Gotty v0.0.0-20170406111628-a8b993ba6abd/go.mod h1:3LVOLeyx9XVvwPgrt2be44XgSqndprz1G18rSk8KD84= +github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/opencontainers/go-digest v1.0.0-rc1 h1:WzifXhOVOEOuFYOJAW6aQqW0TooG2iki3E3Ii+WN7gQ= +github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= +github.com/opencontainers/image-spec v1.0.1 h1:JMemWkRwHx4Zj+fVxWoMCFm/8sYGGrUVojFA6h/TRcI= +github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= +github.com/opencontainers/runc v0.1.1 h1:GlxAyO6x8rfZYN9Tt0Kti5a/cP41iuiO2yYT0IJGY8Y= +github.com/opencontainers/runc v0.1.1/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= +github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/sirupsen/logrus v1.3.0 h1:hI/7Q+DtNZ2kINb6qt/lS+IyXnHQe9e90POfeewL/ME= +github.com/sirupsen/logrus v1.3.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 h1:YUO/7uOKsKeq9UokNS62b8FYywz3ker1l1vDZRCRefw= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190310054646-10058d7d4faa h1:lqti/xP+yD/6zH5TqEwx2MilNIJY5Vbc6Qr8J3qyPIQ= +golang.org/x/sys v0.0.0-20190310054646-10058d7d4faa/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= +gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= diff --git a/vendor/github.com/fsouza/go-dockerclient/image.go b/vendor/github.com/fsouza/go-dockerclient/image.go index 124e78da3..f9e1c6f04 100644 --- a/vendor/github.com/fsouza/go-dockerclient/image.go +++ b/vendor/github.com/fsouza/go-dockerclient/image.go @@ -5,7 +5,6 @@ package docker import ( - "bytes" "context" "encoding/base64" "encoding/json" @@ -445,15 +444,10 @@ func (c *Client) ImportImage(opts ImportImageOptions) error { // For more details about the Docker building process, see // https://goo.gl/4nYHwV. type BuildImageOptions struct { + Context context.Context Name string `qs:"t"` Dockerfile string `qs:"dockerfile"` - NoCache bool `qs:"nocache"` CacheFrom []string `qs:"-"` - SuppressOutput bool `qs:"q"` - Pull bool `qs:"pull"` - RmTmpContainer bool `qs:"rm"` - ForceRmTmpContainer bool `qs:"forcerm"` - RawJSONStream bool `qs:"-"` Memory int64 `qs:"memory"` Memswap int64 `qs:"memswap"` CPUShares int64 `qs:"cpushares"` @@ -474,7 +468,12 @@ type BuildImageOptions struct { CgroupParent string `qs:"cgroupparent"` SecurityOpt []string `qs:"securityopt"` Target string `gs:"target"` - Context context.Context + NoCache bool `qs:"nocache"` + SuppressOutput bool `qs:"q"` + Pull bool `qs:"pull"` + RmTmpContainer bool `qs:"rm"` + ForceRmTmpContainer bool `qs:"forcerm"` + RawJSONStream bool `qs:"-"` } // BuildArg represents arguments that can be passed to the image when building @@ -558,7 +557,7 @@ func (c *Client) BuildImage(opts BuildImageOptions) error { }) } -func (c *Client) versionedAuthConfigs(authConfigs AuthConfigurations) interface{} { +func (c *Client) versionedAuthConfigs(authConfigs AuthConfigurations) registryAuth { if c.serverAPIVersion == nil { c.checkAPIVersion() } @@ -588,7 +587,6 @@ func (c *Client) TagImage(name string, opts TagImageOptions) error { resp, err := c.do("POST", "/images/"+name+"/tag?"+queryString(&opts), doOptions{ context: opts.Context, }) - if err != nil { return err } @@ -610,24 +608,18 @@ func isURL(u string) bool { return p.Scheme == "http" || p.Scheme == "https" } -func headersWithAuth(auths ...interface{}) (map[string]string, error) { +func headersWithAuth(auths ...registryAuth) (map[string]string, error) { var headers = make(map[string]string) for _, auth := range auths { - switch auth.(type) { - case AuthConfiguration: - var buf bytes.Buffer - if err := json.NewEncoder(&buf).Encode(auth); err != nil { - return nil, err - } - headers["X-Registry-Auth"] = base64.URLEncoding.EncodeToString(buf.Bytes()) - case AuthConfigurations, AuthConfigurations119: - var buf bytes.Buffer - if err := json.NewEncoder(&buf).Encode(auth); err != nil { - return nil, err - } - headers["X-Registry-Config"] = base64.URLEncoding.EncodeToString(buf.Bytes()) + if auth.isEmpty() { + continue + } + data, err := json.Marshal(auth) + if err != nil { + return nil, err } + headers[auth.headerKey()] = base64.URLEncoding.EncodeToString(data) } return headers, nil diff --git a/vendor/github.com/fsouza/go-dockerclient/internal/archive/archive.go b/vendor/github.com/fsouza/go-dockerclient/internal/archive/archive.go index 7d7cf496a..f11ee0ee3 100644 --- a/vendor/github.com/fsouza/go-dockerclient/internal/archive/archive.go +++ b/vendor/github.com/fsouza/go-dockerclient/internal/archive/archive.go @@ -10,6 +10,7 @@ import ( "compress/gzip" "fmt" "io" + "log" "os" "path/filepath" "strings" @@ -18,7 +19,6 @@ import ( "github.com/docker/docker/pkg/idtools" "github.com/docker/docker/pkg/pools" "github.com/docker/docker/pkg/system" - "github.com/sirupsen/logrus" ) const ( @@ -65,31 +65,30 @@ type WhiteoutFormat int // TarOptions wraps the tar options. type TarOptions struct { - IncludeFiles []string - ExcludePatterns []string - Compression Compression - NoLchown bool - UIDMaps []idtools.IDMap - GIDMaps []idtools.IDMap - ChownOpts *idtools.Identity - IncludeSourceDir bool + IncludeFiles []string + ExcludePatterns []string + Compression Compression + UIDMaps []idtools.IDMap + GIDMaps []idtools.IDMap + ChownOpts *idtools.Identity // WhiteoutFormat is the expected on disk format for whiteout files. // This format will be converted to the standard format on pack // and from the standard format on unpack. WhiteoutFormat WhiteoutFormat // When unpacking, specifies whether overwriting a directory with a // non-directory is allowed and vice versa. - NoOverwriteDirNonDir bool // For each include when creating an archive, the included name will be // replaced with the matching name from this map. - RebaseNames map[string]string - InUserNS bool + RebaseNames map[string]string + NoLchown bool + InUserNS bool + IncludeSourceDir bool + NoOverwriteDirNonDir bool } // TarWithOptions creates an archive from the directory at `path`, only including files whose relative // paths are included in `options.IncludeFiles` (if non-nil) or not in `options.ExcludePatterns`. func TarWithOptions(srcPath string, options *TarOptions) (io.ReadCloser, error) { - // Fix the source path to work with long path names. This is a no-op // on platforms other than Windows. srcPath = fixVolumePathPrefix(srcPath) @@ -117,13 +116,13 @@ func TarWithOptions(srcPath string, options *TarOptions) (io.ReadCloser, error) defer func() { // Make sure to check the error on Close. if err := ta.TarWriter.Close(); err != nil { - logrus.Errorf("Can't close tar writer: %s", err) + log.Printf("Can't close tar writer: %s", err) } if err := compressWriter.Close(); err != nil { - logrus.Errorf("Can't close compress writer: %s", err) + log.Printf("Can't close compress writer: %s", err) } if err := pipeWriter.Close(); err != nil { - logrus.Errorf("Can't close pipe writer: %s", err) + log.Printf("Can't close pipe writer: %s", err) } }() @@ -146,7 +145,7 @@ func TarWithOptions(srcPath string, options *TarOptions) (io.ReadCloser, error) // directory. So, we must split the source path and use the // basename as the include. if len(options.IncludeFiles) > 0 { - logrus.Warn("Tar: Can't archive a file with includes") + log.Print("Tar: Can't archive a file with includes") } dir, base := SplitPathDirEntry(srcPath) @@ -161,12 +160,13 @@ func TarWithOptions(srcPath string, options *TarOptions) (io.ReadCloser, error) seen := make(map[string]bool) for _, include := range options.IncludeFiles { + include := include rebaseName := options.RebaseNames[include] walkRoot := getWalkRoot(srcPath, include) filepath.Walk(walkRoot, func(filePath string, f os.FileInfo, err error) error { if err != nil { - logrus.Errorf("Tar: Can't stat file %s to tar: %s", srcPath, err) + log.Printf("Tar: Can't stat file %s to tar: %s", srcPath, err) return nil } @@ -191,7 +191,7 @@ func TarWithOptions(srcPath string, options *TarOptions) (io.ReadCloser, error) if include != relFilePath { skip, err = pm.Matches(relFilePath) if err != nil { - logrus.Errorf("Error matching %s: %v", relFilePath, err) + log.Printf("Error matching %s: %v", relFilePath, err) return err } } @@ -247,7 +247,7 @@ func TarWithOptions(srcPath string, options *TarOptions) (io.ReadCloser, error) } if err := ta.addTarFile(filePath, relFilePath); err != nil { - logrus.Errorf("Can't add file %s to tar: %s", filePath, err) + log.Printf("Can't add file %s to tar: %s", filePath, err) // if pipe is broken, stop writing tar stream to it if err == io.ErrClosedPipe { return err @@ -276,8 +276,10 @@ func CompressStream(dest io.Writer, compression Compression) (io.WriteCloser, er case Bzip2, Xz: // archive/bzip2 does not support writing, and there is no xz support at all // However, this is not a problem as docker only currently generates gzipped tars + //lint:ignore ST1005 this is vendored/copied code return nil, fmt.Errorf("Unsupported compression format %s", (&compression).Extension()) default: + //lint:ignore ST1005 this is vendored/copied code return nil, fmt.Errorf("Unsupported compression format %s", (&compression).Extension()) } } @@ -355,13 +357,13 @@ func (ta *tarAppender) addTarFile(path, name string) error { } } - //check whether the file is overlayfs whiteout - //if yes, skip re-mapping container ID mappings. + // check whether the file is overlayfs whiteout + // if yes, skip re-mapping container ID mappings. isOverlayWhiteout := fi.Mode()&os.ModeCharDevice != 0 && hdr.Devmajor == 0 && hdr.Devminor == 0 - //handle re-mapping container ID mappings back to host ID mappings before - //writing tar headers/files. We skip whiteout files because they were written - //by the kernel and already have proper ownership relative to the host + // handle re-mapping container ID mappings back to host ID mappings before + // writing tar headers/files. We skip whiteout files because they were written + // by the kernel and already have proper ownership relative to the host if !isOverlayWhiteout && !strings.HasPrefix(filepath.Base(hdr.Name), WhiteoutPrefix) && !ta.IdentityMapping.Empty() { @@ -437,7 +439,9 @@ func (ta *tarAppender) addTarFile(path, name string) error { func ReadSecurityXattrToTarHeader(path string, hdr *tar.Header) error { capability, _ := system.Lgetxattr(path, "security.capability") if capability != nil { + //lint:ignore SA1019 this is vendored/copied code hdr.Xattrs = make(map[string]string) + //lint:ignore SA1019 this is vendored/copied code hdr.Xattrs["security.capability"] = string(capability) } return nil @@ -490,7 +494,7 @@ func fillGo18FileTypeBits(mode int64, fi os.FileInfo) int64 { } // canonicalTarName provides a platform-independent and consistent posix-style -//path for files and directories to be archived regardless of the platform. +// path for files and directories to be archived regardless of the platform. func canonicalTarName(name string, isDir bool) (string, error) { name, err := CanonicalTarNameForPath(name) if err != nil { diff --git a/vendor/github.com/fsouza/go-dockerclient/internal/archive/archive_linux.go b/vendor/github.com/fsouza/go-dockerclient/internal/archive/archive_linux.go index 9e1f3f2f1..e2059e489 100644 --- a/vendor/github.com/fsouza/go-dockerclient/internal/archive/archive_linux.go +++ b/vendor/github.com/fsouza/go-dockerclient/internal/archive/archive_linux.go @@ -49,7 +49,9 @@ func (overlayWhiteoutConverter) ConvertWrite(hdr *tar.Header, path string, fi os return nil, err } if len(opaque) == 1 && opaque[0] == 'y' { + //lint:ignore SA1019 this is vendored/copied code if hdr.Xattrs != nil { + //lint:ignore SA1019 this is vendored/copied code delete(hdr.Xattrs, "trusted.overlay.opaque") } diff --git a/vendor/github.com/fsouza/go-dockerclient/internal/archive/archive_unix.go b/vendor/github.com/fsouza/go-dockerclient/internal/archive/archive_unix.go index 80199d513..bb6bf7145 100644 --- a/vendor/github.com/fsouza/go-dockerclient/internal/archive/archive_unix.go +++ b/vendor/github.com/fsouza/go-dockerclient/internal/archive/archive_unix.go @@ -42,7 +42,7 @@ func getInodeFromStat(stat interface{}) (inode uint64, err error) { s, ok := stat.(*syscall.Stat_t) if ok { - inode = uint64(s.Ino) + inode = s.Ino } return diff --git a/vendor/github.com/fsouza/go-dockerclient/internal/archive/archive_windows.go b/vendor/github.com/fsouza/go-dockerclient/internal/archive/archive_windows.go index c47768e68..33c1dff03 100644 --- a/vendor/github.com/fsouza/go-dockerclient/internal/archive/archive_windows.go +++ b/vendor/github.com/fsouza/go-dockerclient/internal/archive/archive_windows.go @@ -24,10 +24,10 @@ func CanonicalTarNameForPath(p string) (string, error) { // in file names, it is mostly safe to replace however we must // check just in case if strings.Contains(p, "/") { + //lint:ignore ST1005 Windows should be capitalized :) return "", fmt.Errorf("Windows path contains forward slash: %s", p) } return strings.Replace(p, string(os.PathSeparator), "/", -1), nil - } // fixVolumePathPrefix does platform specific processing to ensure that if @@ -55,7 +55,7 @@ func getFileIdentity(stat interface{}) (idtools.Identity, error) { // chmodTarEntry is used to adjust the file permissions used in tar header based // on the platform the archival is done. func chmodTarEntry(perm os.FileMode) os.FileMode { - //perm &= 0755 // this 0-ed out tar flags (like link, regular file, directory marker etc.) + // perm &= 0755 // this 0-ed out tar flags (like link, regular file, directory marker etc.) permPart := perm & os.ModePerm noPermPart := perm &^ os.ModePerm // Add the x bit: make everything +x from windows diff --git a/vendor/github.com/fsouza/go-dockerclient/internal/jsonmessage/jsonmessage.go b/vendor/github.com/fsouza/go-dockerclient/internal/jsonmessage/jsonmessage.go index 71b3395ce..99a32ae05 100644 --- a/vendor/github.com/fsouza/go-dockerclient/internal/jsonmessage/jsonmessage.go +++ b/vendor/github.com/fsouza/go-dockerclient/internal/jsonmessage/jsonmessage.go @@ -12,9 +12,9 @@ import ( "strings" "time" - "github.com/Nvveen/Gotty" - "github.com/docker/go-units" + units "github.com/docker/go-units" "github.com/fsouza/go-dockerclient/internal/term" + gotty "github.com/ijc/Gotty" ) // RFC3339NanoFixed is time.RFC3339Nano with nanoseconds padded using zeros to @@ -144,13 +144,13 @@ type JSONMessage struct { Stream string `json:"stream,omitempty"` Status string `json:"status,omitempty"` Progress *JSONProgress `json:"progressDetail,omitempty"` - ProgressMessage string `json:"progress,omitempty"` //deprecated + ProgressMessage string `json:"progress,omitempty"` // deprecated ID string `json:"id,omitempty"` From string `json:"from,omitempty"` Time int64 `json:"time,omitempty"` TimeNano int64 `json:"timeNano,omitempty"` Error *JSONError `json:"errorDetail,omitempty"` - ErrorMessage string `json:"error,omitempty"` //deprecated + ErrorMessage string `json:"error,omitempty"` // deprecated // Aux contains out-of-band data, such as digests for push signing and image id after building. Aux *json.RawMessage `json:"aux,omitempty"` } @@ -166,43 +166,72 @@ func (ti *noTermInfo) Parse(attr string, params ...interface{}) (string, error) return "", fmt.Errorf("noTermInfo") } -func clearLine(out io.Writer, ti termInfo) { +func clearLine(out io.Writer, ti termInfo) error { // el2 (clear whole line) is not exposed by terminfo. // First clear line from beginning to cursor if attr, err := ti.Parse("el1"); err == nil { - fmt.Fprintf(out, "%s", attr) + _, err = fmt.Fprintf(out, "%s", attr) + if err != nil { + return err + } } else { - fmt.Fprintf(out, "\x1b[1K") + _, err := fmt.Fprintf(out, "\x1b[1K") + if err != nil { + return err + } } // Then clear line from cursor to end if attr, err := ti.Parse("el"); err == nil { - fmt.Fprintf(out, "%s", attr) + _, err = fmt.Fprintf(out, "%s", attr) + if err != nil { + return err + } } else { - fmt.Fprintf(out, "\x1b[K") + _, err := fmt.Fprintf(out, "\x1b[K") + if err != nil { + return err + } } + + return nil } -func cursorUp(out io.Writer, ti termInfo, l int) { +func cursorUp(out io.Writer, ti termInfo, l int) error { if l == 0 { // Should never be the case, but be tolerant - return + return nil } if attr, err := ti.Parse("cuu", l); err == nil { - fmt.Fprintf(out, "%s", attr) + _, err = fmt.Fprintf(out, "%s", attr) + if err != nil { + return err + } } else { - fmt.Fprintf(out, "\x1b[%dA", l) + _, err := fmt.Fprintf(out, "\x1b[%dA", l) + if err != nil { + return err + } } + return nil } -func cursorDown(out io.Writer, ti termInfo, l int) { +func cursorDown(out io.Writer, ti termInfo, l int) error { if l == 0 { // Should never be the case, but be tolerant - return + return nil } if attr, err := ti.Parse("cud", l); err == nil { - fmt.Fprintf(out, "%s", attr) + _, err = fmt.Fprintf(out, "%s", attr) + if err != nil { + return err + } } else { - fmt.Fprintf(out, "\x1b[%dB", l) + _, err := fmt.Fprintf(out, "\x1b[%dB", l) + if err != nil { + return err + } } + + return nil } // Display displays the JSONMessage to `out`. `termInfo` is non-nil if `out` @@ -219,29 +248,56 @@ func (jm *JSONMessage) Display(out io.Writer, termInfo termInfo) error { if termInfo != nil && jm.Stream == "" && jm.Progress != nil { clearLine(out, termInfo) endl = "\r" - fmt.Fprintf(out, endl) - } else if jm.Progress != nil && jm.Progress.String() != "" { //disable progressbar in non-terminal + _, err := fmt.Fprint(out, endl) + if err != nil { + return err + } + } else if jm.Progress != nil && jm.Progress.String() != "" { // disable progressbar in non-terminal return nil } if jm.TimeNano != 0 { - fmt.Fprintf(out, "%s ", time.Unix(0, jm.TimeNano).Format(RFC3339NanoFixed)) + _, err := fmt.Fprintf(out, "%s ", time.Unix(0, jm.TimeNano).Format(RFC3339NanoFixed)) + if err != nil { + return err + } } else if jm.Time != 0 { - fmt.Fprintf(out, "%s ", time.Unix(jm.Time, 0).Format(RFC3339NanoFixed)) + _, err := fmt.Fprintf(out, "%s ", time.Unix(jm.Time, 0).Format(RFC3339NanoFixed)) + if err != nil { + return err + } } if jm.ID != "" { - fmt.Fprintf(out, "%s: ", jm.ID) + _, err := fmt.Fprintf(out, "%s: ", jm.ID) + if err != nil { + return err + } } if jm.From != "" { - fmt.Fprintf(out, "(from %s) ", jm.From) + _, err := fmt.Fprintf(out, "(from %s) ", jm.From) + if err != nil { + return err + } } if jm.Progress != nil && termInfo != nil { - fmt.Fprintf(out, "%s %s%s", jm.Status, jm.Progress.String(), endl) - } else if jm.ProgressMessage != "" { //deprecated - fmt.Fprintf(out, "%s %s%s", jm.Status, jm.ProgressMessage, endl) + _, err := fmt.Fprintf(out, "%s %s%s", jm.Status, jm.Progress.String(), endl) + if err != nil { + return err + } + } else if jm.ProgressMessage != "" { // deprecated + _, err := fmt.Fprintf(out, "%s %s%s", jm.Status, jm.ProgressMessage, endl) + if err != nil { + return err + } } else if jm.Stream != "" { - fmt.Fprintf(out, "%s%s", jm.Stream, endl) + _, err := fmt.Fprintf(out, "%s%s", jm.Stream, endl) + if err != nil { + return err + } } else { - fmt.Fprintf(out, "%s%s\n", jm.Status, endl) + _, err := fmt.Fprintf(out, "%s%s\n", jm.Status, endl) + if err != nil { + return err + } } return nil } @@ -301,12 +357,17 @@ func DisplayJSONMessagesStream(in io.Reader, out io.Writer, terminalFd uintptr, line = len(ids) ids[jm.ID] = line if termInfo != nil { - fmt.Fprintf(out, "\n") + _, err := fmt.Fprintf(out, "\n") + if err != nil { + return err + } } } diff = len(ids) - line if termInfo != nil { - cursorUp(out, termInfo, diff) + if err := cursorUp(out, termInfo, diff); err != nil { + return err + } } } else { // When outputting something that isn't progress @@ -318,7 +379,9 @@ func DisplayJSONMessagesStream(in io.Reader, out io.Writer, terminalFd uintptr, } err := jm.Display(out, termInfo) if jm.ID != "" && termInfo != nil { - cursorDown(out, termInfo, diff) + if err := cursorDown(out, termInfo, diff); err != nil { + return err + } } if err != nil { return err diff --git a/vendor/github.com/fsouza/go-dockerclient/internal/term/term.go b/vendor/github.com/fsouza/go-dockerclient/internal/term/term.go index af06911d8..7d3c11358 100644 --- a/vendor/github.com/fsouza/go-dockerclient/internal/term/term.go +++ b/vendor/github.com/fsouza/go-dockerclient/internal/term/term.go @@ -8,6 +8,4 @@ package term type Winsize struct { Height uint16 Width uint16 - x uint16 - y uint16 } diff --git a/vendor/github.com/fsouza/go-dockerclient/internal/term/winsize.go b/vendor/github.com/fsouza/go-dockerclient/internal/term/winsize.go index 2a9964a0d..92a80a308 100644 --- a/vendor/github.com/fsouza/go-dockerclient/internal/term/winsize.go +++ b/vendor/github.com/fsouza/go-dockerclient/internal/term/winsize.go @@ -11,6 +11,6 @@ import "golang.org/x/sys/unix" // GetWinsize returns the window size based on the specified file descriptor. func GetWinsize(fd uintptr) (*Winsize, error) { uws, err := unix.IoctlGetWinsize(int(fd), unix.TIOCGWINSZ) - ws := &Winsize{Height: uws.Row, Width: uws.Col, x: uws.Xpixel, y: uws.Ypixel} + ws := &Winsize{Height: uws.Row, Width: uws.Col} return ws, err } diff --git a/vendor/github.com/fsouza/go-dockerclient/misc.go b/vendor/github.com/fsouza/go-dockerclient/misc.go index 1fc37b14e..01fd1f687 100644 --- a/vendor/github.com/fsouza/go-dockerclient/misc.go +++ b/vendor/github.com/fsouza/go-dockerclient/misc.go @@ -17,7 +17,7 @@ import ( // // See https://goo.gl/mU7yje for more details. func (c *Client) Version() (*Env, error) { - return c.VersionWithContext(nil) + return c.VersionWithContext(context.TODO()) } // VersionWithContext returns version information about the docker server. @@ -48,19 +48,6 @@ type DockerInfo struct { DriverStatus [][2]string SystemStatus [][2]string Plugins PluginsInfo - MemoryLimit bool - SwapLimit bool - KernelMemory bool - CPUCfsPeriod bool `json:"CpuCfsPeriod"` - CPUCfsQuota bool `json:"CpuCfsQuota"` - CPUShares bool - CPUSet bool - IPv4Forwarding bool - BridgeNfIptables bool - BridgeNfIP6tables bool `json:"BridgeNfIp6tables"` - Debug bool - OomKillDisable bool - ExperimentalBuild bool NFd int NGoroutines int SystemTime string @@ -85,12 +72,34 @@ type DockerInfo struct { Labels []string ServerVersion string ClusterStore string + Runtimes map[string]Runtime ClusterAdvertise string Isolation string InitBinary string DefaultRuntime string - LiveRestoreEnabled bool Swarm swarm.Info + LiveRestoreEnabled bool + MemoryLimit bool + SwapLimit bool + KernelMemory bool + CPUCfsPeriod bool `json:"CpuCfsPeriod"` + CPUCfsQuota bool `json:"CpuCfsQuota"` + CPUShares bool + CPUSet bool + IPv4Forwarding bool + BridgeNfIptables bool + BridgeNfIP6tables bool `json:"BridgeNfIp6tables"` + Debug bool + OomKillDisable bool + ExperimentalBuild bool +} + +// Runtime describes an OCI runtime +// +// for more information, see: https://dockr.ly/2NKM8qq +type Runtime struct { + Path string + Args []string `json:"runtimeArgs"` } // PluginsInfo is a struct with the plugins registered with the docker daemon diff --git a/vendor/github.com/fsouza/go-dockerclient/plugin.go b/vendor/github.com/fsouza/go-dockerclient/plugin.go index 957015907..088790313 100644 --- a/vendor/github.com/fsouza/go-dockerclient/plugin.go +++ b/vendor/github.com/fsouza/go-dockerclient/plugin.go @@ -40,10 +40,10 @@ func (c *Client) InstallPlugins(opts InstallPluginOptions) error { data: opts.Plugins, context: opts.Context, }) - defer resp.Body.Close() if err != nil { return err } + resp.Body.Close() return nil } @@ -288,7 +288,6 @@ type EnablePluginOptions struct { func (c *Client) EnablePlugin(opts EnablePluginOptions) error { path := "/plugins/" + opts.Name + "/enable?" + queryString(opts) resp, err := c.do("POST", path, doOptions{context: opts.Context}) - defer resp.Body.Close() if err != nil { return err } @@ -312,7 +311,6 @@ type DisablePluginOptions struct { func (c *Client) DisablePlugin(opts DisablePluginOptions) error { path := "/plugins/" + opts.Name + "/disable" resp, err := c.do("POST", path, doOptions{context: opts.Context}) - defer resp.Body.Close() if err != nil { return err } @@ -339,11 +337,12 @@ func (c *Client) CreatePlugin(opts CreatePluginOptions) (string, error) { path := "/plugins/create?" + queryString(opts) resp, err := c.do("POST", path, doOptions{ data: opts.Path, - context: opts.Context}) - defer resp.Body.Close() + context: opts.Context, + }) if err != nil { return "", err } + defer resp.Body.Close() containerNameBytes, err := ioutil.ReadAll(resp.Body) if err != nil { return "", err @@ -367,10 +366,10 @@ type PushPluginOptions struct { func (c *Client) PushPlugin(opts PushPluginOptions) error { path := "/plugins/" + opts.Name + "/push" resp, err := c.do("POST", path, doOptions{context: opts.Context}) - defer resp.Body.Close() if err != nil { return err } + resp.Body.Close() return nil } @@ -394,13 +393,13 @@ func (c *Client) ConfigurePlugin(opts ConfigurePluginOptions) error { data: opts.Envs, context: opts.Context, }) - defer resp.Body.Close() if err != nil { if e, ok := err.(*Error); ok && e.Status == http.StatusNotFound { return &NoSuchPlugin{ID: opts.Name} } return err } + resp.Body.Close() return nil } diff --git a/vendor/github.com/fsouza/go-dockerclient/registry_auth.go b/vendor/github.com/fsouza/go-dockerclient/registry_auth.go new file mode 100644 index 000000000..1f60d1e8f --- /dev/null +++ b/vendor/github.com/fsouza/go-dockerclient/registry_auth.go @@ -0,0 +1,10 @@ +// Copyright 2013 go-dockerclient authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package docker + +type registryAuth interface { + isEmpty() bool + headerKey() string +} diff --git a/vendor/github.com/fsouza/go-dockerclient/swarm_service.go b/vendor/github.com/fsouza/go-dockerclient/swarm_service.go index ca7e23725..d9c4b2acc 100644 --- a/vendor/github.com/fsouza/go-dockerclient/swarm_service.go +++ b/vendor/github.com/fsouza/go-dockerclient/swarm_service.go @@ -176,10 +176,10 @@ type LogsServiceOptions struct { ErrorStream io.Writer `qs:"-"` InactivityTimeout time.Duration `qs:"-"` Tail string + Since int64 // Use raw terminal? Usually true when the container contains a TTY. RawTerminal bool `qs:"-"` - Since int64 Follow bool Stdout bool Stderr bool diff --git a/vendor/github.com/fsouza/go-dockerclient/system.go b/vendor/github.com/fsouza/go-dockerclient/system.go new file mode 100644 index 000000000..a43dfb5a2 --- /dev/null +++ b/vendor/github.com/fsouza/go-dockerclient/system.go @@ -0,0 +1,72 @@ +package docker + +import ( + "context" + "encoding/json" +) + +// VolumeUsageData represents usage data from the docker system api +// More Info Here https://dockr.ly/2PNzQyO +type VolumeUsageData struct { + + // The number of containers referencing this volume. This field + // is set to `-1` if the reference-count is not available. + // + // Required: true + RefCount int64 `json:"RefCount"` + + // Amount of disk space used by the volume (in bytes). This information + // is only available for volumes created with the `"local"` volume + // driver. For volumes created with other volume drivers, this field + // is set to `-1` ("not available") + // + // Required: true + Size int64 `json:"Size"` +} + +// ImageSummary represents data about what images are +// currently known to docker +// More Info Here https://dockr.ly/2PNzQyO +type ImageSummary struct { + Containers int64 `json:"Containers"` + Created int64 `json:"Created"` + ID string `json:"Id"` + Labels map[string]string `json:"Labels"` + ParentID string `json:"ParentId"` + RepoDigests []string `json:"RepoDigests"` + RepoTags []string `json:"RepoTags"` + SharedSize int64 `json:"SharedSize"` + Size int64 `json:"Size"` + VirtualSize int64 `json:"VirtualSize"` +} + +// DiskUsage holds information about what docker is using disk space on. +// More Info Here https://dockr.ly/2PNzQyO +type DiskUsage struct { + LayersSize int64 + Images []*ImageSummary + Containers []*APIContainers + Volumes []*Volume +} + +// DiskUsageOptions only contains a context for canceling. +type DiskUsageOptions struct { + Context context.Context +} + +// DiskUsage returns a *DiskUsage describing what docker is using disk on. +// +// More Info Here https://dockr.ly/2PNzQyO +func (c *Client) DiskUsage(opts DiskUsageOptions) (*DiskUsage, error) { + path := "/system/df" + resp, err := c.do("GET", path, doOptions{context: opts.Context}) + if err != nil { + return nil, err + } + defer resp.Body.Close() + var du *DiskUsage + if err := json.NewDecoder(resp.Body).Decode(&du); err != nil { + return nil, err + } + return du, nil +} diff --git a/vendor/github.com/fsouza/go-dockerclient/tls.go b/vendor/github.com/fsouza/go-dockerclient/tls.go index 5f0e2e31e..07661f3d1 100644 --- a/vendor/github.com/fsouza/go-dockerclient/tls.go +++ b/vendor/github.com/fsouza/go-dockerclient/tls.go @@ -38,7 +38,7 @@ func tlsDialWithDialer(dialer *net.Dialer, network, addr string, config *tls.Con timeout := dialer.Timeout if !dialer.Deadline.IsZero() { - deadlineTimeout := dialer.Deadline.Sub(time.Now()) + deadlineTimeout := time.Until(dialer.Deadline) if timeout == 0 || deadlineTimeout < timeout { timeout = deadlineTimeout } |