220 Commits

Author SHA1 Message Date
Sebastiaan van Stijn
c8c13fe058 API: /info: remove magic <unknown> values for API < 1.39
daemon versions before v18.09 (API v1.39) returned a magic `<unknown>` value
for the `KernelVersion` and `OperatingSystem` if these values were not set.
Commit e6e8ab50fa removed this magic values,
but kept a fallback for old versions of the CLI that expected this value to
be pre-formatted this way. Given that this change was over 7 Years ago, and
never was a strict contract of the API, we can remove this fallback. Current
versions of the CLI properly handle presentation, so this would only impact
EOL versions of the CLI.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-15 14:32:34 +02:00
Sebastiaan van Stijn
1e6e2ceb22 Merge pull request #50846 from akerouanton/drop-deprecated-network-structs
api/t/ctr: drop NetworkSettingsBase, DefaultNetworkSettings
2025-09-11 22:00:06 +02:00
Cory Snider
c2c2b80e90 daemon: report IPAM status for Swarm networks
As the Engine API requests may be directed at a non-leader Swarm
manager, the information needs to be tunneled through the Swarm API.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-09-11 15:25:14 -04:00
Sebastiaan van Stijn
1c006f247d Merge pull request #50832 from thaJeztah/events_remove_deprecated
api/types/events: Message: remove deprecated Status, ID, and From fields
2025-09-11 21:22:57 +02:00
Sebastiaan van Stijn
183f1517a9 Merge pull request #50915 from thaJeztah/omit_empty_config
api: image inspect: remove temporary backfill for Config fields
2025-09-11 21:21:30 +02:00
Albin Kerouanton
fc1ff44bc2 api/t/container: drop DefaultNetworkSettings
All the fields in DefaultNetworkSettings were deprecated in Engine v1.9
and scheduled for removal in v17.12. However, they're still return in
all supported API versions.

As we still need to keep backward compatibility for older API versions,
this change leverages the newly added 'compat' package to return these
fields despite being removed from the Go struct.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-09-11 17:57:42 +02:00
Sebastiaan van Stijn
5815eb82ee daemon/events: omit deprecated event fields on API >= v1.52
Don't include the deprecated `status`, `id`, and `from` fields in event
responses.

These fields were deprecated in [moby@72f188] (docker v1.10, API v1.22),
but the daemon still included them in the response.

Unfortunately, the Docker CLI (and compose indirectly), continued using
these fields up until v25.0.0, and panic if the fields are omitted, or
left empty (due to a bug), see: https://github.com/moby/moby/pull/50832#issuecomment-3276600925
so we need to continue producing these fields on API < v1.52.

[moby@72f188]: 72f1881df1

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-11 10:01:17 +02:00
Cory Snider
3f86797d3f api,daemon: report IPAM status for network
On API v1.52 and newer, the GET /networks/{id} endpoint returns
statistics about the IPAM state for the subnets assigned to the network.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-09-10 11:06:05 -04:00
Sebastiaan van Stijn
0525ae2aed api: image inspect: remove temporary backfill for Config fields
Commit 4dc961d0e9 (API v1.50) fixed the type
used for Config to point to the correct type, which is the Config struct
from the [Docker image spec] (which embeds the [OCI Image Specification]
type); however, those types use an omitempty, which wasn't documented as
part of the API changes, so f85394dd5d added
a temporary backfill for empty fields.

This removes that backfill for API v1.52 so that empty image config fields
are now omitted.

[OCI Image Specification]: https://github.com/opencontainers/image-spec/blob/v1.1.1/specs-go/v1/config.go#L23-L62
[Docker image spec]: https://github.com/moby/docker-image-spec/blob/v1.3.1/specs-go/v1/image.go#L19-L32

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-05 22:15:54 +02:00
Sebastiaan van Stijn
2d1af4e4e4 api/types/build: move build options to client and backend
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-05 15:57:05 +02:00
Sebastiaan van Stijn
5232d82c1b daemon/server/backend: move build options to buildbackend
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-05 15:56:56 +02:00
Sebastiaan van Stijn
a064febe14 Merge pull request #50905 from thaJeztah/move_checkpoint_options
api/types/checkpoint: move checkpoint options to client
2025-09-05 13:01:52 +02:00
Sebastiaan van Stijn
432c9e81d1 Merge pull request #50772 from austinvazquez/move-build-cache-prune-options-from-api-to-client
api/types/build: move build cache prune options from api to client
2025-09-05 10:33:23 +02:00
Sebastiaan van Stijn
a8afc2c6fb api/types/checkpoint: move checkpoint options to client
Move the option-types to the client and in some cases create a
copy for the backend. These types are used to construct query-
args, and not marshaled to JSON, and can be replaced with functional
options in the client.

The CreateOptions type was used both as options-struct for the client,
and as struct to marshal/unmarshal the request. For this type, a copy
is created in the Client and a new `checkpoint.CreateRequest` is added
in the API.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-05 10:20:06 +02:00
Sebastiaan van Stijn
a45639af26 Merge pull request #50897 from thaJeztah/move_container_options
api/types/container: move container options to client
2025-09-05 09:29:56 +02:00
Austin Vazquez
26e335b647 api/types/build: move CachePruneOptions to client mod
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-09-04 16:33:57 -05:00
Sebastiaan van Stijn
4d20b6fe56 api/types/container: move container options to client
Move the option-types to the client and in some cases create a
copy for the backend. These types are used to construct query-
args, and not marshaled to JSON, and can be replaced with functional
options in the client.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-04 20:09:55 +02:00
Cory Snider
1a86389419 api/types/network: separate Summary from Inspect
While the network Summary and Inspect types have been aliases in Go's
type system, in practice there is a difference: the Containers and
Services fields are only populated when inspecting a network. Split out
the common fields into a base network.Network struct which is embedded
in the network.Summary and network.Inspect types.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-09-04 13:51:28 -04:00
Cory Snider
291e129631 Merge pull request #50860 from corhere/network-filter-iface
daemon: filter networks before converting to API types
2025-09-04 13:48:07 -04:00
Cory Snider
f8bd170b2a daemon: validate args in network.New*Filter
Filter-term validation does not belong in the API module. Clients should
not be making any assumptions about which terms the daemon understands.
Users should not need to upgrade their clients to use filter terms
introduced in a newer daemon. Move the network filter validation from
the api module into the daemon.

Split network.NewFilter into network.NewListFilter and
network.NewPruneFilter constructors which validate the filter terms,
enforcing the invariant that any network.Filter is a well-formed filter
for networks.

The network route handlers have been leveraging a hidden 'idOrName'
filter term that is not listed in the set of accepted filters and
therefore not accepted in API client requests. And it's a good thing
that it was never part of the API: it is completely broken and not fit
for purpose! When a filter contains an idOrName term, the term values
are ignored and instead the filter tests whether either the 'id' or
'name' terms match the Name of the network. Unless the filter contains
both 'id' and 'name' terms, the match will evaluate to true for all
networks! None of the daemon-internal users of 'idOrName' set either
of those terms, therefore it has the same effect as if the filter did
not contain the 'idOrName' term in the first place.

Filtering networks by id-or-name is a quirky thing that the daemon needs
to do to uphold its end of the Engine API contract, not something that
would be of use to clients. Fixing up the idOrName filter would
necessitate adding it to the list of accepted terms so the filter passes
validaton, which would have the side effect of also making the filter
available to API clients. Instead, add an exported field to the Filter
struct so that daemon code can opt into the internal-only behaviour of
having the 'id' term match on either the network Name or ID.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-09-04 12:49:31 -04:00
Cory Snider
ea1dfbda9e daemon: prune networks using network.Filter
Construct a network.Filter from the filters.Args only once per API
request so we don't waste cycles re-validating an already validated
filter. Since (*Daemon).NetworksPrune is implemented in terms of
(Cluster).GetNetworks, that method now accepts a network.Filter instead
of a filter.Args. Change the signature of (*Daemon).GetNetworks for
consistency as both of the GetNetworks methods are used by network API
route handlers.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-09-04 12:49:31 -04:00
Sebastiaan van Stijn
e46a991dc5 api: remove unused DefaultVersion, MinSupportedAPIVersion consts
These consts are no longer used, and separate consts were added in both
the client and daemon packages;

- client: 41da5700a4
- daemon: a632b8495b

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-04 07:30:35 -05:00
Austin Vazquez
e2e9f36c5f api/types/system: move SecurityOpt type and DecodeSecurityOptions to client
This change moves the `system.SecurityOpt` type and `system.DecodeSecurityOptions` function to the client and adds a set of unit tests to capture current implementation. This change also create a set of daemon backend copies for usage.

Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-09-03 12:49:06 -05:00
Albin Kerouanton
7b75f355e5 daemon/srv/r/ctr: handlePortBindingsBC: fix warning
Commit 0ca7ac325 was merged before a review comment was addressed.

Update the warning message returned by handlePortBindingsBC to handle
the case where multiple empty port bindings slices are sent to the API.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-09-03 11:16:51 +02:00
Albin Kerouanton
0ca7ac3258 daemon: backfill empty PBs slices for backward compat
So far, on ContainerStart, the daemon was silently backfilling empty
PortBindings slices with a PortBinding with unspecified HostIP and
HostPort. This was done by github.com/docker/go-connections/nat.SortPortMap.

This backfilling doesn't make much sense, and we're trying to remove
that package. So, move the backfilling to the API server, keep it for
older API versions, deprecate it for API 1.52, and drop it for API 1.53
and above.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-09-02 22:45:04 +02:00
Austin Vazquez
c9fdad2552 daemon: marshal legacy registry.ServiceConfig extra fields for compatability
This change moves the logic that is used to marshal the legacy extra fields for `registry.ServiceConfig` type to the daemon backend.

Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-08-29 08:23:34 -05:00
Austin Vazquez
b721c4f4a8 daemon: minor touchups for backend system info response marshal
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-08-27 11:01:14 -05:00
Austin Vazquez
1e249cc309 api/types/network: move connect/disconnect options types to client module
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-08-27 07:05:52 -05:00
Sebastiaan van Stijn
6288414110 Merge pull request #50776 from austinvazquez/move-image-options-from-api-to-client
api/types/image: move image options from api to client
2025-08-27 00:45:28 +02:00
Austin Vazquez
853aed171b api/types/image: move image option types to client
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-08-26 15:38:44 -05:00
Austin Vazquez
33066cddb1 api/types/swarm: move SecretListOptions type to client
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-08-26 14:15:35 -05:00
Sebastiaan van Stijn
7145e7666b Merge pull request #50794 from austinvazquez/move-swarm-option-types-to-client
api/types/swarm: move swarm option types to client
2025-08-26 18:44:02 +02:00
Austin Vazquez
a2291e5eac api/types/swarm: move ServiceListOptions type to client
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-08-26 07:21:40 -05:00
Austin Vazquez
3b1e16594b api/types/swarm: move ServiceUpdateOptions type to client
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-08-26 07:21:33 -05:00
Austin Vazquez
4dcc7af116 api/types/swarm: move UpdateFlags type to client
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-08-26 07:21:23 -05:00
Austin Vazquez
ad0fa5a872 api/types/swarm: move TaskListOptions type to client
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-08-26 07:21:17 -05:00
Austin Vazquez
7d2b87e95f api/types/swarm: move NodeListOptions to client mod
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-08-26 07:21:12 -05:00
Austin Vazquez
b1260cd493 api/types/swarm: move ConfigListOptions to client
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-08-26 07:21:05 -05:00
Austin Vazquez
bdce1608c8 api: move authconfig package from types/registry to pkg
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-08-26 07:17:45 -05:00
Austin Vazquez
7aa50424e3 daemon: decouple daemon backend from client volume list options
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-08-21 21:58:52 -05:00
Austin Vazquez
ee22a62dd5 client: refactor ListOptions to VolumeListOptions
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-08-21 21:47:59 -05:00
Austin Vazquez
c48585f104 api/types/volume: move ListOptions to client mod
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-08-21 21:46:19 -05:00
Austin Vazquez
c4e82bab70 api/types/volume: move DiskUsage type internal to daemon backend
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-08-19 08:12:34 -05:00
Austin Vazquez
0d61b55add api/types/image: move DiskUsage type internal to daemon backend
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-08-19 08:08:34 -05:00
Austin Vazquez
566c44edfe api/types/container: move DiskUsage type internal to daemon backend
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-08-19 07:59:46 -05:00
Austin Vazquez
d588092be2 api/types/build: move internal to daemon backend
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-08-19 07:56:23 -05:00
Sebastiaan van Stijn
f4ae01a38a daemon/server/router/system: getEvents: use event consts for filtering
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-18 13:00:42 +02:00
Sebastiaan van Stijn
194aabf285 Merge pull request #50730 from tiago-teixeira5/fix-push-wo-auth
daemon/router/image: initialize default authConfig
2025-08-14 18:52:43 +02:00
Austin Vazquez
812aa46d81 Move the api/types/time package to internal daemon package
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-08-14 07:56:59 -05:00
Tiago Teixeira
033ec8be44 daemon/router/image: initialize default authConfig
Signed-off-by: Tiago Teixeira <tiago.teixeira@ecorobotix.com>
2025-08-14 14:24:43 +02:00