Commit Graph

55287 Commits

Author SHA1 Message Date
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
5b60725eed Merge pull request #51719 from vvoland/api-uncut
api: remove docs/v1.53.yaml
2025-12-15 17:14:44 +00:00
Paweł Gronowski
a0bd623959 api: remove docs/v1.53.yaml
The API is not cut yet

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-12-15 17:24:53 +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
Brian Goff
2ec5bdfaf6 Merge pull request #51666 from ndeloof/swagger
simplify swagger generation
2025-12-15 08:13:20 -08: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
Rob Murray
248d33664e Merge pull request #51713 from robmry/nri-info
NRI: report config in "docker info"
2025-12-15 15:44:56 +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
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
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
Sebastiaan van Stijn
70aa2e2981 Merge pull request #51707 from thaJeztah/bump_runtime_tools
vendor: github.com/opencontainers/runtime-tools v0.9.1-0.20251111083745-e5b454202754
2025-12-12 17:10:01 +01:00
Rob Murray
10c0fc4de8 NRI: add TestNRIContainerCreateAddMount
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-12-12 14:28:49 +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
Sebastiaan van Stijn
52f33797f3 vendor: github.com/opencontainers/runtime-tools v0.9.1-0.20251111083745-e5b454202754
last commit before it updated to runtime-spec v1.3.0

full diff: 0ea5ed0382...e5b4542027

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-12-12 14:45:48 +01:00
Rob Murray
4384364748 Merge pull request #51702 from thaJeztah/bump_wazero
vendor: github.com/tetratelabs/wazero v1.10.1
2025-12-12 12:18:09 +00:00
Paweł Gronowski
0a0245a31a Merge pull request #51700 from jschfflr/45939-nil-check-tx-cleanup
layer: Fix orphan creation in registerWithDescriptor
2025-12-12 11:44:46 +00:00
Jan Scheffler
70004549fb layer: Fix orphan creation in registerWithDescriptor
Start the metadata transaction before creating the overlay2 directory.
This ensures that if driver.Create() fails, we can properly cancel the
transaction. Previously, if StartTransaction() failed after driver.Create()
succeeded, the defer cleanup would not run (not registered yet), leaving
an orphaned overlay2 directory.

The fix reorders operations so that:
1. Transaction is started first (no filesystem changes yet)
2. Overlay2 directory is created second (transaction ready for cleanup)
3. Defer is registered after both succeed (tx is guaranteed non-nil)

If driver.Create() fails, the transaction is explicitly cancelled before
returning. The nil check for tx in the defer is no longer needed since
tx is guaranteed to exist when the defer runs.

Related to moby/moby#45939

Signed-off-by: Jan Scheffler <jan.scheffler@qodev.ai>
2025-12-12 09:44:04 +00:00
Paweł Gronowski
95baac6740 Merge pull request #51697 from thaJeztah/bump_cni_plugins
vendor: github.com/containernetworking/plugins v1.9.0
2025-12-12 09:39:02 +00:00
Sebastiaan van Stijn
413b4afcba vendor: github.com/tetratelabs/wazero v1.10.1
full diff: https://github.com/tetratelabs/wazero/compare/v0.9.0...v1.10.1

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-12-12 10:33:55 +01:00
Sebastiaan van Stijn
24bac4495e vendor: github.com/containernetworking/plugins v1.9.0
no changes in vendored code

includes a fix for CVE-2025-67499

full diff: https://github.com/containernetworking/plugins/compare/v1.8.0...v1.9.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-12-12 10:27:12 +01:00
Albin Kerouanton
3cba626582 Merge pull request #50744 from dmcgowan/add-grpc-support
Natively support gRPC on the docker socket
2025-12-12 10:25:15 +01:00
Nicolas De Loof
caaa9c9bb5 simplify swagger generation
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2025-12-12 09:19:50 +01:00
Paweł Gronowski
31184e608e Merge pull request #51692 from akerouanton/remove-dead-ctrs-on-startup
daemon: clean up dead containers on start
2025-12-11 20:45:23 +00:00
Paweł Gronowski
15473075fc Merge pull request #51694 from vvoland/containerd-extra-dial-opts
daemon: use WithExtraDialOpts for containerd client connection
2025-12-11 20:41:57 +00:00
Sebastiaan van Stijn
70298eb5b8 Merge pull request #51300 from rafaelcamelo31/50486_api_move_scripts
api: move scripts to generate and validate swagger to api module
2025-12-11 21:35:38 +01:00
Sebastiaan van Stijn
664c651a51 Merge pull request #51640 from AkihiroSuda/rm-dockerfile-install
rm -r hack/dockerfile/install
2025-12-11 21:08:15 +01:00
Paweł Gronowski
96fa55d054 Merge pull request #51416 from vvoland/fix-lima
gha/vm: Adjust lima template locators
2025-12-11 20:00:19 +00:00
Sebastiaan van Stijn
c266fc1b88 Merge pull request #51660 from corhere/doc/v25-eom
project: add End-of-maintenance date for 25.0
2025-12-11 20:51:49 +01:00
Albin Kerouanton
ec9315cd4f daemon: clean up dead containers on start
Stopping the Engine while a container with autoremove set is running may
leave behind dead containers on disk. These containers aren't reclaimed
on next start, appear as "dead" in `docker ps -a` and can't be
inspected or removed by the user.

This bug has existed since a long time but became user visible with
9f5f4f5a42. Prior to that commit,
containers with no rwlayer weren't added to the in-memory viewdb, so
they weren't visible in `docker ps -a`. However, some dangling files
would still live on disk (e.g. folder in /var/lib/docker/containers,
mount points, etc).

The underlying issue is that when the daemon stops, it tries to stop all
running containers and then closes the containerd client. This leaves a
small window of time where the Engine might receive 'task stop' events
from containerd, and trigger autoremove. If the containerd client is
closed in parallel, the Engine is unable to complete the removal,
leaving the container in 'dead' state. In such case, the Engine logs the
following error:

    cannot remove container "bcbc98b4f5c2b072eb3c4ca673fa1c222d2a8af00bf58eae0f37085b9724ea46": Canceled: grpc: the client connection is closing: context canceled

Solving the underlying issue would require complex changes to the
shutdown sequence. Moreover, the same issue could also happen if the
daemon crashes while it deletes a container. Thus, add a cleanup step
on daemon startup to remove these dead containers.

Signed-off-by: Albin Kerouanton <albin.kerouanton@docker.com>
2025-12-11 13:40:23 -06:00
Paweł Gronowski
849afcc5be daemon: use WithExtraDialOpts for containerd client connection
Replace WithDialOpts with WithExtraDialOpts when creating containerd
clients to preserve the containerd client's default dial options while
adding our custom options.

Previously, using WithDialOpts would overwrite all of containerd's
default dial options, requiring us to sync them.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-12-11 20:26:08 +01:00
Paweł Gronowski
8dd2c72fb6 gha/vm: Update lima template locators
Fixes warning:
```
time="2025-11-06T11:22:30Z" level=warning msg="Template locator \"template://oraclelinux-8\" should be written \"template:oraclelinux-8\" since Lima v2.0"
```

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-12-11 19:55:22 +01:00
Paweł Gronowski
c84610c967 Merge pull request #51686 from vvoland/dev
Makefile: Add simple dev loop
2025-12-11 14:30:07 +00:00
Paweł Gronowski
786ec62b92 Merge pull request #51688 from vvoland/fix-branch-check
gha: Fix PR branch validation
2025-12-11 14:27:10 +00:00
Paweł Gronowski
5ce3964834 Merge pull request #51683 from thaJeztah/fix_nil_map
daemon: buildCreateEndpointOptions: fix panic with "publish all"
2025-12-11 14:19:34 +00:00
Paweł Gronowski
c74203adbb gha: Fix PR branch validation
Make it work with `docker-XYZ` branches.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-12-11 15:17:25 +01:00
Rafael Camelo
0666108ebf api: move scripts to generate and validate swagger to api module
Signed-off-by: Rafael Camelo <rafaelcamelo31@gmail.com>

revert api/swagger.yaml to undo formatting

Signed-off-by: Rafael Camelo <rafaelcamelo31@gmail.com>

refactor(api): update Dockerfile and Makefile with newline at the EOF and use current best practices

Signed-off-by: Rafael Camelo <rafaelcamelo31@gmail.com>

refactor validations and swagger generation flow

Signed-off-by: Rafael Camelo <rafaelcamelo31@gmail.com>

shfmt

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
Signed-off-by: Rafael Camelo <rafaelcamelo31@gmail.com>

refactor generate-swagger-api.sh to use absolute path

Signed-off-by: Rafael Camelo <rafaelcamelo31@gmail.com>

add validate-api-swagger job for GitHub Actions

Signed-off-by: Rafael Camelo <rafaelcamelo31@gmail.com>

fix validate-api-swagger ci workflow

Signed-off-by: Rafael Camelo <rafaelcamelo31@gmail.com>

update go version and redoc in api module

Signed-off-by: Rafael Camelo <rafaelcamelo31@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-12-11 15:16:47 +01:00
Paweł Gronowski
a97b330c6c Makefile: Add simple dev loop
Add a `dev` target which adds a convenient developer loop which
rebuilds and reruns the daemon after a SIGINT is received.

It can be exited by sending SIGINT (Ctrl+C) a couple times.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-12-11 14:37:10 +01:00
Sebastiaan van Stijn
a11c3b9a89 Merge pull request #51684 from akerouanton/disallow-ctr-port-0
daemon: disallow container port 0
2025-12-11 14:07:59 +01:00
Sebastiaan van Stijn
2a191665b8 daemon/container: Container.BackfillEmptyPBs: prevent nil map
Make sure PortBindings is not a nil-map to match the behavior
we have when creating a container;
c64b781df2/daemon/internal/runconfig/config.go (L30-L47)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-12-11 12:09:32 +01:00
Albin Kerouanton
43780fe40c daemon: disallow container port 0
Signed-off-by: Albin Kerouanton <albin.kerouanton@docker.com>
2025-12-11 11:07:42 +01:00
Sebastiaan van Stijn
695010ba2e daemon: buildCreateEndpointOptions: fix panic with "publish all"
This code was added in 85b260fba8, but didn't
account for maps.Clone returning a `nil` map if the map cloned was `nil`.

This could lead to a panic, similar to the panic that was fixed in
7517464283d29969c4d3615397b369abd99ce395;

    panic: assignment to entry in nil map

    goroutine 498 [running]:

    github.com/moby/moby/v2/daemon.buildPortsRelatedCreateEndpointOptions(0x400042f348, 0xaaaabcc8f458?, 0x40006feb40)
        /root/build-deb/engine/daemon/network.go:1047 +0x844
    github.com/moby/moby/v2/daemon.buildCreateEndpointOptions(0x400042f348, 0x4001015040, 0x400027d320, 0x40006feb40, {0x0, 0x0, 0x4001506cb8?})
        /root/build-deb/engine/daemon/network.go:988 +0x20c
    github.com/moby/moby/v2/daemon.(*Daemon).connectToNetwork(0x4000898008, {0xaaaabe21d9f8, 0x4000f12b10}, 0x400089a008, 0x400042f348, {0x400077a9f0, 0x6}, 0x400027d320)
        /root/build-deb/engine/daemon/container_operations.go:738 +0x66c
    github.com/moby/moby/v2/daemon.(*Daemon).allocateNetwork(0x4000898008, {0xaaaabe21d9f8, 0x4000f12b10}, 0x400089a008, 0x400042f348)
        /root/build-deb/engine/daemon/container_operations.go:421 +0x298
    github.com/moby/moby/v2/daemon.(*Daemon).initializeCreatedTask(0x4000898008, {0xaaaabe21d9f8, 0x4000f12b10}, 0x400089a008, {0xaaaabe23dc60, 0x4000eb21c8}, 0x400042f348, 0xaaaabd4db3df?)
        /root/build-deb/engine/daemon/start_linux.go:37 +0x260
    github.com/moby/moby/v2/daemon.(*Daemon).containerStart(0x4000898008, {0xaaaabe21d9c0, 0xaaaabfa05300}, 0x400089a008, 0x400042f348, {0x0, 0x0}, {0x0, 0x0}, 0x1)
        /root/build-deb/engine/daemon/start.go:242 +0xba8
    github.com/moby/moby/v2/daemon.(*Daemon).restore.func4(0x400042f348, 0x400117f1f0)
        /root/build-deb/engine/daemon/daemon.go:633 +0x308
    created by github.com/moby/moby/v2/daemon.(*Daemon).restore in goroutine 1
        /root/build-deb/engine/daemon/daemon.go:607 +0x5ec

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-12-11 10:11:15 +01:00
Rob Murray
8cf9e64738 NRI: report container state to plugins
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-12-10 17:49:28 +00:00