Commit Graph

2543 Commits

Author SHA1 Message Date
c467ebafd8 cli/command/container: calculateCPUPercentWindows minor cleanup
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-28 15:08:05 +01:00
689152a804 cli/command/container: calculateCPUPercentUnix: simplify
Pass the whole CPUStats struct instead of deconstructing it to separate
variables.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-28 15:07:58 +01:00
e01ce69ff9 cli/command/container: collect: handle context-cancellation
construct the decoder inside the go-routine, including closing the body,
and add handling for context-cancellation.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-28 13:29:43 +01:00
292001a451 cli/command/container: RunStats: early return for non-streaming
We should consider splitting this out to a separate function, but
start with just an early return before we hit the timer-loop.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-28 12:36:14 +01:00
0b1c7bc0f1 cli/command/container: RunStats: small tweaks on closeChan
Some suggestions from ChatGPT to prevent deadlocks.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-28 12:36:10 +01:00
d309027d58 cli/command/container: RunStats: gracefully handle io.EOF
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-28 12:08:55 +01:00
15b422b317 cli/command/container: RunStats: handle context-cancellation
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-28 12:08:54 +01:00
832fc66ca7 cli/command/container: RunStats: simplify stats loop
Use a single select for the ticker and the closeChan; use early returns.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-28 12:08:54 +01:00
dad1d367c8 cli/command/container: move debug logs to call-site
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-28 12:08:54 +01:00
e50c94f21a Merge pull request #6581 from thaJeztah/stats_ostype
cli/command/container: don't depend on result.OSType
2025-10-27 21:43:53 -05:00
93cd6793b3 Merge pull request #6580 from thaJeztah/no_json
cli/command/image: remove uses of JSON field
2025-10-27 21:42:29 -05:00
f594a7f09b cli/command/image: remove uses of JSON field
The JSON field was added in [moby@9fd2c0f], to address [moby#19177], which
reported an incompatibility with Classic (V1) Swarm, which produced a non-
standard response;

> Make docker load to output json when the response content type is json
> Swarm hijacks the response from docker load and returns JSON rather
> than plain text like the Engine does. This makes the API library to return
> information to figure that out.

A later change in [moby@96d7db6] added additional logic to make sure the
correct content-type was returned, depending on whether the `quiet` option
was set (which produced a non-JSON response). This caused inconsistency in
the API response, and [moby@2f27632] changed the endpoint to always produce
JSON (only skipping the "progress" output if `quiet` was set).

This means that the "load" endpoint ([`imageRouter.postImagesLoad`]) now
unconditionally returns JSON, making the `JSON` field fully redundant.

This patch removes the use of the JSON field, as it's redundant, and the way it handles
the content-type is incorrect because it would not handle correct, but different
formatted response-headers (`application/json; charset=utf-8`), which could
result in malformed output on the client.

[moby@9fd2c0f]: 9fd2c0feb0
[moby#19177]: https://github.com/moby/moby/issues/19177
[moby@96d7db6]: 96d7db665b
[moby@2f27632]: 2f27632cde
[`imageRouter.postImagesLoad`]: 7b9d2ef6e5/api/server/router/image/image_routes.go (L248-L255)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-27 21:37:36 +01:00
4b498addce cli/command/container: don't depend on result.OSType
This field is set for the request as a whole, so can be obtained
from the server-info instead. Docker v29 will provide per-stats
information.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-27 21:35:25 +01:00
715467c9d8 Merge pull request #6569 from jsternberg/otel-sdk-lock-version
telemetry: lock the semconv version of the otel sdk
2025-10-27 21:17:09 +01:00
4a608069a7 vendor: github.com/moby/moby/api, moby/moby/client master
Signed-off-by: Rob Murray <rob.murray@docker.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-27 20:26:27 +01:00
153f7f10c9 telemetry: lock the semconv version of the otel sdk
This change prevents changes to the otel version from affecting the otel
sdk version. This is done by copying the telemetry sdk implementation
locally and using our own choice for semconv from within that.

This prevents a schema conflict from happening since the otel version of
the sdk gets implicitly updated whenever the semconv changes while we
have to manually change ours. Now, we manually change both and they're
locked to each other.

Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-27 11:44:59 +01:00
4afbd6146b implement some ad-hoc mocks for responses
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-25 01:36:38 +02:00
056e314645 vendor: github.com/moby/moby/api, moby/moby/client master
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-25 00:48:49 +02:00
4f7c07cfc2 update local code for updated modules
Some tests had to be skipped as there's some issues to address, and
some of the result-types cannot be mocked / stubbed.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-24 10:28:54 +02:00
563f5fe335 vendor: github.com/moby/moby/api, moby/moby/client master
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-20 12:30:05 +02:00
5ba4c17d78 cli/command/container: Simplify with slices.Contains
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-10-14 14:47:59 +02:00
d252afa6b0 cli/command/container: add go1.23 build constraint for range-over-func
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-10-14 14:43:54 +02:00
24e95b8682 vendor: github.com/moby/moby/api v1.52.0-beta.2, moby/client v0.1.0-beta.2
full diff:

- https://github.com/moby/moby/compare/0769fe708773...api/v1.52.0-beta.2
- https://github.com/moby/moby/compare/0769fe708773...client/v0.1.0-beta.2

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-14 10:43:33 +02:00
0f2f9e9c41 cli/command/image/build: deprecate ResolveAndValidateContextPath util
This utility was used internally and will be removed in the next release.
Use `DetectContextType` to detect the context-type, and use `GetContextFromLocalDir`,
`GetContextFromLocalDir`, `GetContextFromGitURL`, or `GetContextFromURL`
instead.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-13 15:42:03 +02:00
6e1ff0bec1 cli/command/image/build: deprecate WriteTempDockerfile util
It was only used internal in the package.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-13 15:29:08 +02:00
c52fa073cd cli/command/image/build: deprecate DetectArchiveReader util
It was only used internal in the package.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-13 15:28:55 +02:00
f24bb4bc76 cli/command/image/build: deprecate DefaultDockerfileName const
It was only used internal in the package.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-13 15:20:32 +02:00
ecea0c01b3 Merge pull request #6557 from thaJeztah/bump_golangci_lint
Dockerfile: update golangci-lint to v2.5.0 (for go1.25)
2025-10-13 12:02:34 +02:00
5ad9fbdef7 Dockerfile: update golangci-lint to v2.5.0
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-13 10:16:14 +02:00
7abc65bc06 cli/command: remove deprecated ResolveDefaultContext
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-11 00:40:22 +02:00
01febbc3bb Merge pull request #6551 from thaJeztah/remove_legacy_api_versions
remove API-version compatibility for API < v1.44
2025-10-10 22:53:01 +02:00
59d228cd98 Merge pull request #6550 from thaJeztah/deprecate_builder_utils
cli/command/image/build: deprecate IsArchive utility
2025-10-10 22:46:27 +02:00
4c73cefc15 cli/command/container, image: remove addPlatformFlag utility
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-10 21:23:30 +02:00
b8f2b7c678 cli/command/service: remove AppendServiceStatus (API <v1.41)
This function was added in 7405ac5c2d as
a fallback for API < v1.41, which did not include the service status
in the response. Current API versions return this information, so there's
no need to fetch it manually.

It was not gated by API version for some tests (which didn't set API
version), but should not be needed for non-test situations.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-10 21:23:29 +02:00
f046bd371a cli/command/container: rm use of deprecated MacAddress field
This field is no longer in use since API v1.44.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-10 21:23:29 +02:00
d36f16e224 remove API-version compatibility for API < v1.44
Support for API versions < v1.44 was removed in the client in [moby@96b29f5]
and [moby@7652f38], so we can remove fallback-code from the CLI as well,
as it won't be able to use those versions.

[moby@96b29f5]: 96b29f5a1f
[moby@7652f38]: 7652f38c28

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-10 21:23:25 +02:00
f81816ef88 vendor: github.com/moby/moby/api, client 0769fe708773 (master)
full diff: 4ca8aedf92...0769fe7087

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-10 19:35:00 +02:00
9e646f6d92 cli/command/image: runBuild: inline vars and minor cleanups
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-10 17:25:04 +02:00
64be664e85 cli/command/image/build: deprecate IsArchive utility
It was only used internally.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-10 17:23:57 +02:00
2c539a6530 cli/command/image/build: fix linting, add sub-tests
- fix minor linting issues (unhandled errors)
- rename vars to prevent shadowing
- use sub-tests for tests that already prepared for it

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-10 17:21:57 +02:00
17d6a92954 opts: deprecate ValidateMACAddress
It was a wrapper around net.ParseMAC from stdlib, so users should
use that directly.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-09 13:46:33 +02:00
af34b8471a cli/command/network: TestNetworkCreateWithFlags: fix unhandled errs
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-09 12:29:56 +02:00
c8014ec509 cli/command/network: TestNetworkCreateErrors: use sub-tests
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-09 12:22:08 +02:00
413ee120de cli/command/container: TestParseWithExpose: use sub-tests
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-09 12:13:25 +02:00
7923f440ed cli/command/container: update todo comment
Provide some context to the TODO

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-09 11:51:07 +02:00
3754fe3c8a rename some vars to prevent shadowing imports
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-06 22:49:02 +02:00
30ec4c09b3 Merge pull request #6536 from thaJeztah/cleanups
cli/command/container: inline some variables
2025-10-06 13:21:31 -07:00
6222292566 cli/command/container: inline some variables
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-06 21:26:17 +02:00
c06c08531a cli/command/container: remove localhostDNSWarning
This warning is better handled by the daemon, where applicable, as
the client does not have all information available to determine
if using a localhost / loopback-address for the DNS is possible.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-06 21:23:50 +02:00
9dea52c193 Merge pull request #6527 from thaJeztah/no_WithInitializeClient
cli/command: don't use WithInitializeClient in test
2025-10-03 14:02:37 +00:00