1356 Commits
Author SHA1 Message Date
berce 7dcd61b4a8 client: end the otelhttp span after a successful hijack
setupHijackConn only closed the response body when the upgrade failed.
otelhttp ends its client span when the body is closed, so the span of
every successful ContainerAttach, ContainerExecAttach and DialHijack
call was never ended. A 101 response has no body, so closing it does not
touch the hijacked connection.

Signed-off-by: berce <75228263+bercedev@users.noreply.github.com>
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2026-10-29 11:29:10 +01:00
Sebastiaan van Stijn 87bcd0486d Merge pull request #53980 from thaJeztah/api_remove_rapid
api/types/plugin: replace rapid with standard Go fuzzing
2026-10-19 22:57:39 +02:00
Sebastiaan van Stijn d3c51c66da api/types/plugin: replace rapid with standard Go fuzzing
Replace the rapid-based property test for plugin capability IDs
with a table-driven test and Go's built-in fuzzing support.

Preserve the comparison against the historical JSON parser to
catch compatibility regressions, and add explicit test cases for
the supported serialization formats and invalid inputs.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-10-19 22:33:32 +02:00
CrazyMax f8773a7cd8 client: honor context cancellation when dialing TLS
Use tls.Dialer.DialContext so connection setup and the TLS handshake
honor the caller's cancellation and deadline. Preserve TLS verification
and leave established connections independent of the dial context.

Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-10-16 10:25:12 +02:00
Paweł Gronowski 6d8a30ebb3 Bump API to 1.57
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2026-10-15 23:17:44 +02:00
Paweł Gronowski 818bfebc9c Add replace rules
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2026-10-15 23:17:44 +02:00
Sebastiaan van Stijn fa7ce0b9e7 go.mod: use tagged version of api module
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-10-08 21:45:31 +02:00
Sebastiaan van Stijn 441e585792 client: use tagged version for api
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-10-08 21:42:38 +02:00
Paweł Gronowski 6c37deb6b4 Drop replace rules
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2026-10-08 20:13:28 +02:00
Sebastiaan van Stijn cd04685539 client: bump github.com/Azure/go-ansiterm 8c912ac31dd4
removes a transitive dependency

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-10-08 19:55:59 +02:00
Sebastiaan van Stijn a6812080d7 client: bump github.com/docker/go-connections v0.8.2
v0.8.2

- sockets: preserve configured TLS ALPN protocols
- ci: add dependabot to update actions
- ci: update runners to Ubuntu 26.04
- build(deps): bump actions/checkout from 6.0.2 to 7.0.1
- build(deps): bump actions/setup-go from 6.3.0 to 7.0.0
- build(deps): bump golangci/golangci-lint-action from 9.2.0 to 9.3.0

full diff: https://github.com/docker/go-connections/compare/v0.8.1...v0.8.2

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-10-08 19:55:57 +02:00
CrazyMax 0e31cc5900 go.mod: add back replace rules
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2026-10-08 16:20:18 +02:00
CrazyMax 7391fe39d3 client: honor cancellation during hijack handshakes
Close the dialed connection when the request context is canceled while
writing the upgrade request or waiting for the response. Stop the
cancellation callback before handing a successful connection to the caller,
and wait for an in-flight callback so a closed connection is never returned.

Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2026-10-08 15:51:15 +02:00
Paweł Gronowski 7842550efc vendor: github.com/moby/moby/api v1.56.1
full diff: https://github.com/moby/moby/compare/api/v1.56.0...api/v1.56.1

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2026-10-01 20:13:57 +02:00
Sebastiaan van Stijn b8a569e7f6 client: add WithHTTPRequestHook option
Add WithHTTPRequestHook to allow callers to inspect outgoing HTTP requests
and modify request metadata before they are sent to the daemon.

Request hooks receive a clone of the original request so that modifications
made by hooks do not mutate the request passed to the client's RoundTripper.
Changes made by hooks are preserved on the request passed to the underlying
transport.

Protect request bodies while hooks are running, preventing hooks from reading
or closing the body while restoring the original body before the request is
sent. Hooks are invoked in registration order and may return an error to abort
the request.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-10-01 17:31:54 +02:00
Sebastiaan van Stijn 7240768479 Merge pull request #53821 from thaJeztah/fix_response_hooks
client: fix response hooks for hijacked requests
2026-09-30 16:02:54 +02:00
Sebastiaan van Stijn 8f8d7382e8 client: remove redundant cloning of response hooks
Response hooks are stored in the client's configuration and are not
modified after the client is constructed.

Use the configured slice directly when constructing hookTransport
instead of creating an unnecessary copy.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-09-30 14:15:39 +02:00
Sebastiaan van Stijn 842e788e14 client: fix response hooks for hijacked requests
Response hooks added in 2bc7febeb6 ("client: Add HTTP response
hooks") are only installed on the client's HTTP transport.

Hijacked requests use a separate transport and therefore bypass the
configured response hooks.

Wrap the hijack transport with hookTransport so response hooks are
also invoked for the HTTP upgrade response, and add coverage for the
hijack path.

updates 2bc7febeb6

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-09-30 14:06:10 +02:00
Sebastiaan van Stijn 5d8f006176 Merge pull request #53720 from thaJeztah/lint_usetesting
golangci-lint: enable usetesting linter
2026-09-28 10:15:13 +02:00
Paweł Gronowski c269610eb1 Merge pull request #53708 from thaJeztah/client_bump_go_connections
client: update github.com/docker/go-connections v0.8.1
2026-09-21 19:25:47 +02:00
Sebastiaan van Stijn 679c6805a5 client: use t.Context
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-09-18 19:13:14 +02:00
Sebastiaan van Stijn b68bc6aa83 Merge pull request #53677 from thaJeztah/postraw_align
client: postRaw: use consistent order or arguments
2026-09-17 15:58:48 +02:00
Sebastiaan van Stijn f6ed31baea client: update github.com/docker/go-connections v0.8.1
We've been very conservative on updating dependencies, but it's probably
fine by now to update go-connections to the current version.

full diff: https://github.com/docker/go-connections/compare/v0.7.0...v0.8.1

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-09-17 15:16:25 +02:00
Sebastiaan van Stijn 38e7314f41 client: prevent response hooks from consuming response body
Response hooks are documented not to read or close the response body, but
currently receive the original response and can therefore consume or close
the body before it is returned to the caller.

Pass hooks a shallow copy of the response with an unreadable body whose Close
method is a no-op. This preserves access to response metadata while preventing
hooks from affecting the body returned to the caller.

Add coverage to verify that attempts to read the body fail and closing it from
a hook does not close the underlying response body.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-09-17 11:20:48 +02:00
Sebastiaan van Stijn a324b833ee client: rename responseHookTransport -> hookTransport
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-09-17 11:06:18 +02:00
Sebastiaan van Stijn e39122ef95 client: rename client_responsehook.go -> client_hook.go
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-09-17 11:06:15 +02:00
Sebastiaan van Stijn ad141dba95 client: postRaw: use consistent order or arguments
follow-up to b20c3db932, which updated other
request-methods that took a body, but didn't update this one.

updates b20c3db932

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-09-16 18:20:13 +02:00
Sebastiaan van Stijn 398ad31eca client: deprecate WithResponseHook in favor of WithHTTPResponseHook
Rename the option to be more explicit that these hooks are for HTTP responses.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-09-16 09:56:34 +02:00
Sebastiaan van Stijn 16c83ba42e go.mod: add back replace rules
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-09-16 09:41:34 +02:00
Paweł Gronowski e6fa16752d vendor: github.com/moby/moby/api v1.56.0
full diff: https://github.com/moby/moby/compare/b40d37ef51db...api/v1.56.0

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2026-09-03 22:45:23 +02:00
Paweł Gronowski e1d06bdc11 Drop replace rules
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2026-09-03 21:39:37 +02:00
Sebastiaan van Stijn 53a8d1483f client: use slice type for plugin privileges internally
Use []plugin.Privilege for internal plugin install and upgrade helpers instead
of the exported plugin.Privileges type.

The latter primarily exists to implement sort.Interface, which these callers
do not use. Keep plugin.Privileges at the public API boundary, where it remains
part of AcceptPermissionsFunc's signature.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-08-29 14:14:30 +02:00
Sebastiaan van Stijn b20c3db932 client: request: use consistent order or arguments
Make `body` the last argument, so that requests can be inlined on call-sites.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-08-29 14:14:26 +02:00
Sebastiaan van Stijn ff7bb20e6e client: add normalizeHostConfig utility
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-08-29 13:04:13 +02:00
Sebastiaan van Stijn cea99a099c client: simplify normalizeCapabilities
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-08-29 13:04:12 +02:00
Sebastiaan van Stijn 1e004b0cd6 client: add valueOrZero utility
This allows more easily constructing a struct.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-08-29 13:04:12 +02:00
Sebastiaan van Stijn 5f9299935a client/pkg/jsonmessage: add custom message printer
Add WithMessagePrinter to allow callers of DisplayStream and
DisplayMessages to customize presentation of non-auxiliary messages.

The custom printer replaces the default terminal-aware rendering, allowing
callers to handle progress output, terminal sizing, and message errors as
needed. Auxiliary messages continue to use WithAuxCallback.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-08-27 23:40:23 +02:00
Paweł Gronowski 29faac60e0 api: Bump to 1.56
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2026-08-20 17:02:53 +02:00
Paweł Gronowski 96a40f3081 Add replace rules
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2026-08-20 16:57:25 +02:00
Paweł Gronowski fca4445372 Drop replace rules
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2026-07-30 20:28:49 +02:00
Paweł Gronowski 99c1a9c778 daemon: Add configurable default container stop timeout
A container that defines no stop timeout of its own always got 10
seconds on Linux, or 30 on Windows, to shut down before being killed.
The value was a constant in the container package, so operators who
wanted a different grace period had to pass `--stop-timeout` on every
container.

Add a `default-stop-timeout` daemon flag and configuration file option
that supplies that fallback. Stopping a container, killing it, and
computing the daemon shutdown timeout take the value from the daemon
configuration when the container has no timeout of its own, so an
explicit per-container timeout still wins and the container
configuration itself stays untouched. The option can be reloaded, and
negative values are rejected.

mergo cannot tell an unset option from a zero value, so a configured
timeout of `0`, meaning "kill immediately", would be replaced by the
non-zero flag default while merging. Remember whether the
configuration file set the option, and restore its value after the
merge.

`ContainerConfig.StopTimeout` in the API documentation no longer
claims a fixed default of 10 seconds, because the fallback is now
whatever `default-stop-timeout` holds.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2026-07-27 14:15:55 +02:00
Sebastiaan van Stijn aab60119ef client/pkg/jsonmessage: Display: fix godoc link
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-07-14 13:15:53 +02:00
Sebastiaan van Stijn 24ca48a69e README: remove Go Report Card badge
The project was sunset;

> After more than a decade of serving the ecosystem, the time
> has come to sunset Go Report Card. Following the loss of our
> primary infrastructure sponsor, maintaining the web app is
> no longer sustainable.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-07-09 09:59:25 +02:00
Sebastiaan van Stijn dca026af94 client/internal/timestamp: fix perfsprint linting
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-07-06 15:36:20 +02:00
Sebastiaan van Stijn a9ac9f7a61 client/internal/mod: fix perfsprint linting
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-07-06 15:36:20 +02:00
Paweł Gronowski d99e1cf895 Merge pull request #53010 from thaJeztah/client_omit
client: ServiceInspect, ContainerCommit: omit optional query args if not set
2026-07-06 15:11:40 +02:00
Sebastiaan van Stijn 56c3516d93 client: ServiceCreate, ServiceUpdate: fix duplicate and 'unkown' platforms
Before this patch, the Task and Plugin placement would contain "unkown/unknown"
platforms and duplicates. Swarm currently only supports os/arch for placement
preferences, but images often provide variants that differ in Variant, OSVersion
and OSFeatures. These duplicates unlikely caused issues in practice, but made
the service spec more verbose;

    docker service inspect --format '{{json .Spec.TaskTemplate.Placement.Platforms}}' foo
    [
        {"Architecture":"amd64","OS":"linux"},
        {"Architecture":"unknown","OS":"unknown"},
        {"OS":"linux"},
        {"Architecture":"unknown","OS":"unknown"},
        {"OS":"linux"},
        {"Architecture":"unknown","OS":"unknown"},
        {"Architecture":"arm64","OS":"linux"},
        {"Architecture":"unknown","OS":"unknown"},
        {"Architecture":"386","OS":"linux"},
        {"Architecture":"unknown","OS":"unknown"},
        {"Architecture":"ppc64le","OS":"linux"},
        {"Architecture":"unknown","OS":"unknown"},
        {"Architecture":"riscv64","OS":"linux"},
        {"Architecture":"unknown","OS":"unknown"},
        {"Architecture":"s390x","OS":"linux"},
        {"Architecture":"unknown","OS":"unknown"}
    ]

Update the imageDigestAndPlatforms utility to filter out "unknown"
platforms and to remove duplicates.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-07-03 22:06:17 +02:00
Sebastiaan van Stijn dff7c6b9ba client: ContainerCommit: omit optional query args if not set
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-07-03 20:23:09 +02:00
Sebastiaan van Stijn df8b6680f2 client: ServiceInspect: omit insertDefaults if not set
The default is to not insert defaults, so we can skip if it's not
set; this also removes a fmt.Sprintf that wasn't needed.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-07-03 20:22:56 +02:00
Sebastiaan van Stijn 787e7a116a go.mod: add back replace rules
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-07-03 19:02:58 +02:00