Commit Graph

2581 Commits

Author SHA1 Message Date
d9f7e4b0c8 cli/command/service: use enum-consts defined in API
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-05 13:41:04 +01:00
050aca80a5 Merge pull request #6627 from thaJeztah/local_parsegeneric_resource
cli/command/service: parse generic resources without protobufs
2025-11-05 12:45:12 +01:00
774f1d60a1 cli/command/service: parse generic resources without protobufs
This code was using swarmkit's genericresource package as intermediate;
add a local copy of that code that skips the protobufs as intermediate.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-05 12:26:02 +01:00
437ed4c1e4 Dockerfile: update golangci-lint to v2.6.1
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-05 12:24:12 +01:00
9fc247e0e5 Merge pull request #6626 from thaJeztah/fix_perfsprint
fix perfsprint (concat-loop) linting
2025-11-05 12:23:06 +01:00
f8d0365127 fix perfsprint (concat-loop) linting
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-05 09:27:52 +01:00
7b624841c4 update minimum go version to go1.24
Various dependencies, including "golang.org/x/.."  started to update
the minimum required version,so we should follow suit for the next
release.

Note that the `//go:build` directives not necesserily have to be
updated, but it's good to keep them in sync until we have a go.mod
to control this.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-05 08:24:06 +01:00
7414d73fc1 Merge pull request #6615 from thaJeztah/fix_generics
cli/command/container: fix use of generics
2025-11-04 07:26:44 -06:00
c01696ffde Merge pull request #6603 from thaJeztah/remove_trust_integration
remove support for client-side docker content trust validation
2025-11-04 14:05:39 +01:00
e0b1ab68fe cli/command/container: fix use of generics
This was introduced in dad1d367c8, which
did not add a `//go:build` constraint to enable the use of generics (`any`).

Which causes an error when used;

 could not import github.com/docker/cli/cli/command/container (-: # github.com/docker/cli/cli/command/container
 /Users/thajeztah/go/pkg/mod/github.com/docker/cli@v29.0.0-rc.2+incompatible/cli/command/container/stats.go:148:39: predeclared any requires go1.18 or later (-lang was set to go1.16; check go.mod)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-04 13:56:23 +01:00
e5f46499b3 image/tree: Fix table header having escape codes when not tty
When stdout is redirected to a non-tty there should be no ANSI escape
codes emitted.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-11-04 13:55:30 +01:00
d5d2ed5baa image/tree: Add test for checking ansi escape output
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-11-04 13:55:30 +01:00
1a261e3f50 image/tree: Use streams interface
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-11-04 13:55:30 +01:00
ad776d1e10 remove support for client-side docker content trust validation
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-03 14:21:19 +01:00
6fa5900339 image/tree: Remove longest->shortest sort
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-10-31 18:10:19 +01:00
5836040ec9 Update golden files
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-10-31 18:10:19 +01:00
f6feef8fe2 image/test: Fix go test args being used by CLI commands
By default cobra inherit the `os.Args` if there's no non-nil Args slice
set.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-10-31 18:10:19 +01:00
631f32ee9d images/list: Add print ambiguous warning for tree
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-10-31 18:10:19 +01:00
c41815f17a image/list: Show collapsed tree by default
Use the new tree view by default and only fallback if format or old
view-related options are used.

The expanded view is shown when `--tree` is passed.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-10-31 18:10:19 +01:00
7fb94dae5b Merge pull request #6599 from vvoland/update-docker
vendor: github.com/moby/moby master
2025-10-31 17:50:18 +01:00
f8e871344f Merge pull request #6596 from vvoland/img-list-all-dangling
image/tree: Fix dangling filter condition
2025-10-31 17:42:33 +01:00
8444c911bd vendor: github.com/moby/moby master
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-10-31 17:38:52 +01:00
96bc39b36d Merge pull request #6597 from thaJeztah/use_pull_for_pull
cli/command/container: use ImagePull instead of ImageCreate
2025-10-31 17:29:13 +01:00
7bdb4df07d cli/command/container: use ImagePull instead of ImageCreate
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-31 15:50:18 +01:00
9e7937746c image/tree: Fix dangling filter condition
The logic for applying the dangling filter when `--all` is not used was
inverted. The filter was being applied when the dangling filter was
present, but it should be applied when the dangling filter is NOT
present.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-10-31 14:58:02 +01:00
8e2943c6c5 image/tree: Sort image tree by name instead of creation date
Sort images alphabetically by their repository tags rather than by
creation date.

When an image has multiple tags, they are sorted internally and the
first tag is used as the representative for sorting the image in the
list. Untagged images are placed at the end.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-10-31 11:30:59 +01:00
8767904ae8 vendor: github.com/moby/moby/api master, moby/client master
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-31 03:25:19 +01:00
b8b4f54a89 fix typo in TODO comment
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-31 03:15:47 +01:00
3434869388 Merge pull request #6591 from vvoland/update-docker
vendor: github.com/moby/moby master
2025-10-30 00:32:57 +01:00
9dde80abd8 Merge pull request #6574 from vvoland/img-dangling
image/list: Hide untagged images without `--all`
2025-10-30 00:24:29 +01:00
e636a2a069 cli/container_rename: Move to API validation
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-10-30 00:20:47 +01:00
af255accaa vendor: github.com/moby/moby master
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-10-30 00:02:41 +01:00
053aa376ea vendor: github.com/moby/moby/api, moby/moby/client master
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-29 23:17:29 +01:00
83319f09f7 cli/command/container: use per-stats OSType if present
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-28 16:27:00 +01:00
6ed16a2cc1 vendor: github.com/moby/moby/api, moby/moby/client master
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-28 16:26:53 +01:00
5007c96b0d cli/command/container: collect(): split windows/unix branches
Use separate branches to handle windows/unix results to reduce intermediate
variables, and make it more transparent what's set for each platform.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-28 15:08:05 +01:00
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