From 323ef1997f5d20127067685fbd9059b46c8ee912 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Wed, 23 Jul 2025 09:35:43 +0200 Subject: [PATCH] vendor: docker/docker, moby/api, moby/client to latest Signed-off-by: Sebastiaan van Stijn --- vendor.mod | 6 +- vendor.sum | 12 ++-- .../docker/docker/pkg/process/process.go | 29 +++++++++ .../docker/pkg/process/process_linux.go | 24 ++++++++ .../docker/pkg/process/process_nolinux.go | 7 +++ .../docker/docker/pkg/process/process_unix.go | 41 ++----------- .../docker/pkg/process/process_windows.go | 6 +- .../moby/moby/api/stdcopy/stdcopy.go | 59 +++++++++++-------- .../github.com/moby/moby/api/types/client.go | 2 +- .../moby/api/types/container/container.go | 4 +- .../moby/moby/api/types/container/health.go | 6 ++ .../moby/moby/api/types/image/opts.go | 4 +- .../moby/moby/api/types/registry/registry.go | 3 - .../moby/moby/api/types/registry/search.go | 2 +- .../moby/moby/api/types/swarm/node.go | 2 +- .../moby/moby/api/types/swarm/runtime/gen.go | 2 +- .../moby/moby/client/container_exec.go | 9 +++ .../moby/moby/client/container_list.go | 9 +++ vendor/github.com/moby/moby/client/events.go | 10 ++++ vendor/github.com/moby/moby/client/hijack.go | 4 +- vendor/github.com/moby/moby/client/request.go | 48 +++++++++------ vendor/modules.txt | 10 ++-- 22 files changed, 190 insertions(+), 109 deletions(-) create mode 100644 vendor/github.com/docker/docker/pkg/process/process.go create mode 100644 vendor/github.com/docker/docker/pkg/process/process_linux.go create mode 100644 vendor/github.com/docker/docker/pkg/process/process_nolinux.go diff --git a/vendor.mod b/vendor.mod index b75c083285..769f537525 100644 --- a/vendor.mod +++ b/vendor.mod @@ -8,8 +8,8 @@ go 1.23.0 replace ( // FIXME(thaJeztah): temporarily need to pin on commits, otherwise go modules won't resolve until these are tagged. - github.com/moby/moby/api => github.com/moby/moby/api v0.0.0-20250721205005-81caabae43aa - github.com/moby/moby/client => github.com/moby/moby/client v0.0.0-20250721205005-81caabae43aa + github.com/moby/moby/api => github.com/moby/moby/api v0.0.0-20250722205935-c55a16352354 + github.com/moby/moby/client => github.com/moby/moby/client v0.0.0-20250722205935-c55a16352354 ) require ( @@ -21,7 +21,7 @@ require ( github.com/distribution/reference v0.6.0 github.com/docker/cli-docs-tool v0.10.0 github.com/docker/distribution v2.8.3+incompatible - github.com/docker/docker v28.2.3-0.20250721205005-81caabae43aa+incompatible // master (v29.0-dev) + github.com/docker/docker v28.2.3-0.20250722205935-c55a16352354+incompatible // master (v29.0-dev) github.com/docker/docker-credential-helpers v0.9.3 github.com/docker/go-connections v0.5.0 github.com/docker/go-units v0.5.0 diff --git a/vendor.sum b/vendor.sum index e4c5827b6d..35f811b2c2 100644 --- a/vendor.sum +++ b/vendor.sum @@ -57,8 +57,8 @@ github.com/docker/cli-docs-tool v0.10.0/go.mod h1:5EM5zPnT2E7yCLERZmrDA234Vwn09f github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/distribution v2.8.3+incompatible h1:AtKxIZ36LoNK51+Z6RpzLpddBirtxJnzDrHLEKxTAYk= github.com/docker/distribution v2.8.3+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= -github.com/docker/docker v28.2.3-0.20250721205005-81caabae43aa+incompatible h1:vayZPTuhbi2AF+QOe5o39FVWcsCTvi2k03tI7R5MXhI= -github.com/docker/docker v28.2.3-0.20250721205005-81caabae43aa+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker v28.2.3-0.20250722205935-c55a16352354+incompatible h1:/US2sfszh6RjbwhG7saJBx2R7S8FfwUoHjsFyi+1bG4= +github.com/docker/docker v28.2.3-0.20250722205935-c55a16352354+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/docker-credential-helpers v0.9.3 h1:gAm/VtF9wgqJMoxzT3Gj5p4AqIjCBS4wrsOh9yRqcz8= github.com/docker/docker-credential-helpers v0.9.3/go.mod h1:x+4Gbw9aGmChi3qTLZj8Dfn0TD20M/fuWy0E5+WDeCo= github.com/docker/go v1.5.1-1.0.20160303222718-d30aec9fd63c h1:lzqkGL9b3znc+ZUgi7FlLnqjQhcXxkNM/quxIjBVMD0= @@ -172,10 +172,10 @@ github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3N github.com/moby/docker-image-spec v1.3.1/go.mod h1:eKmb5VW8vQEh/BAr2yvVNvuiJuY6UIocYsFu/DxxRpo= github.com/moby/go-archive v0.1.0 h1:Kk/5rdW/g+H8NHdJW2gsXyZ7UnzvJNOy6VKJqueWdcQ= github.com/moby/go-archive v0.1.0/go.mod h1:G9B+YoujNohJmrIYFBpSd54GTUB4lt9S+xVQvsJyFuo= -github.com/moby/moby/api v0.0.0-20250721205005-81caabae43aa h1:wJ4xyHGYRnVDcxr5otWHvM5lUbaRhILJdyD/mDiridY= -github.com/moby/moby/api v0.0.0-20250721205005-81caabae43aa/go.mod h1:VA4aMWurxqzKHCXKDSqoBx3hiJxnTStnqSG5zgc8XL0= -github.com/moby/moby/client v0.0.0-20250721205005-81caabae43aa h1:LnXBgDvKpL4NuMQWCffnZzGP3AjZhBbbLFCVF5JvGks= -github.com/moby/moby/client v0.0.0-20250721205005-81caabae43aa/go.mod h1:Ax3ccMnrUUuchkrGDgHpXDeoI0g3MCgZy0V0vDo0+qs= +github.com/moby/moby/api v0.0.0-20250722205935-c55a16352354 h1:8UG1BOTZZdvP/61oNDdltO1Yqnp9myrCNzcXvQypX8Y= +github.com/moby/moby/api v0.0.0-20250722205935-c55a16352354/go.mod h1:VA4aMWurxqzKHCXKDSqoBx3hiJxnTStnqSG5zgc8XL0= +github.com/moby/moby/client v0.0.0-20250722205935-c55a16352354 h1:1GTdy+QVgcP1MtaOlmHjpioCuEfZxMV0t/uyiG5e4EY= +github.com/moby/moby/client v0.0.0-20250722205935-c55a16352354/go.mod h1:Ax3ccMnrUUuchkrGDgHpXDeoI0g3MCgZy0V0vDo0+qs= github.com/moby/patternmatcher v0.6.0 h1:GmP9lR19aU5GqSSFko+5pRqHi+Ohk1O69aFiKkVGiPk= github.com/moby/patternmatcher v0.6.0/go.mod h1:hDPoyOpDY7OrrMDLaYoY3hf52gNCR/YOUYxkhApJIxc= github.com/moby/swarmkit/v2 v2.0.0 h1:jkWQKQaJ4ltA61/mC9UdPe1McLma55RUcacTO+pPweY= diff --git a/vendor/github.com/docker/docker/pkg/process/process.go b/vendor/github.com/docker/docker/pkg/process/process.go new file mode 100644 index 0000000000..73078765de --- /dev/null +++ b/vendor/github.com/docker/docker/pkg/process/process.go @@ -0,0 +1,29 @@ +package process + +import "fmt" + +// Alive returns true if process with a given pid is running. +// +// It only considers positive PIDs; 0 (all processes in the current process +// group), -1 (all processes with a PID larger than 1), and negative (-n, +// all processes in process group "n") values for pid are never considered +// to be alive. +func Alive(pid int) bool { + if pid < 1 { + return false + } + return alive(pid) +} + +// Kill force-stops a process. It only allows positive PIDs; 0 (all processes +// in the current process group), -1 (all processes with a PID larger than 1), +// and negative (-n, all processes in process group "n") values for pid producs +// an error. Refer to [KILL(2)] for details. +// +// [KILL(2)]: https://man7.org/linux/man-pages/man2/kill.2.html +func Kill(pid int) error { + if pid < 1 { + return fmt.Errorf("invalid PID (%d): only positive PIDs are allowed", pid) + } + return kill(pid) +} diff --git a/vendor/github.com/docker/docker/pkg/process/process_linux.go b/vendor/github.com/docker/docker/pkg/process/process_linux.go new file mode 100644 index 0000000000..b7ce46e675 --- /dev/null +++ b/vendor/github.com/docker/docker/pkg/process/process_linux.go @@ -0,0 +1,24 @@ +package process + +import ( + "bytes" + "fmt" + "os" +) + +func zombie(pid int) (bool, error) { + if pid < 1 { + return false, nil + } + data, err := os.ReadFile(fmt.Sprintf("/proc/%d/stat", pid)) + if err != nil { + if os.IsNotExist(err) { + return false, nil + } + return false, err + } + if cols := bytes.SplitN(data, []byte(" "), 4); len(cols) >= 3 && string(cols[2]) == "Z" { + return true, nil + } + return false, nil +} diff --git a/vendor/github.com/docker/docker/pkg/process/process_nolinux.go b/vendor/github.com/docker/docker/pkg/process/process_nolinux.go new file mode 100644 index 0000000000..7e58cb8eb3 --- /dev/null +++ b/vendor/github.com/docker/docker/pkg/process/process_nolinux.go @@ -0,0 +1,7 @@ +//go:build !linux + +package process + +func zombie(pid int) (bool, error) { + return false, nil +} diff --git a/vendor/github.com/docker/docker/pkg/process/process_unix.go b/vendor/github.com/docker/docker/pkg/process/process_unix.go index 13298bbdcc..c0d3ab2fa5 100644 --- a/vendor/github.com/docker/docker/pkg/process/process_unix.go +++ b/vendor/github.com/docker/docker/pkg/process/process_unix.go @@ -3,9 +3,7 @@ package process import ( - "bytes" "errors" - "fmt" "os" "path/filepath" "runtime" @@ -14,17 +12,10 @@ import ( "golang.org/x/sys/unix" ) -// Alive returns true if process with a given pid is running. It only considers -// positive PIDs; 0 (all processes in the current process group), -1 (all processes -// with a PID larger than 1), and negative (-n, all processes in process group -// "n") values for pid are never considered to be alive. -func Alive(pid int) bool { - if pid < 1 { - return false - } +func alive(pid int) bool { switch runtime.GOOS { case "darwin": - // OS X does not have a proc filesystem. Use kill -0 pid to judge if the + // macOS does not have a proc filesystem. Use kill -0 pid to judge if the // process exists. From KILL(2): https://www.freebsd.org/cgi/man.cgi?query=kill&sektion=2&manpath=OpenDarwin+7.2.1 // // Sig may be one of the signals specified in sigaction(2) or it may @@ -41,16 +32,7 @@ func Alive(pid int) bool { } } -// Kill force-stops a process. It only considers positive PIDs; 0 (all processes -// in the current process group), -1 (all processes with a PID larger than 1), -// and negative (-n, all processes in process group "n") values for pid are -// ignored. Refer to [KILL(2)] for details. -// -// [KILL(2)]: https://man7.org/linux/man-pages/man2/kill.2.html -func Kill(pid int) error { - if pid < 1 { - return fmt.Errorf("invalid PID (%d): only positive PIDs are allowed", pid) - } +func kill(pid int) error { err := unix.Kill(pid, unix.SIGKILL) if err != nil && !errors.Is(err, unix.ESRCH) { return err @@ -63,20 +45,9 @@ func Kill(pid int) error { // a PID larger than 1), and negative (-n, all processes in process group "n") // values for pid are ignored. Refer to [PROC(5)] for details. // +// Zombie is only implemented on Linux, and returns false on all other platforms. +// // [PROC(5)]: https://man7.org/linux/man-pages/man5/proc.5.html func Zombie(pid int) (bool, error) { - if pid < 1 { - return false, nil - } - data, err := os.ReadFile(fmt.Sprintf("/proc/%d/stat", pid)) - if err != nil { - if os.IsNotExist(err) { - return false, nil - } - return false, err - } - if cols := bytes.SplitN(data, []byte(" "), 4); len(cols) >= 3 && string(cols[2]) == "Z" { - return true, nil - } - return false, nil + return zombie(pid) } diff --git a/vendor/github.com/docker/docker/pkg/process/process_windows.go b/vendor/github.com/docker/docker/pkg/process/process_windows.go index 2dd57e8254..ba11f8199c 100644 --- a/vendor/github.com/docker/docker/pkg/process/process_windows.go +++ b/vendor/github.com/docker/docker/pkg/process/process_windows.go @@ -6,8 +6,7 @@ import ( "golang.org/x/sys/windows" ) -// Alive returns true if process with a given pid is running. -func Alive(pid int) bool { +func alive(pid int) bool { h, err := windows.OpenProcess(windows.PROCESS_QUERY_LIMITED_INFORMATION, false, uint32(pid)) if err != nil { return false @@ -32,8 +31,7 @@ func Alive(pid int) bool { return true } -// Kill force-stops a process. -func Kill(pid int) error { +func kill(pid int) error { p, err := os.FindProcess(pid) if err == nil { err = p.Kill() diff --git a/vendor/github.com/moby/moby/api/stdcopy/stdcopy.go b/vendor/github.com/moby/moby/api/stdcopy/stdcopy.go index 611432a626..489e50f2ea 100644 --- a/vendor/github.com/moby/moby/api/stdcopy/stdcopy.go +++ b/vendor/github.com/moby/moby/api/stdcopy/stdcopy.go @@ -39,10 +39,11 @@ type stdWriter struct { prefix byte } -// Write sends the buffer to the underneath writer. +// Write sends the buffer to the underlying writer. // It inserts the prefix header before the buffer, -// so stdcopy.StdCopy knows where to multiplex the output. -// It makes stdWriter to implement io.Writer. +// so [StdCopy] knows where to multiplex the output. +// +// It implements [io.Writer]. func (w *stdWriter) Write(p []byte) (int, error) { if w == nil || w.Writer == nil { return 0, errors.New("writer not instantiated") @@ -68,30 +69,40 @@ func (w *stdWriter) Write(p []byte) (int, error) { return n, err } -// NewStdWriter instantiates a new Writer. -// Everything written to it will be encapsulated using a custom format, -// and written to the underlying `w` stream. -// This allows multiple write streams (e.g. stdout and stderr) to be muxed into a single connection. -// `t` indicates the id of the stream to encapsulate. -// It can be stdcopy.Stdin, stdcopy.Stdout, stdcopy.Stderr. -func NewStdWriter(w io.Writer, t StdType) io.Writer { +// NewStdWriter instantiates a new writer using a custom format to multiplex +// multiple streams to a single writer. All messages written using this writer +// are encapsulated using a custom format, and written to the underlying +// stream "w". +// +// Writers created through NewStdWriter allow for multiple write streams +// (e.g. stdout ([Stdout]) and stderr ([Stderr]) to be multiplexed into a +// single connection. "streamType" indicates the type of stream to encapsulate, +// and can be [Stdin], [Stdout], pr [Stderr]. +func NewStdWriter(w io.Writer, streamType StdType) io.Writer { return &stdWriter{ Writer: w, - prefix: byte(t), + prefix: byte(streamType), } } -// StdCopy is a modified version of io.Copy. +// StdCopy is a modified version of [io.Copy] to de-multiplex messages +// from "multiplexedSource" and copy them to destination streams +// "destOut" and "destErr". // -// StdCopy will demultiplex `src`, assuming that it contains two streams, -// previously multiplexed together using a StdWriter instance. -// As it reads from `src`, StdCopy will write to `dstout` and `dsterr`. +// StdCopy demultiplexes "multiplexedSource", assuming that it contains +// two streams, previously multiplexed using a writer created with +// [NewStdWriter]. // -// StdCopy will read until it hits EOF on `src`. It will then return a nil error. -// In other words: if `err` is non nil, it indicates a real underlying error. +// As it reads from "multiplexedSource", StdCopy writes [Stdout] messages +// to "destOut", and [Stderr] message to "destErr]. // -// `written` will hold the total number of bytes written to `dstout` and `dsterr`. -func StdCopy(dstout, dsterr io.Writer, src io.Reader) (written int64, _ error) { +// StdCopy it reads until it hits [io.EOF] on "multiplexedSource", after +// which it returns a nil error. In other words: any error returned indicates +// a real underlying error. +// +// The "written" return holds the total number of bytes written to "destOut" +// and "destErr" combined. +func StdCopy(destOut, destErr io.Writer, multiplexedSource io.Reader) (written int64, _ error) { var ( buf = make([]byte, startingBufLen) bufLen = len(buf) @@ -105,7 +116,7 @@ func StdCopy(dstout, dsterr io.Writer, src io.Reader) (written int64, _ error) { // Make sure we have at least a full header for nr < stdWriterPrefixLen { var nr2 int - nr2, err = src.Read(buf[nr:]) + nr2, err = multiplexedSource.Read(buf[nr:]) nr += nr2 if errors.Is(err, io.EOF) { if nr < stdWriterPrefixLen { @@ -125,17 +136,17 @@ func StdCopy(dstout, dsterr io.Writer, src io.Reader) (written int64, _ error) { fallthrough case Stdout: // Write on stdout - out = dstout + out = destOut case Stderr: // Write on stderr - out = dsterr + out = destErr case Systemerr: // If we're on Systemerr, we won't write anywhere. // NB: if this code changes later, make sure you don't try to write // to outstream if Systemerr is the stream out = nil default: - return 0, fmt.Errorf("Unrecognized input header: %d", buf[stdWriterFdIndex]) + return 0, fmt.Errorf("unrecognized input header: %d", buf[stdWriterFdIndex]) } // Retrieve the size of the frame @@ -151,7 +162,7 @@ func StdCopy(dstout, dsterr io.Writer, src io.Reader) (written int64, _ error) { // While the amount of bytes read is less than the size of the frame + header, we keep reading for nr < frameSize+stdWriterPrefixLen { var nr2 int - nr2, err = src.Read(buf[nr:]) + nr2, err = multiplexedSource.Read(buf[nr:]) nr += nr2 if errors.Is(err, io.EOF) { if nr < frameSize+stdWriterPrefixLen { diff --git a/vendor/github.com/moby/moby/api/types/client.go b/vendor/github.com/moby/moby/api/types/client.go index 42fe03ecca..087dc6db78 100644 --- a/vendor/github.com/moby/moby/api/types/client.go +++ b/vendor/github.com/moby/moby/api/types/client.go @@ -73,7 +73,7 @@ type PluginInstallOptions struct { // authentication header value in base64 encoded format, or an error if the // privilege request fails. // - // For details, refer to [github.com/docker/docker/api/types/registry.RequestAuthConfig]. + // For details, refer to [github.com/moby/moby/api/types/registry.RequestAuthConfig]. PrivilegeFunc func(context.Context) (string, error) AcceptPermissionsFunc func(context.Context, PluginPrivileges) (bool, error) Args []string diff --git a/vendor/github.com/moby/moby/api/types/container/container.go b/vendor/github.com/moby/moby/api/types/container/container.go index 8e9d53d58e..ba735a9f1f 100644 --- a/vendor/github.com/moby/moby/api/types/container/container.go +++ b/vendor/github.com/moby/moby/api/types/container/container.go @@ -50,8 +50,7 @@ type StatsResponseReader struct { // MountPoint represents a mount point configuration inside the container. // This is used for reporting the mountpoints in use by a container. type MountPoint struct { - // Type is the type of mount, see `Type` definitions in - // github.com/docker/docker/api/types/mount.Type + // Type is the type of mount, see [mount.Type] definitions for details. Type mount.Type `json:",omitempty"` // Name is the name reference to the underlying data defined by `Source` @@ -128,6 +127,7 @@ type Summary struct { NetworkMode string `json:",omitempty"` Annotations map[string]string `json:",omitempty"` } + Health *HealthSummary `json:",omitempty"` NetworkSettings *NetworkSettingsSummary Mounts []MountPoint } diff --git a/vendor/github.com/moby/moby/api/types/container/health.go b/vendor/github.com/moby/moby/api/types/container/health.go index 96e91cc8d8..b7fe592cc2 100644 --- a/vendor/github.com/moby/moby/api/types/container/health.go +++ b/vendor/github.com/moby/moby/api/types/container/health.go @@ -26,6 +26,12 @@ type Health struct { Log []*HealthcheckResult // Log contains the last few results (oldest first) } +// HealthSummary stores a summary of the container's healthcheck results. +type HealthSummary struct { + Status HealthStatus // Status is one of [NoHealthcheck], [Starting], [Healthy] or [Unhealthy]. + FailingStreak int // FailingStreak is the number of consecutive failures +} + // HealthcheckResult stores information about a single run of a healthcheck probe type HealthcheckResult struct { Start time.Time // Start is the time this check started diff --git a/vendor/github.com/moby/moby/api/types/image/opts.go b/vendor/github.com/moby/moby/api/types/image/opts.go index fb397d492b..789037a59d 100644 --- a/vendor/github.com/moby/moby/api/types/image/opts.go +++ b/vendor/github.com/moby/moby/api/types/image/opts.go @@ -38,7 +38,7 @@ type PullOptions struct { // authentication header value in base64 encoded format, or an error if the // privilege request fails. // - // For details, refer to [github.com/docker/docker/api/types/registry.RequestAuthConfig]. + // For details, refer to [github.com/moby/moby/api/types/registry.RequestAuthConfig]. PrivilegeFunc func(context.Context) (string, error) Platform string } @@ -53,7 +53,7 @@ type PushOptions struct { // authentication header value in base64 encoded format, or an error if the // privilege request fails. // - // For details, refer to [github.com/docker/docker/api/types/registry.RequestAuthConfig]. + // For details, refer to [github.com/moby/moby/api/types/registry.RequestAuthConfig]. PrivilegeFunc func(context.Context) (string, error) // Platform is an optional field that selects a specific platform to push diff --git a/vendor/github.com/moby/moby/api/types/registry/registry.go b/vendor/github.com/moby/moby/api/types/registry/registry.go index bcbee4ec82..5924da377d 100644 --- a/vendor/github.com/moby/moby/api/types/registry/registry.go +++ b/vendor/github.com/moby/moby/api/types/registry/registry.go @@ -1,6 +1,3 @@ -// FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.23 - package registry import ( diff --git a/vendor/github.com/moby/moby/api/types/registry/search.go b/vendor/github.com/moby/moby/api/types/registry/search.go index 0bcb6abe29..17d77f2122 100644 --- a/vendor/github.com/moby/moby/api/types/registry/search.go +++ b/vendor/github.com/moby/moby/api/types/registry/search.go @@ -15,7 +15,7 @@ type SearchOptions struct { // authentication header value in base64 encoded format, or an error if the // privilege request fails. // - // For details, refer to [github.com/docker/docker/api/types/registry.RequestAuthConfig]. + // For details, refer to [github.com/moby/moby/api/types/registry.RequestAuthConfig]. PrivilegeFunc func(context.Context) (string, error) Filters filters.Args Limit int diff --git a/vendor/github.com/moby/moby/api/types/swarm/node.go b/vendor/github.com/moby/moby/api/types/swarm/node.go index f0638f13cb..3e503ef24b 100644 --- a/vendor/github.com/moby/moby/api/types/swarm/node.go +++ b/vendor/github.com/moby/moby/api/types/swarm/node.go @@ -133,7 +133,7 @@ const ( ) // Topology defines the CSI topology of this node. This type is a duplicate of -// github.com/docker/docker/api/types.Topology. Because the type definition +// [github.com/moby/moby/api/types/volume.Topology]. Because the type definition // is so simple and to avoid complicated structure or circular imports, we just // duplicate it here. See that type for full documentation type Topology struct { diff --git a/vendor/github.com/moby/moby/api/types/swarm/runtime/gen.go b/vendor/github.com/moby/moby/api/types/swarm/runtime/gen.go index 90e572cf9c..ccfac75c7b 100644 --- a/vendor/github.com/moby/moby/api/types/swarm/runtime/gen.go +++ b/vendor/github.com/moby/moby/api/types/swarm/runtime/gen.go @@ -1,3 +1,3 @@ -//go:generate protoc --gogofaster_out=import_path=github.com/docker/docker/api/types/swarm/runtime:. plugin.proto +//go:generate protoc --gogofaster_out=import_path=runtime:. plugin.proto package runtime diff --git a/vendor/github.com/moby/moby/client/container_exec.go b/vendor/github.com/moby/moby/client/container_exec.go index 9dd2da8c36..237d44dd28 100644 --- a/vendor/github.com/moby/moby/client/container_exec.go +++ b/vendor/github.com/moby/moby/client/container_exec.go @@ -46,6 +46,15 @@ func (cli *Client) ContainerExecCreate(ctx context.Context, containerID string, // ContainerExecStart starts an exec process already created in the docker host. func (cli *Client) ContainerExecStart(ctx context.Context, execID string, config container.ExecStartOptions) error { + // Make sure we negotiated (if the client is configured to do so), + // as code below contains API-version specific handling of options. + // + // Normally, version-negotiation (if enabled) would not happen until + // the API request is made. + if err := cli.checkVersion(ctx); err != nil { + return err + } + if versions.LessThan(cli.ClientVersion(), "1.42") { config.ConsoleSize = nil } diff --git a/vendor/github.com/moby/moby/client/container_list.go b/vendor/github.com/moby/moby/client/container_list.go index 98b8c85593..8eb9576fe6 100644 --- a/vendor/github.com/moby/moby/client/container_list.go +++ b/vendor/github.com/moby/moby/client/container_list.go @@ -35,6 +35,15 @@ func (cli *Client) ContainerList(ctx context.Context, options container.ListOpti } if options.Filters.Len() > 0 { + // Make sure we negotiated (if the client is configured to do so), + // as code below contains API-version specific handling of options. + // + // Normally, version-negotiation (if enabled) would not happen until + // the API request is made. + if err := cli.checkVersion(ctx); err != nil { + return nil, err + } + //nolint:staticcheck // ignore SA1019 for old code filterJSON, err := filters.ToParamWithVersion(cli.version, options.Filters) if err != nil { diff --git a/vendor/github.com/moby/moby/client/events.go b/vendor/github.com/moby/moby/client/events.go index cc23e71397..06480d1c5c 100644 --- a/vendor/github.com/moby/moby/client/events.go +++ b/vendor/github.com/moby/moby/client/events.go @@ -23,6 +23,16 @@ func (cli *Client) Events(ctx context.Context, options events.ListOptions) (<-ch go func() { defer close(errs) + // Make sure we negotiated (if the client is configured to do so), + // as code below contains API-version specific handling of options. + // + // Normally, version-negotiation (if enabled) would not happen until + // the API request is made. + if err := cli.checkVersion(ctx); err != nil { + close(started) + errs <- err + return + } query, err := buildEventsQueryParams(cli.version, options) if err != nil { close(started) diff --git a/vendor/github.com/moby/moby/client/hijack.go b/vendor/github.com/moby/moby/client/hijack.go index c983a8e856..a118e229b4 100644 --- a/vendor/github.com/moby/moby/client/hijack.go +++ b/vendor/github.com/moby/moby/client/hijack.go @@ -17,11 +17,11 @@ import ( // postHijacked sends a POST request and hijacks the connection. func (cli *Client) postHijacked(ctx context.Context, path string, query url.Values, body interface{}, headers map[string][]string) (types.HijackedResponse, error) { - bodyEncoded, err := encodeData(body) + jsonBody, err := jsonEncode(body) if err != nil { return types.HijackedResponse{}, err } - req, err := cli.buildRequest(ctx, http.MethodPost, cli.getAPIPath(ctx, path, query), bodyEncoded, headers) + req, err := cli.buildRequest(ctx, http.MethodPost, cli.getAPIPath(ctx, path, query), jsonBody, headers) if err != nil { return types.HijackedResponse{}, err } diff --git a/vendor/github.com/moby/moby/client/request.go b/vendor/github.com/moby/moby/client/request.go index 50c9c86c87..2853864ed2 100644 --- a/vendor/github.com/moby/moby/client/request.go +++ b/vendor/github.com/moby/moby/client/request.go @@ -27,25 +27,25 @@ func (cli *Client) get(ctx context.Context, path string, query url.Values, heade return cli.sendRequest(ctx, http.MethodGet, path, query, nil, headers) } -// post sends an http request to the docker API using the method POST with a specific Go context. -func (cli *Client) post(ctx context.Context, path string, query url.Values, obj interface{}, headers http.Header) (*http.Response, error) { - body, headers, err := encodeBody(obj, headers) +// post sends an http POST request to the API. +func (cli *Client) post(ctx context.Context, path string, query url.Values, body interface{}, headers http.Header) (*http.Response, error) { + jsonBody, headers, err := prepareJSONRequest(body, headers) if err != nil { return nil, err } - return cli.sendRequest(ctx, http.MethodPost, path, query, body, headers) + return cli.sendRequest(ctx, http.MethodPost, path, query, jsonBody, headers) } func (cli *Client) postRaw(ctx context.Context, path string, query url.Values, body io.Reader, headers http.Header) (*http.Response, error) { return cli.sendRequest(ctx, http.MethodPost, path, query, body, headers) } -func (cli *Client) put(ctx context.Context, path string, query url.Values, obj interface{}, headers http.Header) (*http.Response, error) { - body, headers, err := encodeBody(obj, headers) +func (cli *Client) put(ctx context.Context, path string, query url.Values, body interface{}, headers http.Header) (*http.Response, error) { + jsonBody, headers, err := prepareJSONRequest(body, headers) if err != nil { return nil, err } - return cli.putRaw(ctx, path, query, body, headers) + return cli.putRaw(ctx, path, query, jsonBody, headers) } // putRaw sends an http request to the docker API using the method PUT. @@ -64,26 +64,36 @@ func (cli *Client) delete(ctx context.Context, path string, query url.Values, he return cli.sendRequest(ctx, http.MethodDelete, path, query, nil, headers) } -func encodeBody(obj interface{}, headers http.Header) (io.Reader, http.Header, error) { - if obj == nil { +// prepareJSONRequest encodes the given body to JSON and returns it as an [io.Reader], and sets the Content-Type +// header. If body is nil, or a nil-interface, a "nil" body is returned without +// error. +// +// TODO(thaJeztah): should this return an error if a different Content-Type is already set? +// TODO(thaJeztah): is "nil" the appropriate approach for an empty body, or should we use [http.NoBody] (or similar)? +func prepareJSONRequest(body interface{}, headers http.Header) (io.Reader, http.Header, error) { + if body == nil { return nil, headers, nil } // encoding/json encodes a nil pointer as the JSON document `null`, // irrespective of whether the type implements json.Marshaler or encoding.TextMarshaler. // That is almost certainly not what the caller intended as the request body. - if reflect.TypeOf(obj).Kind() == reflect.Ptr && reflect.ValueOf(obj).IsNil() { + // + // TODO(thaJeztah): consider moving this to jsonEncode, which would also allow returning an (empty) reader instead of nil. + if reflect.TypeOf(body).Kind() == reflect.Ptr && reflect.ValueOf(body).IsNil() { return nil, headers, nil } - body, err := encodeData(obj) + jsonBody, err := jsonEncode(body) if err != nil { return nil, headers, err } - if headers == nil { - headers = make(map[string][]string) + hdr := http.Header{} + if headers != nil { + hdr = headers.Clone() } - headers["Content-Type"] = []string{"application/json"} - return body, headers, nil + + hdr.Set("Content-Type", "application/json") + return jsonBody, hdr, nil } func (cli *Client) buildRequest(ctx context.Context, method, path string, body io.Reader, headers http.Header) (*http.Request, error) { @@ -293,14 +303,14 @@ func (cli *Client) addHeaders(req *http.Request, headers http.Header) *http.Requ return req } -func encodeData(data interface{}) (*bytes.Buffer, error) { - params := bytes.NewBuffer(nil) +func jsonEncode(data interface{}) (io.Reader, error) { + var params bytes.Buffer if data != nil { - if err := json.NewEncoder(params).Encode(data); err != nil { + if err := json.NewEncoder(¶ms).Encode(data); err != nil { return nil, err } } - return params, nil + return ¶ms, nil } func ensureReaderClosed(response *http.Response) { diff --git a/vendor/modules.txt b/vendor/modules.txt index d75c082742..fcb29b6853 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -65,7 +65,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 v28.2.3-0.20250721205005-81caabae43aa+incompatible +# github.com/docker/docker v28.2.3-0.20250722205935-c55a16352354+incompatible ## explicit github.com/docker/docker/pkg/jsonmessage github.com/docker/docker/pkg/process @@ -175,7 +175,7 @@ github.com/moby/docker-image-spec/specs-go/v1 github.com/moby/go-archive github.com/moby/go-archive/compression github.com/moby/go-archive/tarheader -# github.com/moby/moby/api v0.0.0 => github.com/moby/moby/api v0.0.0-20250721205005-81caabae43aa +# github.com/moby/moby/api v0.0.0 => github.com/moby/moby/api v0.0.0-20250722205935-c55a16352354 ## explicit; go 1.23.0 github.com/moby/moby/api/stdcopy github.com/moby/moby/api/types @@ -199,7 +199,7 @@ github.com/moby/moby/api/types/system github.com/moby/moby/api/types/time github.com/moby/moby/api/types/versions github.com/moby/moby/api/types/volume -# github.com/moby/moby/client v0.0.0 => github.com/moby/moby/client v0.0.0-20250721205005-81caabae43aa +# github.com/moby/moby/client v0.0.0 => github.com/moby/moby/client v0.0.0-20250722205935-c55a16352354 ## explicit; go 1.23.0 github.com/moby/moby/client # github.com/moby/patternmatcher v0.6.0 @@ -572,5 +572,5 @@ gotest.tools/v3/skip # tags.cncf.io/container-device-interface v0.8.0 ## explicit; go 1.20 tags.cncf.io/container-device-interface/pkg/parser -# github.com/moby/moby/api => github.com/moby/moby/api v0.0.0-20250721205005-81caabae43aa -# github.com/moby/moby/client => github.com/moby/moby/client v0.0.0-20250721205005-81caabae43aa +# github.com/moby/moby/api => github.com/moby/moby/api v0.0.0-20250722205935-c55a16352354 +# github.com/moby/moby/client => github.com/moby/moby/client v0.0.0-20250722205935-c55a16352354