From 9b525bc9d184f5483b671b14e987eebefe49790e Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Fri, 18 Oct 2024 16:32:42 +0200 Subject: [PATCH] vendor: github.com/docker/docker 36a3bd090489 (master, v28.0-dev) full diff: https://github.com/docker/docker/compare/164cae56ed95...36a3bd090489966928e26b29ae1ed9e0ce9e7016 Signed-off-by: Sebastiaan van Stijn --- docs/generate/go.mod | 2 +- man/go.mod | 2 +- scripts/vendor | 2 +- vendor.mod | 4 +- vendor.sum | 4 +- .../github.com/docker/docker/api/swagger.yaml | 8 +- .../docker/docker/api/types/system/info.go | 9 +- .../docker/docker/api/types/types.go | 2 + .../github.com/docker/docker/client/client.go | 2 +- .../docker/docker/client/container_create.go | 52 ++++++-- .../docker/docker/client/container_resize.go | 5 +- .../docker/docker/client/image_build.go | 118 ++++++++++++------ .../docker/docker/pkg/archive/archive.go | 6 +- .../docker/docker/registry/config.go | 2 +- vendor/modules.txt | 2 +- 15 files changed, 155 insertions(+), 65 deletions(-) diff --git a/docs/generate/go.mod b/docs/generate/go.mod index 325a35b0aff4..451d2965338c 100644 --- a/docs/generate/go.mod +++ b/docs/generate/go.mod @@ -3,7 +3,7 @@ module github.com/docker/cli/docs/generate // dummy go.mod to avoid dealing with dependencies specific // to docs generation and not really part of the project. -go 1.16 +go 1.22.0 //require ( // github.com/docker/cli v0.0.0+incompatible diff --git a/man/go.mod b/man/go.mod index ac138088504c..c3c1e45166e2 100644 --- a/man/go.mod +++ b/man/go.mod @@ -3,7 +3,7 @@ module github.com/docker/cli/man // dummy go.mod to avoid dealing with dependencies specific // to manpages generation and not really part of the project. -go 1.16 +go 1.12.0 //require ( // github.com/docker/cli v0.0.0+incompatible diff --git a/scripts/vendor b/scripts/vendor index eac9f8dea69f..db8fd42be6ef 100755 --- a/scripts/vendor +++ b/scripts/vendor @@ -18,7 +18,7 @@ init() { cat > go.mod < 0 { + query["t"] = options.Tags + } + if len(options.SecurityOpt) > 0 { + query["securityopt"] = options.SecurityOpt + } + if len(options.ExtraHosts) > 0 { + query["extrahosts"] = options.ExtraHosts } if options.SuppressOutput { query.Set("q", "1") @@ -58,9 +64,11 @@ func (cli *Client) imageBuildOptionsToQuery(ctx context.Context, options types.I if options.NoCache { query.Set("nocache", "1") } - if options.Remove { - query.Set("rm", "1") - } else { + if !options.Remove { + // only send value when opting out because the daemon's default is + // to remove intermediate containers after a successful build, + // + // TODO(thaJeztah): deprecate "Remove" option, and provide a "NoRemove" or "Keep" option instead. query.Set("rm", "0") } @@ -83,42 +91,70 @@ func (cli *Client) imageBuildOptionsToQuery(ctx context.Context, options types.I query.Set("isolation", string(options.Isolation)) } - query.Set("cpusetcpus", options.CPUSetCPUs) - query.Set("networkmode", options.NetworkMode) - query.Set("cpusetmems", options.CPUSetMems) - query.Set("cpushares", strconv.FormatInt(options.CPUShares, 10)) - query.Set("cpuquota", strconv.FormatInt(options.CPUQuota, 10)) - query.Set("cpuperiod", strconv.FormatInt(options.CPUPeriod, 10)) - query.Set("memory", strconv.FormatInt(options.Memory, 10)) - query.Set("memswap", strconv.FormatInt(options.MemorySwap, 10)) - query.Set("cgroupparent", options.CgroupParent) - query.Set("shmsize", strconv.FormatInt(options.ShmSize, 10)) - query.Set("dockerfile", options.Dockerfile) - query.Set("target", options.Target) - - ulimitsJSON, err := json.Marshal(options.Ulimits) - if err != nil { - return query, err + if options.CPUSetCPUs != "" { + query.Set("cpusetcpus", options.CPUSetCPUs) } - query.Set("ulimits", string(ulimitsJSON)) - - buildArgsJSON, err := json.Marshal(options.BuildArgs) - if err != nil { - return query, err + if options.NetworkMode != "" && options.NetworkMode != network.NetworkDefault { + query.Set("networkmode", options.NetworkMode) } - query.Set("buildargs", string(buildArgsJSON)) - - labelsJSON, err := json.Marshal(options.Labels) - if err != nil { - return query, err + if options.CPUSetMems != "" { + query.Set("cpusetmems", options.CPUSetMems) } - query.Set("labels", string(labelsJSON)) - - cacheFromJSON, err := json.Marshal(options.CacheFrom) - if err != nil { - return query, err + if options.CPUShares != 0 { + query.Set("cpushares", strconv.FormatInt(options.CPUShares, 10)) + } + if options.CPUQuota != 0 { + query.Set("cpuquota", strconv.FormatInt(options.CPUQuota, 10)) + } + if options.CPUPeriod != 0 { + query.Set("cpuperiod", strconv.FormatInt(options.CPUPeriod, 10)) + } + if options.Memory != 0 { + query.Set("memory", strconv.FormatInt(options.Memory, 10)) + } + if options.MemorySwap != 0 { + query.Set("memswap", strconv.FormatInt(options.MemorySwap, 10)) + } + if options.CgroupParent != "" { + query.Set("cgroupparent", options.CgroupParent) + } + if options.ShmSize != 0 { + query.Set("shmsize", strconv.FormatInt(options.ShmSize, 10)) + } + if options.Dockerfile != "" { + query.Set("dockerfile", options.Dockerfile) + } + if options.Target != "" { + query.Set("target", options.Target) + } + if len(options.Ulimits) != 0 { + ulimitsJSON, err := json.Marshal(options.Ulimits) + if err != nil { + return query, err + } + query.Set("ulimits", string(ulimitsJSON)) + } + if len(options.BuildArgs) != 0 { + buildArgsJSON, err := json.Marshal(options.BuildArgs) + if err != nil { + return query, err + } + query.Set("buildargs", string(buildArgsJSON)) + } + if len(options.Labels) != 0 { + labelsJSON, err := json.Marshal(options.Labels) + if err != nil { + return query, err + } + query.Set("labels", string(labelsJSON)) + } + if len(options.CacheFrom) != 0 { + cacheFromJSON, err := json.Marshal(options.CacheFrom) + if err != nil { + return query, err + } + query.Set("cachefrom", string(cacheFromJSON)) } - query.Set("cachefrom", string(cacheFromJSON)) if options.SessionID != "" { query.Set("session", options.SessionID) } @@ -131,7 +167,9 @@ func (cli *Client) imageBuildOptionsToQuery(ctx context.Context, options types.I if options.BuildID != "" { query.Set("buildid", options.BuildID) } - query.Set("version", string(options.Version)) + if options.Version != "" { + query.Set("version", string(options.Version)) + } if options.Outputs != nil { outputsJSON, err := json.Marshal(options.Outputs) diff --git a/vendor/github.com/docker/docker/pkg/archive/archive.go b/vendor/github.com/docker/docker/pkg/archive/archive.go index cde64f08ebc1..042dd337004d 100644 --- a/vendor/github.com/docker/docker/pkg/archive/archive.go +++ b/vendor/github.com/docker/docker/pkg/archive/archive.go @@ -654,7 +654,7 @@ func (ta *tarAppender) addTarFile(path, name string) error { ta.Buffer.Reset(ta.TarWriter) defer ta.Buffer.Reset(nil) - _, err = io.Copy(ta.Buffer, file) + _, err = pools.Copy(ta.Buffer, file) file.Close() if err != nil { return err @@ -705,7 +705,7 @@ func createTarFile(path, extractDir string, hdr *tar.Header, reader io.Reader, o if err != nil { return err } - if _, err := io.Copy(file, reader); err != nil { + if _, err := pools.Copy(file, reader); err != nil { file.Close() return err } @@ -1375,7 +1375,7 @@ func (archiver *Archiver) CopyFileWithTar(src, dst string) (err error) { if err := tw.WriteHeader(hdr); err != nil { return err } - if _, err := io.Copy(tw, srcF); err != nil { + if _, err := pools.Copy(tw, srcF); err != nil { return err } return nil diff --git a/vendor/github.com/docker/docker/registry/config.go b/vendor/github.com/docker/docker/registry/config.go index e1b0a0ca14c6..3ec6ec715d91 100644 --- a/vendor/github.com/docker/docker/registry/config.go +++ b/vendor/github.com/docker/docker/registry/config.go @@ -184,7 +184,7 @@ func (config *serviceConfig) loadMirrors(mirrors []string) error { func (config *serviceConfig) loadInsecureRegistries(registries []string) error { // Localhost is by default considered as an insecure registry. This is a // stop-gap for people who are running a private registry on localhost. - registries = append(registries, "127.0.0.0/8") + registries = append(registries, "::1/128", "127.0.0.0/8") var ( insecureRegistryCIDRs = make([]*registry.NetIPNet, 0) diff --git a/vendor/modules.txt b/vendor/modules.txt index 9a8d1711916b..1ee06a03930c 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -55,7 +55,7 @@ github.com/docker/distribution/registry/client/transport github.com/docker/distribution/registry/storage/cache github.com/docker/distribution/registry/storage/cache/memory github.com/docker/distribution/uuid -# github.com/docker/docker v27.0.2-0.20240912171519-164cae56ed95+incompatible +# github.com/docker/docker v27.0.2-0.20241018142220-36a3bd090489+incompatible ## explicit github.com/docker/docker/api github.com/docker/docker/api/types