Update module github.com/moby/moby/client to v0.6.1

Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
This commit is contained in:
renovate[bot] 2026-10-02 00:23:10 +00:00 • committed by GitHub
parent ccc1e20775
commit 7774a975a3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
57 changed files with 556 additions and 575 deletions

4
go.mod
View file

@ -40,8 +40,8 @@ require (
github.com/mattn/go-sqlite3 v1.14.52
github.com/mdlayher/vsock v1.3.0
github.com/moby/docker-image-spec v1.3.1
github.com/moby/moby/api v1.56.0
github.com/moby/moby/client v0.6.0
github.com/moby/moby/api v1.56.1
github.com/moby/moby/client v0.6.1
github.com/moby/sys/capability v0.4.0
github.com/moby/sys/user v0.4.1
github.com/moby/term v0.5.2

8
go.sum
View file

@ -251,10 +251,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.3.3 h1:OxxR9paxsluYi+zDUEXTTaIxtkK3viymW+Ka7vRhhME=
github.com/moby/go-archive v0.3.3/go.mod h1:Npdv43fFqlhZW7Xo8fbm3ZMYFvAGNviUPqX21VERbcE=
github.com/moby/moby/api v1.56.0 h1:GQzua3NA599ASSIICx0iFgiJeO9YkdDARvQsm23ZZuQ=
github.com/moby/moby/api v1.56.0/go.mod h1:sZ+THbVWkjOmBPPfbnzdD/G1LuIexWhqlSHHPTDQ1Uk=
github.com/moby/moby/client v0.6.0 h1:AJjEB21QPbXSXjDsZorFBoDZPhMrfbpaPLgSMAW9Bgs=
github.com/moby/moby/client v0.6.0/go.mod h1:OCo00wNRyA3m4lmJ228W3JbyCN4ZNNYjpOXiJydBdcQ=
github.com/moby/moby/api v1.56.1 h1:PpWkvVPB7Fr/No8w+TfyJ/I6rWZ2YPZhT3JorIg+06c=
github.com/moby/moby/api v1.56.1/go.mod h1:sZ+THbVWkjOmBPPfbnzdD/G1LuIexWhqlSHHPTDQ1Uk=
github.com/moby/moby/client v0.6.1 h1:gvfKmdcWw+9MzXYP0vAUKQtBTGu1L8475K2nsmL7O98=
github.com/moby/moby/client v0.6.1/go.mod h1:XHgTFqz9NCgS/VuoxXMmEDVmVgXQ4vFEc15wsCIwb24=
github.com/moby/patternmatcher v0.6.1 h1:qlhtafmr6kgMIJjKJMDmMWq7WLkKIo23hsrpR3x084U=
github.com/moby/patternmatcher v0.6.1/go.mod h1:hDPoyOpDY7OrrMDLaYoY3hf52gNCR/YOUYxkhApJIxc=
github.com/moby/sys/capability v0.4.0 h1:4D4mI6KlNtWMCM1Z/K0i7RV1FkX+DBDHKVJpCndZoHk=

View file

@ -3,7 +3,7 @@
ARG GO_VERSION=1.26.8
FROM golang:${GO_VERSION}-alpine AS base
RUN apk add --no-cache bash make yamllint
RUN apk add --no-cache bash libfyaml make yamllint
CMD ["/bin/bash"]
# go-swagger
@ -12,7 +12,7 @@ WORKDIR /go/src/github.com/go-swagger/go-swagger
# GO_SWAGGER_VERSION specifies the version of the go-swagger binary to install.
# Go-swagger is used in CI for generating types from swagger.yaml in
# api/scripts/generate-swagger-api.sh
ARG GO_SWAGGER_VERSION=v0.33.1
ARG GO_SWAGGER_VERSION=v0.36.6
ARG TARGETPLATFORM
RUN --mount=type=cache,target=/root/.cache/go-build,id=swagger-build-$TARGETPLATFORM \
--mount=type=cache,target=/go/pkg/mod \

File diff suppressed because it is too large Load diff

View file

@ -2,9 +2,6 @@
package build
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
// DiskUsage represents system data usage for build cache resources.
//
// swagger:model DiskUsage

View file

@ -2,9 +2,6 @@
package common
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
// ErrorResponse Represents an error.
// Example: {"message":"Something went wrong."}
//

View file

@ -2,9 +2,6 @@
package common
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
// IDResponse Response to an API call that returns just an Id
//
// swagger:model IDResponse

View file

@ -2,9 +2,6 @@
package container
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
// ChangeType Kind of change
//
// Can be one of:

View file

@ -2,9 +2,6 @@
package container
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
// CreateResponse ContainerCreateResponse
//
// # OK response to ContainerCreate operation

View file

@ -2,9 +2,6 @@
package container
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
// DiskUsage represents system data usage information for container resources.
//
// swagger:model DiskUsage

View file

@ -2,9 +2,6 @@
package container
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
// FilesystemChange Change in the container's filesystem.
//
// swagger:model FilesystemChange

View file

@ -2,9 +2,6 @@
package container
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/netip"
)

View file

@ -2,9 +2,6 @@
package container
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
// TopResponse ContainerTopResponse
//
// Container "top" response.

View file

@ -2,9 +2,6 @@
package container
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
// UpdateResponse ContainerUpdateResponse
//
// Response for a successful container-update.

View file

@ -2,9 +2,6 @@
package container
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
// WaitExitError container waiting error, if any
//
// swagger:model WaitExitError

View file

@ -2,9 +2,6 @@
package container
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
// WaitResponse ContainerWaitResponse
//
// # OK response to ContainerWait operation

View file

@ -2,9 +2,6 @@
package image
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
// DeleteResponse delete response
//
// swagger:model DeleteResponse

View file

@ -2,9 +2,6 @@
package image
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
// DiskUsage represents system data usage for image resources.
//
// swagger:model DiskUsage

View file

@ -2,9 +2,6 @@
package image
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
// HistoryResponseItem HistoryResponseItem
//
// individual image layer information in response to ImageHistory operation

View file

@ -2,9 +2,6 @@
package network
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
// ConfigReference The config-only network source to provide the configuration for
// this network.
//

View file

@ -2,9 +2,6 @@
package network
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
// ConnectRequest NetworkConnectRequest represents the data to be used to connect a container to a network.
//
// swagger:model ConnectRequest

View file

@ -2,9 +2,6 @@
package network
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
// CreateResponse NetworkCreateResponse
//
// # OK response to NetworkCreate operation

View file

@ -2,9 +2,6 @@
package network
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
// DisconnectRequest NetworkDisconnectRequest represents the data to be used to disconnect a container from a network.
//
// swagger:model DisconnectRequest

View file

@ -2,9 +2,6 @@
package network
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/netip"
)

View file

@ -2,9 +2,6 @@
package network
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
// Inspect The body of the "get network" http response message.
//
// swagger:model Inspect

View file

@ -2,9 +2,6 @@
package network
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
// IPAMStatus IPAM status
//
// swagger:model IPAMStatus

View file

@ -2,9 +2,6 @@
package network
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
timeext "time"
)

View file

@ -2,9 +2,6 @@
package network
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/netip"
)

View file

@ -2,9 +2,6 @@
package network
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/netip"
)

View file

@ -2,9 +2,6 @@
package network
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
// Status provides runtime information about the network such as the number of allocated IPs.
//
// swagger:model Status

View file

@ -2,9 +2,6 @@
package network
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
// SubnetStatus subnet status
//
// swagger:model SubnetStatus

View file

@ -2,9 +2,6 @@
package network
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
// Summary Network list response item
//
// swagger:model Summary

View file

@ -2,9 +2,6 @@
package network
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/netip"
)

View file

@ -2,9 +2,6 @@
package plugin
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
// Device device
//
// swagger:model Device

View file

@ -2,9 +2,6 @@
package plugin
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
// Env env
//
// swagger:model Env

View file

@ -2,9 +2,6 @@
package plugin
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
// Mount mount
//
// swagger:model Mount

View file

@ -2,9 +2,6 @@
package plugin
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
// Plugin A plugin for the Engine API
//
// swagger:model Plugin

View file

@ -2,9 +2,6 @@
package registry
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
// AuthResponse An identity token was generated successfully.
//
// swagger:model AuthResponse

View file

@ -2,9 +2,6 @@
package storage
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
// DriverData Information about the storage driver used to store the container's and
// image's filesystem.
//

View file

@ -2,9 +2,6 @@
package storage
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
// RootFSStorage Information about the storage used for the container's root filesystem.
//
// swagger:model RootFSStorage

View file

@ -2,9 +2,6 @@
package storage
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
// RootFSStorageSnapshot Information about a snapshot backend of the container's root filesystem.
//
// swagger:model RootFSStorageSnapshot

View file

@ -2,9 +2,6 @@
package storage
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
// Storage Information about the storage used by the container.
//
// swagger:model Storage

View file

@ -2,9 +2,6 @@
package swarm
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
// ServiceCreateResponse contains the information returned to a client on the
// creation of a new service.
//

View file

@ -2,9 +2,6 @@
package swarm
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
// ServiceUpdateResponse service update response
// Example: {"Warnings":["unable to pin image doesnotexist:latest to digest: image library/doesnotexist:latest not found"]}
//

View file

@ -2,9 +2,6 @@
package volume
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
// CreateRequest VolumeConfig
//
// # Volume configuration

View file

@ -2,9 +2,6 @@
package volume
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
// DiskUsage represents system data usage for volume resources.
//
// swagger:model DiskUsage

View file

@ -2,9 +2,6 @@
package volume
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
// ListResponse VolumeListResponse
//
// # Volume list response

View file

@ -2,9 +2,6 @@
package volume
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
// Volume volume
//
// swagger:model Volume

View file

@ -60,7 +60,6 @@ import (
"net/url"
"path"
"runtime"
"slices"
"strings"
"sync"
"sync/atomic"
@ -250,10 +249,11 @@ func New(ops ...Opt) (*Client, error) {
c.client.Transport = otelhttp.NewTransport(c.client.Transport, c.traceOpts...)
if len(cfg.responseHooks) > 0 {
c.client.Transport = &responseHookTransport{
base: c.client.Transport,
hooks: slices.Clone(cfg.responseHooks),
if len(cfg.requestHooks) > 0 || len(cfg.responseHooks) > 0 {
c.client.Transport = &hookTransport{
base: c.client.Transport,
reqHooks: cfg.requestHooks,
respHooks: cfg.responseHooks,
}
}

70
vendor/github.com/moby/moby/client/client_hook.go generated vendored Normal file
View file

@ -0,0 +1,70 @@
package client
import (
"errors"
"io"
"net/http"
)
type hookTransport struct {
base http.RoundTripper
reqHooks []RequestHook
respHooks []ResponseHook
}
func (t *hookTransport) RoundTrip(req *http.Request) (*http.Response, error) {
if len(t.reqHooks) > 0 {
hookReq := req.Clone(req.Context())
if hookReq.Body != nil {
hookReq.Body = hookBody{}
}
if hookReq.GetBody != nil {
hookReq.GetBody = func() (io.ReadCloser, error) {
return hookBody{}, nil
}
}
for _, h := range t.reqHooks {
if err := h(hookReq); err != nil {
// The base transport never takes ownership, so close the original
// request body before returning the hook error.
if req.Body != nil {
_ = req.Body.Close()
}
return nil, err
}
}
// Restore the actual request body after the hooks have run. The
// modified request metadata is preserved on hookReq.
hookReq.Body = req.Body
hookReq.GetBody = req.GetBody
req = hookReq
}
resp, err := t.base.RoundTrip(req)
if err != nil {
return resp, err
}
if len(t.respHooks) > 0 {
hookResp := *resp
if hookResp.Body != nil {
hookResp.Body = hookBody{}
}
for _, h := range t.respHooks {
h(&hookResp)
}
}
return resp, nil
}
type hookBody struct{}
func (hookBody) Read([]byte) (int, error) {
return 0, errors.New("hooks must not read HTTP message body")
}
func (hookBody) Close() error { return nil }

View file

@ -58,13 +58,23 @@ type clientConfig struct {
// takes precedence. Either field disables API-version negotiation.
envAPIVersion string
// responseHooks is a list of custom response hooks to call on responses.
// requestHooks contains hooks to call before requests are made.
requestHooks []RequestHook
// responseHooks contains hooks to call on responses.
responseHooks []ResponseHook
// traceOpts is a list of options to configure the tracing span.
traceOpts []otelhttp.Option
}
// RequestHook is called for each HTTP request made by the client.
// Hooks are invoked in the order they were added.
//
// Hooks may inspect the request and modify request metadata, such as headers,
// before the request is sent. The request body cannot be read or closed by
// the hook.
type RequestHook func(*http.Request) error
// ResponseHook is called for each HTTP response returned by the daemon.
// Hooks are invoked in the order they were added.
//
@ -411,12 +421,25 @@ func WithTraceOptions(opts ...otelhttp.Option) Opt {
}
}
// WithResponseHook adds a ResponseHook to the client. ResponseHooks are called
// WithHTTPRequestHook adds a [RequestHook] to the client. RequestHooks are called
// before an HTTP request is made to the daemon. Hooks are invoked in the order
// they were added.
func WithHTTPRequestHook(h RequestHook) Opt {
return func(c *clientConfig) error {
if h == nil {
return errors.New("invalid request hook: hook is nil")
}
c.requestHooks = append(c.requestHooks, h)
return nil
}
}
// WithHTTPResponseHook adds a [ResponseHook] to the client. ResponseHooks are called
// for each HTTP response returned by the daemon. Hooks are invoked in the order
// they were added.
//
// Hooks must not read or close resp.Body.
func WithResponseHook(h ResponseHook) Opt {
func WithHTTPResponseHook(h ResponseHook) Opt {
return func(c *clientConfig) error {
if h == nil {
return errors.New("invalid response hook: hook is nil")
@ -425,3 +448,12 @@ func WithResponseHook(h ResponseHook) Opt {
return nil
}
}
// WithResponseHook is equivalent to [WithHTTPResponseHook].
//
// Deprecated: use [WithHTTPResponseHook] instead.
//
//go:fix inline
func WithResponseHook(h ResponseHook) Opt {
return WithHTTPResponseHook(h)
}

View file

@ -1,23 +0,0 @@
package client
import (
"net/http"
)
type responseHookTransport struct {
base http.RoundTripper
hooks []ResponseHook
}
func (t *responseHookTransport) RoundTrip(req *http.Request) (*http.Response, error) {
resp, err := t.base.RoundTrip(req)
if err != nil {
return resp, err
}
for _, h := range t.hooks {
h(resp)
}
return resp, nil
}

View file

@ -75,9 +75,8 @@ func (cli *Client) ContainerAttach(ctx context.Context, containerID string, opti
query.Set("logs", "1")
}
hijacked, err := cli.postHijacked(ctx, "/containers/"+containerID+"/attach", query, nil, http.Header{
"Content-Type": {"text/plain"},
})
headers := http.Header{"Content-Type": {"text/plain"}}
hijacked, err := cli.postHijacked(ctx, "/containers/"+containerID+"/attach", query, headers, nil)
if err != nil {
return ContainerAttachResult{}, err
}

View file

@ -134,13 +134,11 @@ func (cli *Client) ExecAttach(ctx context.Context, execID string, options ExecAt
if err != nil {
return ExecAttachResult{}, err
}
req := container.ExecStartRequest{
headers := http.Header{"Content-Type": {"application/json"}}
response, err := cli.postHijacked(ctx, "/exec/"+execID+"/start", nil, headers, container.ExecStartRequest{
Detach: false,
Tty: options.TTY,
ConsoleSize: consoleSize,
}
response, err := cli.postHijacked(ctx, "/exec/"+execID+"/start", nil, req, http.Header{
"Content-Type": {"application/json"},
})
return ExecAttachResult{HijackedResponse: response}, err
}

View file

@ -13,7 +13,7 @@ import (
)
// postHijacked sends a POST request and hijacks the connection.
func (cli *Client) postHijacked(ctx context.Context, path string, query url.Values, body any, headers map[string][]string) (HijackedResponse, error) {
func (cli *Client) postHijacked(ctx context.Context, path string, query url.Values, headers map[string][]string, body any) (HijackedResponse, error) {
jsonBody, err := jsonEncode(body)
if err != nil {
return HijackedResponse{}, err
@ -22,7 +22,7 @@ func (cli *Client) postHijacked(ctx context.Context, path string, query url.Valu
if err != nil {
return HijackedResponse{}, err
}
conn, mediaType, err := setupHijackConn(cli.dialer(), req, "tcp")
conn, mediaType, err := cli.setupHijackConn(req, "tcp")
if err != nil {
return HijackedResponse{}, err
}
@ -38,16 +38,17 @@ func (cli *Client) DialHijack(ctx context.Context, url, proto string, meta map[s
}
req = cli.addHeaders(req, meta)
conn, _, err := setupHijackConn(cli.Dialer(), req, proto)
conn, _, err := cli.setupHijackConn(req, proto)
return conn, err
}
func setupHijackConn(dialer func(context.Context) (net.Conn, error), req *http.Request, proto string) (_ net.Conn, _ string, retErr error) {
func (cli *Client) setupHijackConn(req *http.Request, proto string) (_ net.Conn, _ string, retErr error) {
ctx := req.Context()
req.Header.Set("Connection", "Upgrade")
req.Header.Set("Upgrade", proto)
conn, err := dialer(ctx)
dial := cli.dialer()
conn, err := dial(ctx)
if err != nil {
return nil, "", fmt.Errorf("cannot connect to the Docker daemon. Is 'docker daemon' running on this host?: %w", err)
}
@ -69,8 +70,19 @@ func setupHijackConn(dialer func(context.Context) (net.Conn, error), req *http.R
hc := &hijackedConn{conn, bufio.NewReader(conn)}
cfg := &cli.clientConfig
var rt http.RoundTripper = otelhttp.NewTransport(hc, cli.traceOpts...)
if len(cfg.requestHooks) > 0 || len(cfg.responseHooks) > 0 {
rt = &hookTransport{
base: rt,
reqHooks: cfg.requestHooks,
respHooks: cfg.responseHooks,
}
}
// Server hijacks the connection, error 'connection closed' expected
resp, err := otelhttp.NewTransport(hc).RoundTrip(req)
resp, err := rt.RoundTrip(req)
if err != nil {
return nil, "", err
}

View file

@ -19,12 +19,10 @@ type PluginCreateResult struct {
// PluginCreate creates a plugin
func (cli *Client) PluginCreate(ctx context.Context, createContext io.Reader, createOptions PluginCreateOptions) (PluginCreateResult, error) {
headers := http.Header(make(map[string][]string))
headers.Set("Content-Type", "application/x-tar")
query := url.Values{}
query.Set("name", createOptions.RepoName)
headers := http.Header{"Content-Type": {"application/x-tar"}}
resp, err := cli.postRaw(ctx, "/plugins/create", query, headers, createContext)
defer ensureReaderClosed(resp)
return PluginCreateResult{}, err

4
vendor/modules.txt vendored
View file

@ -408,7 +408,7 @@ github.com/moby/go-archive
github.com/moby/go-archive/compression
github.com/moby/go-archive/internal/archiveoptions
github.com/moby/go-archive/tarheader
# github.com/moby/moby/api v1.56.0
# github.com/moby/moby/api v1.56.1
## explicit; go 1.24
github.com/moby/moby/api
github.com/moby/moby/api/pkg/stdcopy
@ -429,7 +429,7 @@ github.com/moby/moby/api/types/storage
github.com/moby/moby/api/types/swarm
github.com/moby/moby/api/types/system
github.com/moby/moby/api/types/volume
# github.com/moby/moby/client v0.6.0
# github.com/moby/moby/client v0.6.1
## explicit; go 1.24
github.com/moby/moby/client
github.com/moby/moby/client/internal