Commit Graph

9801 Commits

Author SHA1 Message Date
Brian Goff
6e52828ec3 Merge pull request #51517 from corhere/opencensus-bridge
daemon: install OpenCensus-to-OTEL trace bridge
2025-11-20 11:07:51 -08:00
Rob Murray
ed10b98506 Restore missing nwEndpointsMu.Lock
- introduced by 4f7afb8 (Remove libnet's logic to track a driver's
  port mapping state)

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-11-18 15:38:48 +00:00
Sebastiaan van Stijn
a81d441133 Merge pull request #51534 from robmry/dont-remove-removed-gateway
Don't try to remove a cleared docker_gwbridge endpoint
2025-11-15 00:32:32 +01:00
Rob Murray
1731e9e729 Don't try to remove cleared docker_gwbridge endpoint
If a container is using a docker_gwbridge endpoint as its gateway,
when it's connected to another network that provides a gateway, the
docker_gwbridge endpoint is removed when that endpoint is added (in
a recursive nightmare).

So, the "before" gateway for the container has been removed
before the new gateway is updateExternalConnectivity'd.

Don't pass the old gateway to updateExternalConnectivity in that
case, because the network driver's already forgotten about it.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-11-14 17:41:01 +00:00
Cory Snider
4535d63c91 daemon: install OpenCensus-to-OTEL trace bridge
Export trace spans from the github.com/microsoft/hcsshim module, which
is instrumented with OpenCensus, to the daemon's OpenTelemetry exporter
to provide more visibility into Windows container lifecycle operations.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-11-13 15:00:05 -05: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
feba59eccd Merge pull request #51492 from vvoland/c8d-fix-selection
daemon: Fix image store choice priority for prior graphdriver state
2025-11-13 20:19:25 +01:00
Albin Kerouanton
d494784654 Merge pull request #51495 from akerouanton/revert-a8b9eff90
libnet: create DNS records on sbJoin (if not agent node)
2025-11-13 20:02:28 +01:00
Albin Kerouanton
2e41476a5f libnet: create DNS records on sbJoin (if not agent node)
Commit a8b9eff90 removed a call to Network.updateSvcRecord from
Network.createEndpoint on the grounds that:

> all callers of Network.createEndpoint follow up with an Endpoint.Join,
> which also sets up the DNS entry.

However, the original call in Network.createEndpoint was gated by:

```
if !n.getController().isSwarmNode() || n.Scope() != scope.Swarm || !n.driverIsMultihost() {
	n.updateSvcRecord(context.WithoutCancel(ctx), ep, true)
}
```

whereas the call in Endpoint.sbJoin() (invoked by Endpoint.Join()) is
gated by:

```
if !n.getController().isAgent() {
    if !n.getController().isSwarmNode() || n.Scope() != scope.Swarm || !n.driverIsMultihost() {
	    n.updateSvcRecord(context.WithoutCancel(ctx), ep, true)
    }
}
```

As a result, once a node has joined a Swarm cluster, no DNS entries are
created for non swarm-scoped networks.

Change the condition used by `sbJoin` to match the original condition
used in `createEndpoint`.

Signed-off-by: Albin Kerouanton <albin.kerouanton@docker.com>
2025-11-13 17:31:13 +01:00
Paweł Gronowski
391247ce96 daemon: Fix image store choice priority for prior graphdriver state
The priority order for determining image store choice was incorrect when
a prior graphdriver existed.

The issue occurred because the prior graphdriver check happened after
processing explicit driver configuration, effectively ignoring user
intent when prior state existed.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-11-13 10:05:49 +01:00
Paweł Gronowski
c5d0e3e6fa daemon: Add TestDetermineImageStoreChoice
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-11-13 10:05:49 +01:00
Sebastiaan van Stijn
9824080b57 Merge pull request #51012 from tonistiigi/attestation-signature-referrers
image: pull/load/save attestation manifest and signatures with image
2025-11-12 18:04:21 +01:00
Tonis Tiigi
47e852f061 image: pull/load/save attestation manifest and signatures with image
Updates docker pull to pull related attestation manifest and
any signatures for that manifest in cosign referrer objects.

These objects are transferred with the image when running
docker save and docker load and can be used to identify
the image in future updates.

Push is not updated atm as the currect push semantics
in containerd mode do not have correct immutability
guaranteed and don't work with image indexes.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2025-11-12 07:53:46 -08:00
Paweł Gronowski
b4f9bd1cb3 c8d/builder-next: Don't force unpack
The image exporter wrapper was unconditionally setting `unpack=true` for
all build exports, preventing users from controlling this behavior
through buildkit's output image exporter option.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-11-12 14:34:12 +01:00
Paweł Gronowski
e7d7771bce Merge pull request #51483 from thaJeztah/rm_MinConnectTimeout
daemon: remove workaround for c8d client connection timeout
2025-11-12 11:01:16 +01:00
Tonis Tiigi
3874ca5984 vendor: update buildkit to v0.26.0-rc2
Currently requires replace rule for swarmkit etcd.

BuildKit itself doesn't use etcd but version gets bumped
via unused dependency.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-11 23:15:07 +01:00
Sebastiaan van Stijn
7e78088f8f daemon: remove workaround for c8d client connection timeout
This workaround was added in df519e9e1a, pending
a fix in containerd;

> daemon: Fix giving up too early while connecting to containerd socket
>
> Explicitly set the gRPC connection params to take the timeout into
> account to workaround the containerd v2 client not passing down the
> stack.
>
> containerd v2 replaced usages of deprecated gRPC functions but didn't
> pass the timeout to the actual dial connection options.

A fix for this was merged in [containerd@ee574e7], which is part of containerd
v2.1.0-beta.0, and backported to containerd v2.0.4 through [containerd@6b5efba].

[containerd@ee574e7]: ee574e76e7
[containerd@6b5efba]: 6b5efba83b

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-11 17:55:44 +01:00
Sebastiaan van Stijn
81d9fdb838 Merge pull request #51477 from thaJeztah/discovery_enum
libnetwork/discoverapi: use DiscoveryType for enum
2025-11-11 15:01:25 +01:00
Sebastiaan van Stijn
6b8285f965 libnetwork/discoverapi: use DiscoveryType for enum
This type describes the options defined as consts below it, so make
those consts typed. While updating, I also removed the use of iota
to prevent accidentally changing their values (and if this API is
implemented elsewhere)

(but mostly because I'm not a fan of iota ':))

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-11 13:10:17 +01:00
Sebastiaan van Stijn
bb56c4d7e7 daemon: remove some deprecated and unused code
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-11 09:05:41 +01:00
Vigilans
d192a63467 daemon: Ensure buildkit created container's isolation mode consistent with daemon's config
- Introduced DefaultIsolation method in the Daemon to return the daemon configured isolation mode for Windows.

Signed-off-by: Vigilans <vigilans@foxmail.com>
2025-11-10 16:33:14 +01:00
Paweł Gronowski
7cff366d43 Merge pull request #51439 from thaJeztah/concrete_enums
api/types/container: make ContainerState, HealthStatus concrete types
2025-11-10 16:21:22 +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
Sebastiaan van Stijn
db71c6a914 api/types/container: make HealthStatus a concrete type
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-10 16:08:15 +01:00
Sebastiaan van Stijn
1fd87e9fdf api/types/container: make ContainerState a concrete type
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-10 16:08:12 +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
048ced8435 Merge pull request #51448 from akerouanton/stop-events-service
daemon: close EventsService on shutdown
2025-11-10 14:20:28 +01: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
Paweł Gronowski
22112fab66 Merge pull request #51444 from thaJeztah/buildcache_singleflight
daemon/internal/builder-next: Builder.DiskUsage(): use singleflight
2025-11-10 12:02:07 +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
46090e88e4 daemon/internal/builder-next: Builder.DiskUsage(): use singleflight
Use a singleflight for collecting the build-cache usage; collecting this
information is potentially heavy-weight, and we already do this for the
other disk-usage methods.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-07 21:32:23 +01:00
Sebastiaan van Stijn
fb94e241f5 daemon: disk-usage: fix incorrect key for singleflight
commit a69abdd90d introduced a "verbose"
option for the disk-usage endpoint, which allowed omitting the items
to be included in the results.

However, it did not take into account that a singleflight is used to
allow sharing the results between requests; this means that a request
made while another request is already in flight could share the wrong
results, and either get "verbose" or "non-verbose", depending on the
request already in flight.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-07 21:21:32 +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
20870f13c2 daemon: remove intermediate vars when collecting diskUsage
Set values directly on the DiskUsage objects instead of using some
intermediate vars, some of which were named slightly confusing due
to them being used both for "totalSize" and "reclaimableSize".

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-07 19:57:36 +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
Sebastiaan van Stijn
243e19e1f2 Merge pull request #51421 from thaJeztah/dockerd_cleanups
cmd/dockerd: minor cleanups / changes
2025-11-07 00:53:35 +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
Paweł Gronowski
217fd78905 Merge pull request #51412 from austinvazquez/use-regular-slice-for-disk-usage
api/types: use regular slices for disk usage types
2025-11-06 23:13:47 +01:00
Paweł Gronowski
10f6eeb56d daemon: Refactor image store choice logic
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-11-06 20:09:27 +01:00
Sebastiaan van Stijn
4a3e139e3c daemon/command: NewDaemonRunner: set both stdout and stderr
Make sure Cobra is configured with the streams we use, and use
Cobra's utilities to print the validation messsage.

While updating, also add a short comment outlining why we're using
STDERR, not STDOUT for this message.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-06 15:53:11 +01: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
Sebastiaan van Stijn
e509a7cefe daemon/command: remove __dummy_command workaround for completion
This workaround was added in 3bb40af036 to
work around a limitation of Cobra, which didn't support completion if there
are no subcommands, because [Command.InitDefaultCompletionCmd] disabled
completion, as implicitly adding the hidden `completion` and `__complete`
subcommands would break binaries without subcommands that accepted positional
args.

This problem was fixed in Cobra v1.9.0 through [cobra@24ada7f], which now
dynamically adds the `completion` subcommand when invoked.

This patch removes the hidden `__dummy_command`, which was used to work around
the logic in Cobra < v1.9.0, and to make it enable completion regardless.

Completion should still work as usual:

    dockerd completion --help

    Usage:	dockerd completion [flags]
    ...

    source <(dockerd completion bash)
    dockerd --default-<tab>
    --default-address-pool   (Default address pools for node specific local networks)
    --default-cgroupns-mode  (Default mode for containers cgroup namespace ("host" | "private"))
    --default-gateway        (Default gateway IPv4 address for the default bridge network)
    --default-gateway-v6     (Default gateway IPv6 address for the default bridge network)
    --default-ipc-mode       (Default mode for containers ipc ("shareable" | "private"))
    --default-network-opt    (Default network options)
    --default-runtime        (Default OCI runtime for containers)
    --default-shm-size       (Default shm size for containers)
    --default-ulimit         (Default ulimits for containers)

[Command.InitDefaultCompletionCmd]: https://github.com/spf13/cobra/blob/v1.8.1/completions.go#L685-L698
[cobra@24ada7f]: 24ada7fe71

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-06 09:42:49 +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
b90e059dd9 Merge pull request #51386 from thaJeztah/adjust_build_tags
daemon/internal: adjust some build-tags
2025-11-05 11:34:12 -06:00