Commit Graph

548 Commits

Author SHA1 Message Date
4759615835 image/tree: Allow image names to overflow instead of truncating
Users were experiencing poor UX when image names were truncated in the
table output.

Instead of cutting off long image names with ellipsis, the names now
wrap to the next line to ensure full visibility.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-11-24 22:12:37 +01:00
d84396d4eb image ls: allow custom format in cli config
Setting a custom format in the cli cofig should still be supported,
and not produce an error when specifying "--tree". Specifyihg both
"--tree" and "--format" still produces an error, but we could consider
allowing "json" format in a future update.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-20 16:20:33 +00:00
207bf52c27 image/tree: Only show untagged images when --all flag is used
In non-expanded view, untagged images should only be displayed when the
--all flag is explicitly provided by the user.

Previously, untagged images were accidentally always shown in the
non-expanded view regardless of the --all flag setting.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-11-13 20:23:42 +01:00
be9e6308f5 image/tree: Respect NO_COLOR env variable
Do not use the fancy colored output if NO_COLOR variable is set to 1
following the https://no-color.org/ convention.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-11-13 14:56:27 +01:00
88e324150b Merge pull request #6657 from vvoland/img-list-nonexpanded-untagged
image/tree: Fix untagged images in non-expanded view
2025-11-13 13:20:46 +01:00
ed281ddf52 image/list: Print legend only if limiting width
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-11-13 13:00:02 +01:00
aa5d00a3a4 image/tree: Don't limit name width if non tty
Previously when no terminal was attached the width was assumed to be 80.
This is too short for most image names which truncated the names when
output was redirect (for example to `grep`).

This disabled the name truncation if the terminal width can't be
determined.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-11-13 12:59:46 +01:00
b66b93130c image/tree: Fix untagged images in non-expanded view
In the expanded view there is a separate image entry per each tag.

Fix a bug which caused no entry to be added for untagged images.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-11-13 12:47:24 +01:00
5039eee77f vendor: github.com/moby/moby/api master, moby/client master
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-11-06 17:02:53 -06: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
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
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
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
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
9dde80abd8 Merge pull request #6574 from vvoland/img-dangling
image/list: Hide untagged images without `--all`
2025-10-30 00:24:29 +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
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
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
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
64805c2959 image/list: Respect dangling filter when not using --all
Otherwise `docker images --filter dangling=true` won't work without
`--all`.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-10-24 20:46:41 +02:00
e9a941001c image/list: Hide untagged images without --all
The `--tree` implementation already does this.

Make the behavior consistent for the legacy image list implementation.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-10-24 20:46:41 +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
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
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
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
a61ecaf3c7 Merge pull request #6516 from thaJeztah/authconfig_no_direct_cast
cli/command: explicitly map AuthConfig fields instead of a direct cast
2025-09-29 15:49:22 -07:00
9f02d9643d cli/command: explicitly map AuthConfig fields instead of a direct cast
Commit [cli@27b2797] forked the AuthConfig type from the API, and changed
existing code to do a direct cast / convert of the forked type to the API
type. This can cause issues if the API types diverges, such as the removal
of the Email field.

This patch explicitly maps each field to the corresponding API type, but
adds some TODOs, because various code-paths only included a subset of the
fields, which may be intentional for fields that were meant to be handled
on the daemon / registry-client only.

We should evaluate these conversions to make sure these fields should
be sent from the client or not (and possibly even removed from the API
type).

[cli@27b2797]: 27b2797f7d

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-29 12:57:52 +02:00