9916 Commits

Author SHA1 Message Date
Sebastiaan van Stijn
48f81c3782 Merge pull request #51828 from vvoland/windows-network-none
daemon/libnetwork: Fix panic in findHNSEp when IP networks are nil
2026-01-08 17:34:36 +01:00
Paweł Gronowski
fadd8dc47c daemon/libnetwork: Fix panic in findHNSEp when IP networks are nil
Can happen for `docker run --network none ...`

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2026-01-08 15:01:10 +01:00
Paweł Gronowski
cb88c6ba10 daemon/volumes: More fs friendly image mount layer names
Hash the container ID, mount source and destination together to form a
layer name.

This ensures the generated names are filesystem-friendly and don't
exceed path length limits while maintaining uniqueness across different
mount points and containers.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2026-01-08 12:20:47 +01:00
Sebastiaan van Stijn
07e2a782c7 libnet/internal/resolvconf: Parse: improve error message
When attempting to read a (malformed) resolv.conf with a very long line,
a obscure error would be produced that didn't provide much context to
identify the problem;

    Handler for POST /v1.51/containers/mariadb11/start returned error: bufio.Scanner: token too long

This patch adds some additional error-handling to detect this situation,
and includes the filename of the resolv.conf to help the user locating
the file that failed to be parsed.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-01-06 14:43:51 +01:00
Paweł Gronowski
0da7c60458 Merge pull request #51804 from thaJeztah/no_shadow
daemon: minor cleanup and linting fixes
2026-01-05 14:19:12 +00:00
Sebastiaan van Stijn
d85c1a258a daemon/server/httputils: remove badParameterError
The "param" field was only used to generate the error-message, and the
produced error-message was missing a space so we may as well just inline it.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-01-05 13:51:59 +01:00
Sebastiaan van Stijn
dcb0149ee1 daemon: inline copyAttributes utilty
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-01-05 12:42:49 +01:00
Sebastiaan van Stijn
8a01dc2f90 daemon/cluster/executor/container: rename vars that shadowed
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-01-05 12:42:49 +01:00
jinda.ljd
5c637b7209 fix: prevent potential panic in Shutdown when EventsService is nil
Add nil check before calling EventsService.Close() to prevent panic
when daemon.EventsService is not initialized during shutdown.

Signed-off-by: jinda.ljd <jinda.ljd@alibaba-inc.com>
2025-12-30 20:19:09 +08:00
Sebastiaan van Stijn
7239c72eca remove uses of deprecated go-archive consts
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-12-19 17:51:03 +01:00
Paweł Gronowski
1175dd348e daemon/volume/mounts: Fix tests on Windows
The test was failing on Windows because it used Unix-style paths and
relied on platform-specific filesystem behavior.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-12-19 12:42:43 +01:00
Shane St Savage
beeacde4b2 Remove restriction on anonymous read-only volumes
Restriction on anonymouse read-only volumes is currently preventing
the use of pre-populated volumes that should be accessed in a read-only manner in a container
(e.g. an NFS volume containing data to be processed or served).

According to @neersighted the restriction may have originally been put
in place with the assumption that pre-populated volumes would be
exposed as a named volume by the volume driver.

In practice, NFS volumes are mounted using the docker `local` driver
by supplying driver opts. Example that fails when `readonly` is specified but works without:

```
docker run --rm -it \
 --mount 'readonly,type=volume,dst=/data/dest,volume-driver=local,volume-opt=type=nfs,volume-opt=device=:/export/some-share,"volume-opt=o=nfsvers=4,addr=some.server"' \
  debian
```

Fixes #45297

Signed-off-by: Shane St Savage <shane@axds.co>
2025-12-18 16:08:31 -08:00
Sebastiaan van Stijn
4b4223a8d4 vendor: github.com/opencontainers/runtime-spec v1.3.0
This includes a breaking change in pids.Limit changing to a pointer.

full diff: https://github.com/opencontainers/runtime-spec/compare/v1.2.1...v1.3.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-12-18 19:55:56 +01:00
Sebastiaan van Stijn
32190e99a3 Merge pull request #51624 from AkihiroSuda/fix-51601
cdi: read XDG_CONFIG_HOME/cdi and XDG_RUNTIME_DIR/cdi for rootless
2025-12-17 16:27:13 +01:00
Sebastiaan van Stijn
614d9b966f daemon/libnetwork/options: GenerateFromModel: remove redundant check
This check was added in 14c5cd377d to prevent
passing `nil` as type (`GenerateFromModel[nil](....)`), however, `nil` is not
a type, so trying to do so won't compile. Even if it would, it would be
theoretical at best, so let's just remove it.

fix linting:

    daemon/libnetwork/options/options.go:57:13: SA4023(related information): the lhs of the comparison is the 1st return value of this function call (staticcheck)
        modType := reflect.TypeFor[T]()
                   ^
    daemon/libnetwork/options/options.go:58:5: SA4023: this comparison is never true (staticcheck)
        if modType == nil {
           ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-12-17 14:19:53 +01:00
Sebastiaan van Stijn
e9dec9893f Merge pull request #51715 from jschfflr/45939-init-layer-cleanup
layer: Clean up init layer if initialization fails
2025-12-17 13:05:50 +01:00
Nicolas De Loof
aef5d996ce use mime-type application/jsonl to align with openapi 3.2
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-12-17 11:37:48 +01:00
Paweł Gronowski
26bb1af7e6 daemon/layer_store: Use named return error for defer
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-12-17 11:31:08 +01:00
Sebastiaan van Stijn
1f498c5ff0 fix linting issues
Some false positives from gosec (G602: slice index out of range)

    integration-cli/daemon/daemon.go:109:1: deprecatedComment: `Deprecated: ` notices should be in a dedicated paragraph, separated from the rest (gocritic)
    // Deprecated: use cli.WaitCmd instead
    ^
    integration-cli/docker_cli_build_test.go:562:3: dupOption: function argument `build.WithFile("test_file3", "test3")` is duplicated (gocritic)
            build.WithFile("test_file3", "test3"),
            ^
    integration-cli/docker_utils_test.go:250:1: deprecatedComment: `Deprecated: ` notices should be in a dedicated paragraph, separated from the rest (gocritic)
    // Deprecated: use cli.WaitFor
    ^
    daemon/libnetwork/ipams/defaultipam/address_space.go:45:39: G602: slice index out of range (gosec)
            if predefined[j].Overlaps(predefined[i].Base) {
                                                ^
    daemon/libnetwork/ipams/defaultipam/address_space.go:49:29: G602: slice index out of range (gosec)
            predefined[j] = predefined[i]
                                      ^
    daemon/libnetwork/libnetwork_linux_test.go:1492:9: G602: slice index out of range (gosec)
            sboxes[thd-1], err = controller.NewSandbox(context.Background(), fmt.Sprintf("%drace", thd))
                  ^
    daemon/libnetwork/networkdb/cluster_test.go:111:21: G602: slice index out of range (gosec)
                mean, stdev := nf[0], nf[1]
                                 ^
    daemon/libnetwork/osl/interface_linux.go:586:54: G602: slice index out of range (gosec)
                log.G(ctx).WithField("portState", stateFileContent[0]).Debug("waiting for bridge port to be forwarding")
                                                                  ^
    daemon/libnetwork/osl/interface_linux.go:594:32: G602: slice index out of range (gosec)
            "portState": stateFileContent[0],
                                         ^
    daemon/libnetwork/portallocator/osallocator_linux_test.go:358:13: G602: slice index out of range (gosec)
            if payload[0] != 0x1 {
                      ^
    daemon/libnetwork/portallocator/osallocator_linux_test.go:359:68: G602: slice index out of range (gosec)
                readCh <- fmt.Errorf("expected payload 0x1, but got %x", payload[0])
                                                                                ^
    daemon/logger/gelf/gelf_test.go:197:9: nilness: impossible condition: nil != nil (govet)
        if err != nil {
               ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-12-16 16:55:20 +01:00
Sebastiaan van Stijn
1cce55d3a4 Merge pull request #51714 from jschfflr/45939-rw-layer-cleanup
layer: Clean up RW layer if mount metadata save fails
2025-12-16 15:01:54 +01:00
Paweł Gronowski
1489cb3ae0 Merge pull request #51722 from vvoland/modernize
Modernize Go code
2025-12-16 12:38:36 +00:00
Paweł Gronowski
5d716f20a3 Merge pull request #51721 from vvoland/deprecate-grpc
api: deprecate /grpc and /session endpoints
2025-12-16 12:34:55 +00:00
Paweł Gronowski
0ae3f972ad daemon: Simplify slices.Contains usage
Remove unnecessary intermediate variables and helper functions when
using slices.Contains.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-12-16 13:31:33 +01:00
Rob Murray
25fbe6cd43 Merge pull request #51725 from robmry/max-api-1.53
Update client MaxAPIVersion to 1.53
2025-12-16 11:14:41 +00:00
Rob Murray
1e209e788b Continue to backfill empty PortBindings in API 1.53
- introduced by commit 0ca7ac3 ("daemon: backfill empty PBs
  slices for backward compat")

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-12-16 11:03:58 +00:00
Paweł Gronowski
51d1974500 daemon/cluster/test: Use t.Context()
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-12-15 18:56:34 +01:00
Paweł Gronowski
6c5233e109 modernize: Use strings.CutSuffix
Added in Go 1.20

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-12-15 18:56:34 +01:00
Paweł Gronowski
71fd582aa2 modernize: Use strings.Builder instead of string concatenation
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-12-15 18:56:34 +01:00
Paweł Gronowski
62ed24a87c modernize: Use slices.Contains
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-12-15 18:56:34 +01:00
Paweł Gronowski
bce14ac5bc reflect: Use TypeFor instead of TypeOf
Added in Go 1.22

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-12-15 18:56:34 +01:00
Paweł Gronowski
3df05205f4 modernize: Use range int
Added in Go 1.22

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-12-15 18:56:34 +01:00
Paweł Gronowski
e548a31d28 modernize: Use min built-in
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-12-15 18:56:34 +01:00
Paweł Gronowski
39c19d9161 modernize: Use fmt.Appendf
Added in Go 1.19

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-12-15 18:56:33 +01:00
Paweł Gronowski
cdce8f4f92 modernize: Use maps.Copy instead of for loops
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-12-15 18:56:33 +01:00
Paweł Gronowski
ff33808a79 modernize: Use strings.Cut instead of strings.Index where possible
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-12-15 18:56:33 +01:00
Paweł Gronowski
a25907b485 modernize: Prefer strings.SplitSeq instead of Split
Avoids extra allocations. Added in Go 1.24.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-12-15 18:56:33 +01:00
Paweł Gronowski
c9b0a21bb1 modernize: Use b.Loop (introduced in Go 1.24)
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-12-15 18:56:33 +01:00
Rob Murray
239a49d403 Merge pull request #51711 from robmry/nri-config-reload
NRI: config reload
2025-12-15 17:51:27 +00:00
Paweł Gronowski
f44b5abf0e api: deprecate /grpc and /session endpoints
The /grpc and /session endpoints are now deprecated as the Engine has
been upgraded to properly support HTTP/2 and h2c requests, making these
specialized endpoints unnecessary.

These endpoints will be removed in the next major API version to
complete the cleanup.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-12-15 18:44:22 +01:00
Rob Murray
425f23995d Merge pull request #51712 from robmry/nri-error-on-unsupported-adjustment
NRI: error on unsupported adjustment
2025-12-15 16:21:31 +00:00
Paweł Gronowski
82c35087d0 Merge pull request #51717 from vvoland/c8d-errs-log
daemon/c8d: Log correct error extractOCIErrors
2025-12-15 16:12:37 +00:00
Paweł Gronowski
53c67be034 daemon/c8d: Log correct error extractOCIErrors
When logging an unmarshal failure in the registry error handling code,
the function was incorrectly logging the uninitialized `derrs` variable
instead of the actual JSON unmarshal error `jerr`.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-12-15 15:56:44 +01:00
Rob Murray
98d196b714 NRI: error on unsupported adjustment
Also error on eviction requests.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-12-15 14:08:02 +00:00
Rob Murray
ff553c5069 NRI: make config reloadable
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-12-15 13:59:09 +00:00
Jan Scheffler
3fdde529e7 layer: Clean up init layer if initialization fails
Add cleanup for the init layer directory if any operation fails after
driver.CreateReadWrite() succeeds in initMount(). Previously, failures
in driver.Get(), initFunc(), or driver.Put() would leave an orphaned
overlay2 directory.

Related to moby/moby#45939

Signed-off-by: Jan Scheffler <jan.scheffler@qodev.ai>
2025-12-15 11:06:56 +00:00
Rob Murray
7c7a626e5d NRI: include in API Info response
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-12-15 10:36:05 +00:00
Rob Murray
f6b1488468 Bump API to v1.53
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-12-15 09:45:21 +00:00
Jan Scheffler
d7a6250b91 layer: Clean up RW layer if mount metadata save fails
Add cleanup for the RW layer directory if saveMount() fails after
driver.CreateReadWrite() succeeds. Previously, this failure path would
leave an orphaned overlay2 directory with no corresponding metadata.

Related to moby/moby#45939

Signed-off-by: Jan Scheffler <jan.scheffler@qodev.ai>
2025-12-12 23:03:08 +00:00
Rob Murray
0c01da8ccc Merge pull request #51675 from robmry/nri-mounts
NRI: allow plugins to add mounts
2025-12-12 18:37:29 +00:00
Rob Murray
a30301b28d NRI: allow plugins to add mounts
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-12-12 14:28:49 +00:00