Commit Graph

62 Commits

Author SHA1 Message Date
Derek McGowan
d210449d85 Natively support GRPC on the docker socket
Use the GRPC server when requests are for the grpc content type.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-12-09 21:03:04 +01:00
Rob Murray
a230544000 NRI: add daemon.json/command line options
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-12-05 15:19:33 +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
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
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
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
Sebastiaan van Stijn
d1a720cb15 Merge pull request #51042 from akerouanton/userns-remapping-disable-snapshotter
daemon/command: disable c8d snapshotter when userns remapping enabled
2025-10-17 17:21:31 +02:00
Rob Murray
20061f7cd4 Merge pull request #51198 from thaJeztah/move_log_opts
daemon: consolidate "log-level" and "log-format" options and flags
2025-10-16 14:24:19 +01:00
Sebastiaan van Stijn
d9a03a374f daemon: consolidate "log-level" and "log-format" options and flags
The `LogLevel` and `LogFormat` options were defined in two locations;

- in the `daemon/commands.daemonOptions` struct.
- in the `daemon/config.Config` (`CommonConfig`) struct.

While we may need some options-struct to initialize the daemon, we currently
don't and the separate structs means they have to be kept in sync, and for
flags to be distributed across multiple places.

Note that some flags will not be configurable in the config-file (such as
the path of the config-file itself), so those options will need to have a
separate struct (which may still live in the `daemon/config` package).

This patch;

- Removes the `LogLevel` and `LogFormat` from `daemon/commands.daemonOptions`
  to `daemon/config.CommonConfig`.
- Adds a bare-bones `stringVar` implementation using generics to allow using
  strong-typed string values to be used for flags.
- Moves the flags together with the other flags in `installCommonConfigFlags`.
- Sets the default options in the `Config` struct.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-16 10:02:47 +02:00
Sebastiaan van Stijn
4e6c955e78 daemon/command: configureDaemonLogs: don't panic
Return an error instead of panicking.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-16 10:02:46 +02:00
Sebastiaan van Stijn
c73fe6d26e daemon/config: move daemon log-config to a separate struct
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-16 10:02:43 +02:00
Sebastiaan van Stijn
a6cf5e19e8 daemon/command: remove placeholder
It's no longer functional since 7435e4a1be22a5a44f945d6b45e1e81273fd868d;
(v28.1.0) this flag was purely to print the deprecation message. The
daemon.json handling still has an exception to ignore the field (if
present).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-16 09:54:34 +02:00
Sebastiaan van Stijn
c584855329 daemon/command: configureProxyEnv: accept smaller struct
Also pass through the context

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-16 01:27:20 +02:00
Sebastiaan van Stijn
69702bd821 fix minor linting issues
Making my IDE less noisy

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-15 22:30:38 +02:00
Albin Kerouanton
e1722eb8d8 daemon/command: disable c8d snapshotter when userns remapping enabled
Buildkit fails when userns remapping is enabled and c8d snapshotter is
used. As a temporary workaround, disable c8d snapshotter when userns
remapping is enabled. This will need a proper fix in the future.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-10-14 10:14:35 +02:00
Sebastiaan van Stijn
b043980e6f daemon/config: remove deprecated CommonConfig.CorsHeaders
This option was deprecated in Docker 27.0 through 7ea9acc97f,
and removed in 28.0 through ae96ce866f.
The field was kept to provide a user-friendly error when used; this
patch removes the field altogether.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-15 11:11:20 +02: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
Marat Radchenko
0ded8645b6 Fix custom runtimes handling on Windows
This commit partially reverts 7ccf750daa and 84965c0752

Closes #50542

Signed-off-by: Marat Radchenko <marat@slonopotamus.org>
2025-08-08 21:41:17 +02:00
Sebastiaan van Stijn
3862a0875c check for net.ErrClosed instead of "use of closed network connection"
The infamous "use of closed network connection" error was added in
[cl-5649076] as a non-exported error. This made it not possible to
write code to handle it as a sentinel error, other than through string-
matching.

Commit [moby@cc851db] (docker v0.6.4) added a [`IsClosedError`] utility
for this (as [net.errClosing@go1.1.2] did not yet export this error).
The `IsClosedError` was later moved to the `go-connections` module, but
various other places in our code used similar matching.

There was a feature-request [go-4373] to export it, which
got accepted and implemented in [CL 5649076], so starting with go1.16
we now have [net.ErrClosed@go1.16], so can remove the string matching.

[CL 5649076]: https://golang.org/cl/5649076
[moby@cc851db]: cc851dbb3f
[`IsClosedError`]: cc851dbb3f/utils/utils.go (L1032-L1040)
[net.errClosing@go1.1.2]: https://github.com/golang/go/blob/go1.1.2/src/pkg/net/net.go#L341
[go-4373]: https://github.com/golang/go/issues/4373
[net.ErrClosed@go1.16]: https://github.com/golang/go/blob/go1.16/src/net/net.go#L636-L645

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-08 09:58:06 +02:00
Sebastiaan van Stijn
5365f08ae2 daemon/config: make DNSConfig.DNS a netip.Addr
Modernize the field and allow using it as-is in some places, or
convert it to a string (which won't produce an error down the line).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-01 18:48:10 +02:00
Derek McGowan
f74e5d48b3 Create github.com/moby/moby/v2 module
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-31 10:13:29 -07:00
Sebastiaan van Stijn
d761d9d358 pkg/rootless: move to daemon/internal
This package is used internally by the daemon, and was only used out
side of the daemon by pkg/plugins (for which we still need to look
where it should be kept).

Making it internal because it's trivial to implement if needed by
anyone. The only reason it's a package is to keep it central, and
to make it easier to discover where we have rootlesskit-specific
codepaths in our codebase.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-28 22:04:39 +02:00
Sebastiaan van Stijn
75bc4c5292 daemon/server/router/container: request sysInfo from daemon / backend
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-28 18:32:14 +02:00
Sebastiaan van Stijn
5e567a3856 daemon/server/httputils: remove ContainerDecoder interface
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-28 18:32:14 +02:00
Sebastiaan van Stijn
be27300c6e daemon/server/router/checkpoint: remove unused httputils.ContainerDecoder
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-27 15:19:50 +02:00
Derek McGowan
c3b0e0130a Move internal/otelutil to daemon/internal/otelutil
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-24 12:14:30 -07:00
Derek McGowan
b62b542c2e Move internal/opts to daemon/internal/opts
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-24 12:14:14 -07:00
Derek McGowan
7bfb804dbe Move registry to daemon/pkg/registry
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-24 12:11:51 -07:00
Rob Murray
cf1695bef1 Add option --bridge-accept-fwmark
Packets with the given firewall mark are accepted by the bridge
driver's filter-FORWARD rules.

The value can either be an integer mark, or it can include a
mask in the format "<mark>/<mask>".

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-07-22 19:15:02 +01:00
Sebastiaan van Stijn
842b631efe Merge pull request #50436 from thaJeztah/daemon_separate_version
daemon: define default (and maximum) API version
2025-07-21 17:07:50 +02:00
Rob Murray
8c79486dab Merge pull request #50357 from robmry/firewall_backend_option
Add daemon option --firewall-backend
2025-07-17 19:21:12 +01:00
Rob Murray
39ab393274 Add daemon option --firewall-backend
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-07-17 15:12:01 +01:00
Sebastiaan van Stijn
a632b8495b daemon: define default (and maximum) API version
With the daemon and API migrating to separate modules, users of the daemon
module may upgrade the API module to higher versions. Currently, the daemon
uses the API's Default version. While the version of the API module is
allowed to be updated (following SemVer), we should not allow the Daemon
to support higher API versions than it was written for.

This patch introduces a DefaultAPIVersion in the daemon/config package that is
used as default version of the API for the daemon to use.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-17 14:35:05 +02:00
Derek McGowan
af86e80825 Move daemon/build to daemon/builder/backend
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-16 15:06:15 -07:00
Derek McGowan
7d48302134 Move builder to daemon/builder
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-16 15:06:00 -07:00
Derek McGowan
6ff9bea6a7 Move builder/builder-next to daemon/internal/builder-next
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-16 15:05:44 -07:00
Derek McGowan
7a720df61f Move libnetwork to daemon/libnetwork
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-14 09:25:23 -07:00
Derek McGowan
f05652867d Move opts to daemon/pkg/opts
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-14 09:25:05 -07:00
Sebastiaan van Stijn
0fc1493654 pkg/system: remove EnableContainerdRuntime, ContainerdRuntimeSupported
These functions were used internally to keep track of whether containerd
was enabled as runtime on Windows; move it to libcontainerd.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-12 19:16:30 +02:00
Derek McGowan
841a369b8f Move libcontainerd/supervisor to daemon/internal/libcontainerd/supervisor
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-27 14:28:40 -07:00
Derek McGowan
3581b982f7 Move plugin to daemon/pkg/plugin
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-27 14:26:33 -07:00
Derek McGowan
87238882e0 Move api/server to daemon/server
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-27 09:18:20 -07:00
Derek McGowan
3a6e3f85c6 Move api/server/backend/build to daemon/build
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-27 09:18:05 -07:00
Derek McGowan
d64bd2cceb Move api/server/middleware to daemon/server/middleware
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-27 09:17:18 -07:00
Derek McGowan
72a020fcd8 Move api/server/router to daemon/server/router
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-27 09:17:02 -07:00
Derek McGowan
f293628f55 Move api/server/router/volume to daemon/server/router/volume
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-27 09:16:46 -07:00
Derek McGowan
15c8007064 Move api/server/router/system to daemon/server/router/system
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-27 09:16:31 -07:00
Derek McGowan
45172bbf23 Move api/server/router/swarm to daemon/server/router/swarm
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-27 09:16:15 -07:00
Derek McGowan
f6ba5a5241 Move api/server/router/session to daemon/server/router/session
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-27 09:16:00 -07:00
Derek McGowan
3eb5fe0277 Move api/server/router/plugin to daemon/server/router/plugin
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-27 09:15:44 -07:00