220 Commits

Author SHA1 Message Date
Sebastiaan van Stijn
d85c1a258a daemon/server/httputils: remove badParameterError
The "param" field was only used to generate the error-message, and the
produced error-message was missing a space so we may as well just inline it.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-01-05 13:51:59 +01:00
Nicolas De Loof
aef5d996ce use mime-type application/jsonl to align with openapi 3.2
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-12-17 11:37:48 +01:00
Paweł Gronowski
1489cb3ae0 Merge pull request #51722 from vvoland/modernize
Modernize Go code
2025-12-16 12:38:36 +00:00
Paweł Gronowski
5d716f20a3 Merge pull request #51721 from vvoland/deprecate-grpc
api: deprecate /grpc and /session endpoints
2025-12-16 12:34:55 +00:00
Rob Murray
1e209e788b Continue to backfill empty PortBindings in API 1.53
- introduced by commit 0ca7ac3 ("daemon: backfill empty PBs
  slices for backward compat")

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-12-16 11:03:58 +00:00
Paweł Gronowski
cdce8f4f92 modernize: Use maps.Copy instead of for loops
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-12-15 18:56:33 +01:00
Paweł Gronowski
f44b5abf0e api: deprecate /grpc and /session endpoints
The /grpc and /session endpoints are now deprecated as the Engine has
been upgraded to properly support HTTP/2 and h2c requests, making these
specialized endpoints unnecessary.

These endpoints will be removed in the next major API version to
complete the cleanup.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-12-15 18:44:22 +01:00
Rob Murray
7c7a626e5d NRI: include in API Info response
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-12-15 10:36:05 +00:00
Sebastiaan van Stijn
0af2962fdd daemon: reduce use of pointer-slices in backend
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-13 20:52:15 +01:00
Paweł Gronowski
f57da07056 Merge pull request #51454 from thaJeztah/api_volumes_no_pointer
api/types/volume: change ListResponse.Volumes to a non-pointer slice
2025-11-10 16:20:16 +01:00
Rob Murray
69c4524355 Merge pull request #51437 from thaJeztah/diskusage_move_legacy
api: remove / internalize LegacyDiskUsage
2025-11-10 15:03:37 +00:00
Sebastiaan van Stijn
18000fe371 api/types/volume: change ListResponse.Volumes to a non-pointer slice
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-10 13:13:22 +01:00
Albin Kerouanton
d087d3c057 daemon: close EventsService on shutdown
On daemon shutdown, the HTTP server tries to gracefully shutdown for 5
seconds. If there's an open API connection to the '/events' endpoint, it
fails to do so as nothing interrupts that connection, thus forcing the
daemon to wait until that timeout is reached.

Add a Close method to the EventsService, and call it during daemon
shutdown. It'll close any events channel, signaling to the '/events'
handler to return and close the connection.

It now takes ~1s (or less) to shutdown the daemon when there's an active
'/events' connection, instead of 5.

Signed-off-by: Albin Kerouanton <albin.kerouanton@docker.com>
2025-11-09 22:38:59 +01:00
Sebastiaan van Stijn
ed428234bd api: remove / internalize LegacyDiskUsage
These fields have been removed from the API specification, and the struct
was only needed to produce legacy responses (server), or to unmarshal
legacy responses in the client.

As the API module only provides API definitions for the current API version,
we should remove these legacy structs, and keep them internal to the daemon
and client.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-07 20:16:03 +01:00
Sebastiaan van Stijn
71bcd22d6d daemon/server/router/system: simplify constructing response
Now that we separated the legacy response from non-legacy responses,
we can consume the data produced by the backend as-is; the backend
takes care of omitting "verbose" data (leaving the `Items` slices
empty), and with an early return for the legacy responses, we won't
end up with returning _both_ responses on API < v1.52, but (TBD) still
return both responses for API v1.52.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-07 19:57:40 +01:00
Sebastiaan van Stijn
f5e319c950 daemon/server/router/system: use early return for disk-usage
Use early return for legacy response. When using API < v1.52, we'd
never return the new fields, so we can return early, and produce the
legacy-fields only.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-07 19:57:39 +01:00
Sebastiaan van Stijn
0dcb1fe344 daemon: align build.DiskUsage() with other disk-usages
Move calculation of the data to the builder backend, to align with
the other type of objects. This also allows us to skip the verbose
data if it's not used.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-07 19:57:30 +01:00
Sebastiaan van Stijn
f1a3387633 daemon/server/backend: align DiskUsage types with api
Make the "per-object" types aliases for the API type, and remove
the BuildCacheDiskUsage type, as it's not currently used.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-07 19:57:13 +01:00
Sebastiaan van Stijn
04de584531 daemon/server/router/system: use shorter names and comments
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-07 19:56:55 +01:00
Sebastiaan van Stijn
32319028e5 daemon/server/router/system: slightly rewrite logic for legacy
Rewrite the logic to have a better separation between producing legacy
fields, and verbose. We need to preserve / include all items in the
response _either_ if a API >= v1.52 client requested "verbose" _or_
if we're about to produce legacy fields.

Also switch to using the `httputils.BoolValue` utility; while we lose
the error for invalid values (which we probably should have as a utility
in `httputils`), it aligns with values accepted for other boolean values.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-07 19:56:37 +01:00
Austin Vazquez
931c347b36 api/types: rename disk usage fields
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-11-06 16:21:32 -06:00
Sebastiaan van Stijn
0029924181 api/types/system: change legacyDiskUsage to a non-pointer slice
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-06 12:31:05 +01:00
Austin Vazquez
6881ae72c7 api/types: use regular slices for disk usage types
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-11-05 22:05:47 -06:00
Austin Vazquez
5e985ccd90 Merge pull request #51406 from austinvazquez/move-disk-system-usage-types
api/types: move disk usage structs to per type packages
2025-11-05 14:36:03 -06:00
Austin Vazquez
cc25d0ebd4 Merge pull request #51403 from thaJeztah/singularize_prune
client: singularize prune methods
2025-11-05 11:33:14 -06:00
Austin Vazquez
fabdccbe10 api/types: move disk usage structs to per type packages
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-11-05 11:20:15 -06:00
Sebastiaan van Stijn
cdede16ce7 Merge pull request #51399 from thaJeztah/swarm_enums
api/types/swarm: create types for enum-consts
2025-11-05 16:33:20 +01:00
Sebastiaan van Stijn
ebc1dfbb64 client: singularize prune methods
All methods are singular; while pruning will impact multiple items,
it's more consistent to use singular for all operations.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-05 15:48:02 +01:00
Sebastiaan van Stijn
b075a393b1 Merge pull request #51235 from austinvazquez/refactor-client-system
api/types/system: deprecate `DiskUsage.*` fields and add type specific fields
2025-11-05 14:02:50 +01:00
Sebastiaan van Stijn
39ccd04ca8 api/types/swarm: define type for RegistryAuthSource
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-05 13:48:38 +01:00
Austin Vazquez
a69abdd90d api/types/system: add type specific usage fields to DiskUsage
This change adds type specific fields to `GET /system/df` endpoint with high level information of disk usage. This change also introduces `verbose` query to the endpoint so that detailed information is by default excluded unless queried to reduce memory consumption. The previous top level `DiskUsage` fields (`Images`, `Containers`, `Volumes` and `BuildCache`) are now deprecated and kept for backwards compatibility.

Co-authored-by: Claude <noreply@anthropic.com>
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-11-03 16:34:26 -06:00
Rob Murray
2af22d3512 Fix TestHandleMACAddressBC
- expCtrWideMAC was unused
- missing test for API 1.52

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-11-03 18:33:13 +00:00
Paweł Gronowski
fd1593c067 api/container_inspect: Ensure Config is not nil in inspect response
Ensure that the JSON response for the `GET /containers/{name}/json`
outputs an empty object instead of a nil config.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-10-31 12:41:39 +01:00
Sebastiaan van Stijn
12c9de37e9 api/types: move Version to api/types/system
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-31 02:09:38 +01:00
Cory Snider
19f4c27d81 api/t/network: represent MAC addrs as byte slices
Make invalid states unrepresentable by moving away from stringly-typed
MAC address values in API structs. As go.dev/issue/29678 has not yet
been implemented, provide our own HardwareAddr byte-slice type which
implements TextMarshaler and TextUnmarshaler to retain compatibility
with the API wire format.

When stdlib's net.HardwareAddr type implements TextMarshaler and
TextUnmarshaler and GODEBUG=netmarshal becomes the default, we should be
able to make the type a straight alias for stdlib net.HardwareAddr as a
non-breaking change.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-10-30 17:11:38 -04:00
Sebastiaan van Stijn
0eba2989e0 api/types/registry: rename AuthenticateOKBody to AuthResponse
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-29 18:06:29 +01:00
Austin Vazquez
e9f28e2a41 client: refactor NetworkConnect, NetworkDisconnect, NetworkRemove
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-29 13:02:01 +01:00
Cory Snider
ae28867804 api/pkg/progress: move to client and daemon/internal
Move the progress package up into the client as a temporary shared location for
common clients like CLI and compose.

The progress package is used by the daemon to write progress updates to
some sink, typically a streamformatter. This package is of little use to
API clients as this package does not provide any facilities to consume
the progress updates.

Co-authored-by: Cory Snider <csnider@mirantis.com>
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-24 07:56:57 -05:00
Cory Snider
6baf274fa3 api/pkg/streamformatter: move to client and daemon/internal
Move the streamformatter package up into the client for a temporary
shared location between common clients like CLI and compose.

The streamformatter package is used by the daemon to write streams of
status and progress messages to API clients. It is completely out of
scope of the api module and not used outside the daemon. Remove the
unused rawSteamFormatter, whose purpose is to render the progress as a
TUI.

Co-authored-by: Cory Snider <csnider@mirantis.com>
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-24 07:56:51 -05:00
Paweł Gronowski
ea59a8d74e Merge pull request #51114 from dperny/memory_flags_for_swarm
Add support for memory swap settings for services
2025-10-24 10:04:17 +02:00
Austin Vazquez
f40e1a7582 api: move types/versions to client/pkg and daemon/internal
This change moves the api/types/versions package out into client and daemon versions.

Co-authored-by: Claude <noreply@anthropic.com>
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-23 19:22:31 -05:00
Rob Murray
0971a3bcb8 Inspect: API v1.51 compatibility
For API < v1.52:
- In container inspect:
  - Restore GraphDriver when a snapshotter is used.
  - Remove field Storage
  - Related to commit efa077848f
- In image inspect:
  - Restore GraphDriver when a snapshotter is used.
  - Related to commit c441b2ef19

Co-authored-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-10-23 09:24:08 +01:00
Sebastiaan van Stijn
79912d4c7f daemon: Daemon.getInspectData: move migration code to router
There also appeared to be duplication between daemon.getInspectData,
and the containerRouter.postContainersCreate methods, as both were
back-filling the field.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-21 09:15:18 +02:00
Sebastiaan van Stijn
91ce33d4b0 daemon/server/router/container: remove uses of deprecated MacAddress
Rewrite the router to use a local struct to unmarshal the deprecated
field for requests that send it, and adjust the adoption code.

There also appeared to be duplication between daemon.getInspectData,
and the containerRouter.postContainersCreate methods, as both were
back-filling the field.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-21 08:33:42 +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
Jean Rouge
3a90dd8b8f Adding support for memory swap settings for services
With integration tests

Relevant Swarmkit PR: https://github.com/docker/swarmkit/pull/2816
(updated the vendored version of Swarkit to that)

Signed-off-by: Jean Rouge <rougej+github@gmail.com>

Updated for latest master, fixed bitrot.

Signed-off-by: Drew Erny <derny@mirantis.com>
2025-10-20 10:34:05 -05:00
Sebastiaan van Stijn
5061d0a74d api/types/swarm: remove deprecated ServiceSpec.Networks field
This field was deprecated in [engine-api@5c4b684], which got vendored into
Moby in [moby@8f7a8c7] (API v1.25), and wired up in [moby@99a98cc].

[engine-api@5c4b684]: 5c4b684b2f
[moby@8f7a8c7]: 8f7a8c75ae
[moby@99a98cc]: 99a98ccc14

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-17 22:20:00 +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
9720ee037d Merge pull request #51190 from thaJeztah/remove_virtualsize
api/types/image: remove deprecated Summary.VirtualSize field
2025-10-16 21:43:19 +02:00
Sebastiaan van Stijn
ecd7551310 daemon/server/router/container: fix back-filling of top-level network fields
This was introduced in fc1ff44bc2, which
back-filled the top-level network-properties for the bridge network,
but the fields ended up at the top-level of the response, not the top-level
of the NetworkSettings.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-16 13:47:32 +02:00