Commit Graph

54042 Commits

Author SHA1 Message Date
Sebastiaan van Stijn
aaa9dd4e26 gha: skip "vm" checks if ci/validate-only label is set
commit f0c069ffc9 added support for a
`ci/validate-only` label to skip tests and only run the validation checks.
Commit 09ecd74cf3 was merged later, but was
authored before that feature was merged, so did not account for the label,
so the "vm" checks would always run.

This applies the additional conditions to skip the "vm" checks if the
`ci/validate-only` label is set.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-04 22:21:19 +02:00
Sebastiaan van Stijn
6da8589ebe Merge pull request #50878 from corhere/network-inspect-concrete-type
api/types/network: separate Summary from Inspect
2025-09-04 21:36:00 +02:00
Austin Vazquez
749ec81706 Merge pull request #50799 from thaJeztah/touchup_delete
image delete: inline some variables, and touch-up TODOs
2025-09-04 12:27:30 -07:00
Sebastiaan van Stijn
10f683eeef Merge pull request #50893 from austinvazquez/make-image-inspect-driver-data-optional
api/types/image: make `InspectResponse.GraphDriver` optional
2025-09-04 21:08:26 +02:00
Sebastiaan van Stijn
d019451022 Merge pull request #50850 from corhere/addrset-popcnt
d/libn/internal/addrset: add popcount methods
2025-09-04 21:04:22 +02:00
Sebastiaan van Stijn
0bfc33c70b Merge pull request #50856 from corhere/swagger-gen-script-cleanup
hack: use heredocs in generate-swagger-api.sh
2025-09-04 20:59:06 +02:00
Sebastiaan van Stijn
aead9964f3 Merge pull request #50586 from olljanat/endpoint-name-label
libnetwork: provide endpoint name for IPAM drivers
2025-09-04 20:20:25 +02:00
Austin Vazquez
c441b2ef19 api/types/image: make InspectResponse.GraphDriver optional
This change makes the `GraphDriver` field in `image.InspectResponse` optional. This field will only be returned when using moby engine graph drivers as a backend storage implementation. It will be omitted when using the containerd image backend.

Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-09-04 13:04:10 -05: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
Cory Snider
f0d10ae733 d/network: filter networks individually
Internally a network is represented by either a libnetwork.Network or a
swarmapi.Network. The daemon functions backing the API server map
these values to the Engine API network.Inspect type on demand. Since
they have to convert, the functions to get a list of networks have to
loop over the slice of Networks and append them to a slice of
network.Inspect values.

The function used to filter the list of networks by a user-supplied
predicate takes a []network.Inspect and returns a shorter slice.
Therefore the daemon functions backing the API server have to loop
through the list twice: once to convert, and again inside the
FilterNetworks function to delete networks from the slice which do not
match the filter predicate. Each time an item is deleted from a slice,
all items at higher indices need to be copied to lower indices in the
backing array to close the hole.

Replace FilterNetworks with a function that accepts a single
interface-valued network and returns a boolean. Amend libnetwork.Network
and write a thin adapter for swarmapi.Network so both implement the
aforementioned interface. The daemon functions can thus filter networks
before projecting the values into API structs, and can completely skip
over non-matching networks, which cuts down on a nontrivial amount of
copying.

Split the validation of the filter predicate from filter evaluation to
both make it more ergonomic to use inside loops, and to make invalid
states (a filter with an ill-formed predicate) unrepresentable.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-09-04 12:49:31 -04:00
Austin Vazquez
5f8fd1f195 Merge pull request #50587 from thaJeztah/remove_version_consts
api: remove unused DefaultVersion, MinSupportedAPIVersion consts
2025-09-04 09:27:25 -07: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
Sebastiaan van Stijn
8e946ee3d0 Merge pull request #50825 from austinvazquez/move-decode-security-opts-from-types-to-pkg
api/types/system: move `SecurityOpt` and `DecodeSecurityOptions` to client mod
2025-09-04 10:30:44 +02:00
Sebastiaan van Stijn
364281e6cb Merge pull request #50883 from thaJeztah/libc8d_cleanups
libcontainerd/remote: assorted cleanups
2025-09-04 00:41:50 +02:00
Austin Vazquez
0dd22f6471 Merge pull request #50881 from thaJeztah/daemon_fix_typo
daemon: Daemon.ContainerExecStart: fix typo in log field
2025-09-03 13:57:52 -07:00
Paweł Gronowski
ac2d830587 Merge pull request #50889 from vvoland/update-go
update to go1.24.7
2025-09-03 22:18:06 +02:00
Paweł Gronowski
30406d42e3 update to go1.24.7
This includes 1 security fix:

- net/http: CrossOriginProtection bypass patterns are over-broad

    When passing patterns to CrossOriginProtection.AddInsecureBypassPattern,
    requests that would have redirected to those patterns (e.g. without a trailing
    slash) were also exempted, which might be unexpected.

    Thanks to Marco Gazerro for reporting this issue.

    This is CVE-2025-47910 and Go issue https://go.dev/issue/75054.

View the release notes for more information:
https://go.dev/doc/devel/release#go1.24.7

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-09-03 20:31:17 +02:00
Paweł Gronowski
1c220f2f3f Merge pull request #50885 from crazy-max/buildkit-0.24.0
vendor: update buildkit to v0.24.0
2025-09-03 20:26:50 +02: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
Kevin Alvarez
d47b0db4f9 vendor: update buildkit to v0.24.0
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-09-03 18:41:21 +02:00
Paweł Gronowski
2f15be1679 Merge pull request #50886 from austinvazquez/fix-vendoring-for-client-mod
fix: client vendor with config struct changes
2025-09-03 18:13:12 +02:00
Austin Vazquez
ca97d071b7 fix: client vendor with config struct changes
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-09-03 10:32:58 -05:00
Rob Murray
04e09bbfe6 Merge pull request #50845 from robmry/iterate_over_nftables_rules
nftables: iterate over rules
2025-09-03 16:29:48 +01:00
Albin Kerouanton
4021bd7947 Merge pull request #50864 from akerouanton/bridge-driver-config
libnet/d/bridge: Register: pass a Configuration struct
2025-09-03 16:20:38 +02:00
Austin Vazquez
50d281f074 Merge pull request #50847 from vvoland/client-config-opt
client: Migrate tests to use functional opts and extract `clientConfig`
2025-09-03 06:41:11 -07:00
Sebastiaan van Stijn
3c34c9d031 Merge pull request #50880 from akerouanton/fix-empty-pbs-slices-warning
daemon/srv/r/ctr: handlePortBindingsBC: fix warning
2025-09-03 14:50:32 +02:00
Sebastiaan van Stijn
4293b81f14 Merge pull request #50879 from thaJeztah/rm_contrib_udev
contrib: remove udev rules for hiding loopback devices
2025-09-03 12:46:54 +02:00
Sebastiaan van Stijn
37d6a1909b libcontainerd/remote: wrapError: don't convert c8d errdefs error
The moby codebase is now able to handle containerd errdefs errors directly
so there's no need to wrap a c8d "NotFound" error. We still need to look
if we can remove this function altogether; it's unclear what conditions
could result in the string-matching being needed.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-03 12:31:57 +02:00
Sebastiaan van Stijn
36303969b9 libcontainerd/remote: container.NewTask: move vars to where used
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-03 12:31:53 +02:00
Albin Kerouanton
f37094ad4f libnet/d/bridge: CreateEndpoint: use d.config directly
newDriver, which creates a new instance of the bridge driver, is the
only place where the driver config field is set. So there's no need to
gate access to it with a mutex.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-09-03 12:10:16 +02:00
Albin Kerouanton
ae24edfc0d libnet/d/bridge: merge configure into newDriver
configure must be called every time newDriver is called... so merge them
together.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-09-03 12:10:16 +02:00
Albin Kerouanton
2436458227 libnet/d/bridge: Register: pass a Configuration struct
Libnetwork passes a map[string]any to the bridge driver's Register
function. This forces the daemon to convert its configuration into a
map, and the driver to convert that map back into a struct.

This is unnecessary complexity, and makes it harder to track down where
and how bridge driver configuration fields are set.

Refactor libnetwork to let the daemon register the bridge.Configuration
directly through a new option `OptionBridgeConfig`.

The bridge driver now takes a `Configuration` param that needs no
special treatment.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-09-03 12:10:10 +02:00
Albin Kerouanton
386a3a6bba libnet/config: mv config_{unsupported,windows}.go
Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-09-03 12:08:24 +02:00
Albin Kerouanton
18f2e61d08 libnet/config: rm config_freebsd.go
Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-09-03 12:08:24 +02:00
Paweł Gronowski
1733d00ef1 Merge pull request #48955 from thaJeztah/improve_TestConcurrentPush
integration-cli: TestConcurrentPush: refactor to improve failure logs
2025-09-03 11:54:18 +02:00
Sebastiaan van Stijn
e099f1e409 daemon: Daemon.ContainerExecStart: fix typo in log field
Changing it to `execID`, which is what's used in most/all other places.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-03 11:34:21 +02:00
Albin Kerouanton
6e512cc292 libnet/d/ipvlan: Register: remove unused config param
Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-09-03 11:23:07 +02:00
Albin Kerouanton
459f4f431d libnet/d/macvlan: Register: remove unused config param
Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-09-03 11:23:07 +02:00
Albin Kerouanton
43014a891b libnet/d/overlay: Register: remove unused config param
The overlaydrivers takes a config parameter, but actually never uses
it — drop it.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-09-03 11:23:07 +02:00
Albin Kerouanton
18efa5513d libnet: makeDriverConfig: drop support for label-based config
makeDriverConfig is written in such a way that it seems to support
label-based driver configuration. That is, you could hypothetically use
labels starting with `com.docker.network.driver.<driver-name>.` to
define the configuration of a driver.

These labels come from the Controller's `cfg.Labels` which are set by
the daemon through libnet's OptionLabels which takes the list of labels
set on the daemon through dockerd's --label flag, or the equivalent
daemon.json field.

However, the daemon forbids setting labels that start with
`com.docker.*`. For instance:

    label com.docker.network.driver.bridge.EnableProxy=false is not allowed: the namespaces com.docker.*, io.docker.*, and org.dockerproject.* are reserved for internal use

Hence, this is dead code — remove it.

Also, makeDriverConfig is checking if the Controller's cfg field is
nil... But the Controller struct is instantiated in a single place (i.e.
NewController) and it always set that field. Drop that nil check too.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-09-03 11:23:07 +02:00
Albin Kerouanton
1470048e00 libnet: remove drivers_freebsd.go
As it stands, libnetwork pkg can't be compiled on FreeBSD, so no need to
keep this file around.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-09-03 11:23:07 +02:00
Albin Kerouanton
4ea085187a libnet/d/bridge: export Configuration
Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-09-03 11:23:07 +02: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
Sebastiaan van Stijn
fbad7b568d libcontainerd/remote: task.Exec: log warning on cleanup failure
Not exactly sure what errors we can expect here if the process failed
to start, but logging as a warning instead of discarding won't do harm.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-03 11:00:11 +02:00
Sebastiaan van Stijn
e67b3b0b90 libcontainerd/remote: task.Exec: rename processID -> execID
This argument is set from ExecConfig.ID, which we refer to as "execID"
in most places; rename the argument to match that terminology.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-03 10:58:33 +02:00
Sebastiaan van Stijn
003e17ff5a libcontainerd/remote: task.Exec: preserve parent context during cleanup
Use `context.WithoutCancel()` to preserve the parent context during cleanup
instead of creating a new context. This still prevents context-cancellation
from terminating the cleanup, but makes sure that tracing and logging are
wired up; https://github.com/containerd/containerd/blob/v2.1.4/client/process.go#L232-L263

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-03 10:58:17 +02:00
Sebastiaan van Stijn
167b0e9ea6 libcontainerd/remote: task.Exec: make defer error-handling more explicit
Use a named output variable to more clearly indicate what error is being
checked, and scope `err` variables used in this function.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-03 10:15:37 +02:00