Commit Graph

303 Commits

Author SHA1 Message Date
Austin Vazquez
c646091d57 api: move container port type to network package
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-03 17:30:42 -05:00
Cory Snider
d5c838dc5e internal: move sliceutil from daemon/internal
These utilities are very handy to use in integration tests, too. Move
the package so it can be imported by them.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-10-03 21:39:14 +02:00
Cory Snider
a90adb6dc1 api/types/network: use netip types as appropriate
And generate the ServiceInfo struct from the Swagger spec.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-10-03 21:39:14 +02:00
Cory Snider
cc082add87 api/types/swarm: use netip types as appropriate
Change the types for IP address and prefix struct fields to netip.Addr
and netip.Prefix for convenience. Fields such as
swarm.InitRequest.ListenAddr which may encode non-numeric values such as
a network interface name have not been modified.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-10-03 21:39:13 +02:00
Austin Vazquez
4279e522e1 Merge pull request #50710 from austinvazquez/define-network-port-types
api: add container network port types
2025-10-02 17:43:58 -07:00
Austin Vazquez
cb3abacc52 api/types/container: add network port and port range types
Co-authored-by: Sebastiaan van Stijn <github@gone.nl>
Co-authored-by: Cory Snider <csnider@mirantis.com>
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-02 13:59:34 -05:00
Paweł Gronowski
4181d934be Merge pull request #50869 from vvoland/c8d-fix-windows-migration
daemon: Fix unwanted c8d migration on Windows
2025-09-25 11:13:39 +00:00
Sebastiaan van Stijn
e98849831f Merge pull request #51021 from robmry/setuposcontext_leaks
testutil:SetupTestOSContext - fix ns/netlink handle leaks
2025-09-23 21:03:48 +02:00
Rob Murray
de5e64b3bd Add option WithSetNsHandles for testutil SetupTestOSContextEx
Allow tests to run in parallel with separate network namespaces,
without modifying the global-state namespace/netlink handles in
the "ns" package ... only useful for tests that don't depend on
package "ns".

Use the new option in iptabler/nftabler tests.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-09-23 17:35:58 +01:00
Rob Murray
362d4d9538 testutil:SetupTestOSContext - don't leak namespaces, netlink handles
SetupTestOSContextEx calls 'ns.Init' (which, outside tests, is protected
by a sync.Once), and it's called again by the returned OSContext.Cleanup
method. That overwrites the ns package's namespace and netlink handles
(initNs and initNl) without closing them.

Because SetupTestOSContextEx changes that shared state, it should not
be used in parallel tests. So, rather than trying to close the handles
in ns.Init if already open - un-export Init so it's always called via
its sync.Once, and add a reset function for tests to use. Have
SetupTestOSContextEx claim a mutex to avoid crashy surprises or
hard to catch issues where the ns package isn't using the expected
namespace if it is used in parallel tests.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-09-23 16:16:00 +01:00
Sebastiaan van Stijn
ee4b7a8374 daemon/container: remove NewState() constructor
This constructor did not do anything other than creating an empty struct
for an exported type. While we should look at initializing with a proper
state, we currently do not, so let's not pretend we do some magic here,
and leave it for a future exercise to create a proper constructor if we
need one.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-19 15:33:36 +01: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
Cory Snider
65ffac3dbf internal/iterutil: add Chain, Chain2 iterators
Add utilities to concatenate multiple iterators of the same type into a
single iterator.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-09-10 11:00:34 -04:00
Paweł Gronowski
f8925bac6f daemon: Do not default to c8d image store on Windows
Before this commit migration to c8d would apply when
`TEST_INTEGRATION_USE_GRAPHDRIVER` is empty/unset (which is the default
scenario).

This caused fresh Windows installations to default to containerd image
store and panic:

```
PS C:\Users\Administrator\Desktop> .\dockerd.exe --debug
time="2025-09-01T12:45:42.182741200Z" level=info msg="Starting up"
time="2025-09-01T12:45:42.225128900Z" level=debug msg="Listener created for HTTP on npipe (//./pipe/docker_engine)"
time="2025-09-01T12:45:42.231740900Z" level=info msg="OTEL tracing is not configured, using no-op tracer provider"
time="2025-09-01T12:45:42.263475300Z" level=info msg="Windows default isolation mode: process"
time="2025-09-01T12:45:42.263475300Z" level=debug msg="Stackdump - waiting signal at Global\\stackdump-7780"
time="2025-09-01T12:45:42.273230800Z" level=debug msg="Using default logging driver json-file"
time="2025-09-01T12:45:42.273230800Z" level=debug msg="No quota support for local volumes in C:\\ProgramData\\docker\\volumes: Filesystem does not support, or has not enabled quotas"
time="2025-09-01T12:45:42.301881100Z" level=info msg="Loading containers: start."
time="2025-09-01T12:45:42.302302800Z" level=info msg="[graphdriver] trying configured driver: windowsfilter"
time="2025-09-01T12:45:42.302302800Z" level=debug msg="WindowsGraphDriver InitFilter at C:\\ProgramData\\docker\\windowsfilter"
time="2025-09-01T12:45:42.303028000Z" level=debug msg="Initialized graph driver windowsfilter"
time="2025-09-01T12:45:42.323007600Z" level=info msg="Enabling containerd snapshotter because migration set with no containers and 0 images in graph driver" total=0
time="2025-09-01T12:45:42.323007600Z" level=info msg="Starting daemon with containerd snapshotter integration enabled"
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x88 pc=0x16522c4]

goroutine 1 [running]:
github.com/containerd/containerd/v2/client.(*Client).IntrospectionService(0x3153e60?)
        /go/src/github.com/docker/docker/vendor/github.com/containerd/containerd/v2/client/client.go:731 +0x24
github.com/moby/moby/v2/daemon.NewDaemon({0x3153e60, 0xc0001360f0}, 0xc0000fa008, 0xc00025c5a0, 0xc0002deee0)
        /go/src/github.com/docker/docker/daemon/daemon.go:1276 +0x35ad
github.com/moby/moby/v2/daemon/command.(*daemonCLI).start(0xc0000da320, {0x3153df0, 0x4704c60})
        /go/src/github.com/docker/docker/daemon/command/daemon.go:262 +0xa09
github.com/moby/moby/v2/daemon/command.runDaemon({0x3153df0, 0x4704c60}, 0xc0000da320)
        /go/src/github.com/docker/docker/daemon/command/docker_windows.go:28 +0x8a
github.com/moby/moby/v2/daemon/command.newDaemonCommand.func1(0xc000147508, {0xc000500f60?, 0x7?, 0x2cf8c90?})
        /go/src/github.com/docker/docker/daemon/command/docker.go:45 +0xd1
github.com/spf13/cobra.(*Command).execute(0xc000147508, {0xc00006a0f0, 0x1, 0x1})
        /go/src/github.com/docker/docker/vendor/github.com/spf13/cobra/command.go:1015 +0xaaa
github.com/spf13/cobra.(*Command).ExecuteC(0xc000147508)
        /go/src/github.com/docker/docker/vendor/github.com/spf13/cobra/command.go:1148 +0x46f
github.com/spf13/cobra.(*Command).Execute(...)
        /go/src/github.com/docker/docker/vendor/github.com/spf13/cobra/command.go:1071
github.com/spf13/cobra.(*Command).ExecuteContext(...)
        /go/src/github.com/docker/docker/vendor/github.com/spf13/cobra/command.go:1064
github.com/moby/moby/v2/daemon/command.daemonRunner.Run({0x3127160?}, {0x3153df0, 0x4704c60})
        /go/src/github.com/docker/docker/daemon/command/docker.go:111 +0x6e
main.main()
        /go/src/github.com/docker/docker/cmd/dockerd/main.go:38 +0x122
```

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-09-09 18:24:50 +02:00
Sebastiaan van Stijn
4b230a4909 internal/testutils: merge with internal/testutil
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-08 10:08:35 +02:00
Sebastiaan van Stijn
d3e45f8743 testutil: move back to internal
This package was originally internal, but was moved out when BuildKit
used it for its integration tests. That's no longer the case, so we
can make it internal again.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-08 10:08:30 +02:00
Matthieu MOREL
96f8c6395e chore: enable use-any rule from revive
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-08-08 17:07:07 +02:00
Sebastiaan van Stijn
8c5c253b50 Merge pull request #50590 from thaJeztah/update_github_links
update github and pkg.go.dev links
2025-08-01 10:17:29 +02:00
Sebastiaan van Stijn
c98e5cb60b update github links to moby/moby
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-01 01:48:55 +02:00
Sebastiaan van Stijn
cf15d5bbc6 remove obsolete //go:build tags
These are no longer needed as these are now part of a module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-01 00:49:22 +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
Derek McGowan
6514282136 Move internal/testutils/networking to integration/internal/testutils/networking
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-24 12:16:06 -07:00
Derek McGowan
14eb2770b9 Move internal/unshare to daemon/internal/unshare
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-24 12:15:50 -07:00
Derek McGowan
28de87fb28 Move internal/unix_noeintr to daemon/internal/unix_noeintr
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-24 12:15:34 -07:00
Derek McGowan
5b913b3ea0 Move internal/sliceutil to daemon/internal/sliceutil
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-24 12:15:19 -07:00
Derek McGowan
20cc1a6203 Move internal/rootless to daemon/internal/rootless
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-24 12:15:02 -07:00
Derek McGowan
8042010175 Move internal/platform to daemon/internal/platform
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-24 12:14:46 -07: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
713d7f5ed1 Move internal/nlwrap to daemon/libnetwork/nlwrap
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-24 12:13:58 -07:00
Derek McGowan
fd21e3b935 Move internal/multierror to daemon/internal/multierror
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-24 12:13:42 -07:00
Derek McGowan
baea1c5092 Move internal/ioutils to daemon/internal/ioutils
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-24 12:13:26 -07:00
Derek McGowan
50743e3f38 Move internal/containerfs to daemon/internal/containerfs
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-24 12:13:10 -07:00
Derek McGowan
ca9c4dffb7 Move internal/cleanups to daemon/internal/cleanups
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-24 12:12:54 -07:00
Derek McGowan
222b2b8b2f Move internal/lazyregexp to daemon/internal/lazyregexp
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-24 12:12:38 -07:00
Cory Snider
4538a1de0a libnetwork: handle coalesced endpoint events
The eventually-consistent nature of NetworkDB means we cannot depend on
events being received in the same order that they were sent. Nor can we
depend on receiving events for all intermediate states. It is possible
for a series of entry UPDATEs, or a DELETE followed by a CREATE with the
same key, to get coalesced into a single UPDATE event on the receiving
node. Watchers of NetworkDB tables therefore need to be prepared to
gracefully handle arbitrary UPDATEs of a key, including those where the
new value may have nothing in common with the previous value.

The libnetwork controller naively handled events for endpoint_table
assuming that an endpoint leave followed by a rejoin of the same
endpoint would always be expressed as a DELETE event followed by a
CREATE. It would handle a coalesced UPDATE as a CREATE, adding a new
service binding without removing the old one. This would
have various side effects, such as having the "transient state" of
having multiple conflicting service bindings where more than one
endpoint is assigned an IP address never settling.

Modify the libnetwork controller to handle an UPDATE by removing the
previous service binding then adding the new one.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-07-22 11:51:18 -04:00
Sebastiaan van Stijn
b33b4bd290 internal/testutils/networking: rm uses of lazyregexp
It's not needed for test-utilities.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-21 21:24:13 +02:00
Derek McGowan
eab076f217 Gocompat tests no longer needed with go modules
These tests don't account well for submodules and are not needed when
importers are using go modules. The tests are still relevant in the 28
branch which does not use go modules.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-21 09:29:18 -07:00
Austin Vazquez
fb99e3375d Merge pull request #50464 from thaJeztah/rm_pkg_platform_leftovers
internal/platform: remove NumProcs() stub for Linux
2025-07-21 08:18:33 -07:00
Rob Murray
3385489aef Merge pull request #50360 from robmry/nftables_with_firewalld
Nftables with firewalld
2025-07-21 14:25:25 +01:00
Sebastiaan van Stijn
0433def57d internal/platform: remove NumProcs() stub for Linux
Follow-up to 04618dfc0b, which removed
the pkg/platform package, but forgot to remove the stub.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-21 13:07:14 +02:00
Rob Murray
02d7a3026a Support nftables+firewalld
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-07-21 11:36:32 +01:00
Austin Vazquez
f776cd6922 Merge pull request #50367 from dmcgowan/move-volume-daemon
Move volume under daemon
2025-07-17 14:21:06 -07:00
Austin Vazquez
535c2bc6b7 Merge pull request #50429 from dmcgowan/detangle-testutil-imports
Move testutils image load to integration internal
2025-07-16 18:32:57 -07:00
Derek McGowan
b54bde4376 Move testutils image load to integration internal
The image load is only used by integration tests but the specialimage
testutils package used by many different tests. The image load relies on
the client which creates a transitive client dependency from the daemon
packages.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-16 16:15:27 -07:00
Derek McGowan
b83f36877f Move internal/mod to daemon/internal/builder-next/worker/mod
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-16 15:06:31 -07:00
Derek McGowan
17d5f731f1 Move internal/safepath to daemon/volume/safepath
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-15 10:45:47 -07:00
Derek McGowan
7edd7c68b1 Move internal/mounttree to daemon/internal/mounttree
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-15 10:45:31 -07:00
Derek McGowan
daeaac0d3c Move internal/directory to daemon/internal/directory
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-15 10:45:15 -07:00
Derek McGowan
3b5f7c2a29 Move internal/modprobe to daemon/libnetwork/internal/modprobe
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-14 09:25:55 -07:00