Commit Graph

956 Commits

Author SHA1 Message Date
Sebastiaan van Stijn
0030ba21e3 client: ContainerCreate: remove handling of legacy MacAddress
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-21 08:33:42 +02:00
Paweł Gronowski
abf5679049 client/inspect: Better Raw handling
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-10-20 22:29:36 +02:00
Paweł Gronowski
ee22a50b75 client/config: Use Config instead of Spec as field
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-10-20 22:29:36 +02:00
Paweł Gronowski
f4b06e66e1 client/config: Wrap results and options
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-10-20 22:29:36 +02:00
Austin Vazquez
42ba5466c7 api: rename volumes.CreateOptions to volumes.CreateRequest
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-20 13:23:41 -05:00
Austin Vazquez
a2fd724453 client: wrap volume create api options with client options
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-20 12:55:52 -05:00
Sebastiaan van Stijn
2ba58d3c7f Merge pull request #51208 from thaJeztah/volume_prune_all
client: VolumePruneOptions: add "All" option
2025-10-20 19:04:36 +02:00
Austin Vazquez
d4e6d4f697 client/volume: refactor volume options and responses
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-20 09:05:55 -05:00
Sebastiaan van Stijn
6da63a3ed5 client: VolumePruneOptions: add "All" option
Abstract away that the "all" option is currently implemented as
a filter (which may change in future).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-17 17:40:01 +02:00
Sebastiaan van Stijn
5856ec5348 Merge pull request #51207 from thaJeztah/plugin_structs
client: Client.PluginList: add options-struct
2025-10-17 09:42:01 +02:00
Sebastiaan van Stijn
5fa3c65682 client: Client.PluginList: add options-struct
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-17 00:59:52 +02:00
Austin Vazquez
aa36c44ef9 api/types/volume: move UpdateOptions to client.VolumeUpdateOptions
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-16 16:07:28 -05:00
Sebastiaan van Stijn
865cfe9a7f client: VolumesPrune: rewrite to use option structs and result
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-16 12:29:21 +02:00
Sebastiaan van Stijn
b11d9d410f client: NetworksPrune: rewrite to use option structs and result
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-16 12:29:15 +02:00
Sebastiaan van Stijn
0672a0f999 client: ImagesPrune: rewrite to use option structs and result
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-16 12:28:10 +02:00
Sebastiaan van Stijn
91323b7a35 client: ContainersPrune: rewrite to use option structs and result
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-16 12:26:49 +02:00
Sebastiaan van Stijn
36f1c830bb add back replace rules and re-vendor
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-14 14:14:03 +02:00
Paweł Gronowski
01a19e9d95 vendor: github.com/moby/moby/api v1.52.0-beta.2
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-10-13 22:29:06 +02:00
Sebastiaan van Stijn
15289ad2dc client: Filters: add Clone method
This method returns a deep-copy of the filter, which can be used
in situations where the original filter must not be mutated, but
additional filters need to be added for a specific request.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-10 13:24:40 +02:00
Sebastiaan van Stijn
cfefa339c2 Merge pull request #51160 from thaJeztah/oncevalue
client: ImagePullResponse: use sync.OnceValue
2025-10-10 11:55:46 +02:00
Sebastiaan van Stijn
cfdb9068f0 client: ImagePullResponse: use sync.OnceValue
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-10 10:32:38 +02:00
Sebastiaan van Stijn
3c44bd67b2 client: ImagePullResponse: don't panic without reader
When stubbing a client for tests, and there's no reader set, we
just return an io.EOF, instead of panic.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-10 10:27:29 +02:00
Sebastiaan van Stijn
a3a605818d Merge pull request #51120 from thaJeztah/raise_fallback_api_step2
client: remove API-version compatibility for API < v1.44
2025-10-09 19:09:27 +02:00
Rob Murray
802142d4cf Merge pull request #50935 from ndeloof/decode-JSONMessage
introduce ImagePullResponse with helper method to manage JSONMessage stream decoding
2025-10-09 16:25:31 +01:00
Nicolas De Loof
e6bac8983b introduce ImagePullResponse to manage JSONMessage stream decoding
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2025-10-09 15:36:22 +02:00
Sebastiaan van Stijn
7652f38c28 client: remove API-version compatibility for API < v1.44
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-08 23:43:59 +02:00
Sebastiaan van Stijn
6bbb92df70 Merge pull request #51115 from corhere/api-filter-type
client: add new `Filters` type to replace `api/types/filters` package
2025-10-08 23:30:20 +02:00
Cory Snider
7ea066c8d1 client: add Filters type
Add a new type to use for building filter predicates for API requests,
replacing "./api/types/filters".Args in the client. Remove the now
unused api/types/filters package.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-10-08 12:06:31 -04:00
Sebastiaan van Stijn
96b29f5a1f client: remove support for negotiating API version < v1.44 (docker 25.0)
Docker versions below 25.0 have reached EOL; 25.0 is currently maintained
as an LTS version by Mirantis, and we want to allow current versions of the
CLI to be able to connect to such setups.

This patch raises the fallback API version to API v1.44; when negotiating an API
version with a daemon, this will be the lowest version negotiated.

Currently, it still allows manually overriding the version to versions that
are not supported (`WithVersion`, `WithVersionFromEnv`), and no code has
been removed yet that adjusts the client for old API versions, but this
can be done in a follow-up.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-08 13:57:28 +02:00
Sebastiaan van Stijn
9169ed2873 client: touch-up some godoc
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-08 13:44:39 +02:00
Sebastiaan van Stijn
04318e0d86 client: update some tests using obsolete API versions
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-08 13:44:39 +02:00
Austin Vazquez
42299d751a Merge pull request #51071 from thaJeztah/client_legacy_api_tests
client: reduce uses of obsolete API versions in tests
2025-10-03 17:00:37 -07:00
Sebastiaan van Stijn
4763719552 Merge pull request #51073 from thaJeztah/server_side_autorm
daemon, client: remove version-gate for daemon-side AutoRemove
2025-10-04 00:01:00 +02:00
Nicolas De Loof
df506c107e negociate content-type used by /events API
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2025-10-03 20:27:42 +02:00
Paweł Gronowski
c46704a80f client/build_prune: Wrap result in a struct
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-10-01 14:14:57 +02:00
Paweł Gronowski
a35b3cd149 client/build_cancel: Add options struct
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-10-01 12:57:46 +02:00
Sebastiaan van Stijn
9a32a7e0d1 daemon, client: remove version-gate for daemon-side AutoRemove
Support for daemon-side auto-remove was added in API v1.25; on older
versions of the daemon, the client was responsible for removing the
container after it exited (see [moby@6dd8e10])

On API versions < 1.30, it used the events API for this purpose, and
would wait for a "die", "detach" or "detroy" events to know the container
exited, and could be removed or (when attached, but without a TTY) to
get the container's exit-status. (see [cli@38591f2]).

API version 1.24 (docker 1.12) is 9 Years old (July 29, 2016), and API
1.30 (docker 17.06) is 8 Years old (Jun 20, 2017), and long EOL. While
technically, a CLI could negotiate API 1.30 or older, this would only
be in cases where either API version negotiation failed, or the version
was explicitly overridden through `DOCKER_API_VERSION` for testing.

This patch removes the version-gate for daemon-side AutoRemove; version-
specific handling is removed from the client (and a related patch in
the CLI).

[moby@6dd8e10]: 6dd8e10d6e
[cli@38591f2]: 38591f20d0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-30 18:31:22 +02:00
Sebastiaan van Stijn
af5988238a client: reduce uses of obsolete API versions in tests
TestGetAPIPath: don't use obsolete API versions in test

This test was using API v1.22 as "old" version to verify the given
version overrode the default. Update it to use a previous API version
that's still supported by the client.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-30 14:39:48 +02:00
Sebastiaan van Stijn
3241d46525 client: Client.doRequest: adjust error matching for TLS1.3 handshake
Go 1.25 /  TLS 1.3 may produce a generic "handshake failure" whereas
TLS 1.2 may produce a "bad certificate" TLS alert.
See https://github.com/golang/go/issues/56371

> https://tip.golang.org/doc/go1.12#tls_1_3
>
> In TLS 1.3 the client is the last one to speak in the handshake, so if
> it causes an error to occur on the server, it will be returned on the
> client by the first Read, not by Handshake. For example, that will be
> the case if the server rejects the client certificate.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-29 10:31:43 +02:00
Paweł Gronowski
b48fcf6cdb client/checkpoint_list: Wrap result in a struct
The CheckpointList method previously returned a raw slice of
checkpoint.Summary, which made it difficult to extend the API response
with additional metadata or fields in the future without breaking
backward compatibility.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-09-26 17:03:07 +02:00
Sebastiaan van Stijn
b2320da428 Merge pull request #51019 from thaJeztah/client_commit_no_pause
client: ContainerCommitOptions: change "Pause" to "NoPause"
2025-09-23 12:50:50 +02:00
Sebastiaan van Stijn
bad3dfe9cb client: ContainerCommitOptions: change "Pause" to "NoPause"
Commit [moby@17d870b] (API v1.13, docker v1.1.0) changed the default to pause
containers during commit, keeping the behavior opt-in for older API versions.
This version-gate was removed in [moby@1b1147e] because API versions lower
than v1.23 were no longer supported.

However, the client still required opting-in to pausing containers, which
is handled by setting the `Pause` field to true by default. This patch changes
the client option to reflect the default; after this change, we should also
consider changing the API make disabling pause a more explicit option, and
to change the "pause" argument to a "no-pause".

[moby@17d870b]: 17d870bed5
[moby@1b1147e]: 1b1147e46b

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-22 13:59:02 +02:00
Sebastiaan van Stijn
f5847040cc client: Client.negotiateAPIVersionPing: trim v-prefix before handling
Trim any v-prefix passed to this function to make sure we detect empty
API versions.

In most cases, the ping-response will originate from the API server, but
the exported `Client.NegotiateAPIVersionPing` allows a ping-response to
be passed manually.

While updating, also update the signature to only accept the version, as
only the `PingResponse.APIVersion` is used by this function.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-22 11:31:16 +02:00
Sebastiaan van Stijn
af3f971431 client: TestNegotiateAPIVersionAutomatic: gofumpt
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-22 11:30:52 +02:00
Sebastiaan van Stijn
a8cb35f01a client: TestPingHeadFallback: check method, path, and fix example response
Validate that the client is connecting with the expected endpoint path and
method(s). Also fix the Api-Version response to align with the actual format
returned, which doesn't include a "v" prefix;

    curl -sI --unix-socket /var/run/docker.sock 'http://localhost/_ping' | grep 'Api-Version'
    Api-Version: 1.51

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-22 11:30:52 +02:00
Sebastiaan van Stijn
d9cdfd2887 client: remove unused Client.HTTPClient() method
This method was introduced in [moby@5a84124] related to the (now removed)
support for "compose on kubernetes" in the CLI. This functionality extended
the CLI with endpoints that are not part of the engine API, but re-using
the HTTP-client with the same (TLS) config as the CLI itself.

While such scenarios may be something to consider in future (i.e. more easily
extend the API with custom endpoints), this method is not currently used,
but defined as part of the CLI's interface. This patch removes the method
for now, so that we can design from a clean slate in case we need this
extensibility, instead of keeping methods that were added ad-hoc around.

[moby@5a84124]: 5a84124739

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-19 17:07:39 +02:00
Sebastiaan van Stijn
0967d6ea6b Merge pull request #51005 from thaJeztah/cleanup_version_gates
client: fix some version-related handling
2025-09-19 11:57:48 +02:00
Sebastiaan van Stijn
41a6ad5def client: remove deprecated ImageListOptions.ContainerCount
This field was deprecated in [moby@cfcbfab] when this struct still lived
in the API. The field is no longer used, and we don't have to carry it
forward as part of the new client module.

[moby@cfcbfab]: cfcbfabb0f

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-18 22:56:24 +02:00
Sebastiaan van Stijn
f7ed1b84d2 client: ImageList: don't discard reference filter on API < 1.25
the "reference" filter was introduced in [moby@820b809] (docker 1.13.0-rc1)
to replace the "filter" query argument. That commit initially included a
version-gate anticipating the API version to be used for v17.12, but as
this was yet unknown, the version-gate was removed in [moby@0f9d22c].
A later PR re-introduced a version-gate in [moby@4a19009], reflecting the
API version in which the deprecation was (finally) completed.

For the client, [moby@c6e3145] added a fallback was added for older daemons
(docker 1.12.0 and older, using API < v1.25) that did not support the new
filter.

Looking at the above, any version of docker 1.13.0 or above handles the
"reference" filter, but (depending on the docker version) may also handle
the old filter on API < 1.28 or API < 1.41. Removing this option will only
impact daemon versions older than 1.13.0, which are long obsolete.

Given that current clients forcibly remove the "reference" filter and replace
it with the old "filter" when using API v1.24, we keep support on the daemon
side, but update the version to v1.24, and only if no reference filter is
set.

[moby@820b809]: 820b809e70
[moby@c6e3145]: c6e31454ba
[moby@0f9d22c]: 0f9d22cd66
[moby@4a19009]: 4a1900915a

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-18 18:15:42 +02:00
Sebastiaan van Stijn
d60b4ea278 client: fix version-gate for readonly-recursive mounts validation on service
commit [moby@5d6b566] migrated this validation from the CLI to the client,
but for some reason picked the wrong API version inside ServiceCreate.

The CLI code was added to an existing validation, which only handled
validation when creating a service, but not when updating, which meant
that adding this option to an existing service would not invalidate it.

This patch:

- moves the version-gate to the validation code
- merges validateServiceSpecForAPIVersion into validateServiceSpec, to
  keep the validation combined, and to make sure validation happens both
  on create and update.

[moby@5d6b566]: 5d6b56699d

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-18 18:02:34 +02:00