Commit Graph

55170 Commits

Author SHA1 Message Date
Sebastiaan van Stijn
e59d1b4563 libnetwork/drivers/overlay: DiscoverNew: move logic to setKeys, updateKeys
Make the DiscoverNew switch only responsible for asserting the correct
data type, and push the conversion logic into the setKeys and updateKeys
methods.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-16 23:36:04 +01:00
Sebastiaan van Stijn
f40b45ca1f libnetwork/drivers/overlay: use structured logs in some places
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-16 23:36:04 +01:00
Sebastiaan van Stijn
c9f0314f21 libnetwork: controller.handleKeyChange: slight cleanup of logs
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-16 23:36:03 +01:00
Sebastiaan van Stijn
a03d6bd071 Merge pull request #51536 from locnnil/patch-1
Dockerfile: update cli to v29.0.1
2025-11-16 23:33:24 +01:00
Sebastiaan van Stijn
cf7cc93529 Merge pull request #51498 from 2003Aditya/TestAPIImagesDelete
Test api images delete
2025-11-16 23:04:06 +01:00
Sebastiaan van Stijn
029770595d integration-cli: remove TestVolumeCLINoArgs
This test was only testing behavior of the CLI itself (or even basic
functionality provided by Cobra).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-16 21:21:56 +01:00
Sebastiaan van Stijn
9ab033cc8a client: TestTLSCloseWriter: assorted cleanups / fixes
- close idle connections after test
- don't discard failures to write upgrade response
- ignore errors in defer to make the linters happy

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-16 20:56:12 +01:00
Rob Murray
96b8f9c8ca Daemon.createContainerOSSpecificSettings - remove redundant param
Also:
- remove the hostConfig param from Daemon.createContainerVolumesOS.
- rename var container -> ctr

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-11-16 18:25:42 +00:00
Rob Murray
33032b0454 Daemon.setSecurityOptions: remove redundant param
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-11-16 18:25:06 +00:00
Rob Murray
34925e5be9 Remove Daemon.setHostConfig
The container's constructor, Daemon.newContainer, already has
hostConfig and can just assign it directly.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-11-16 18:25:06 +00:00
Rob Murray
22c5c78bfb Move Daemon.registerMountPoints out of Daemon.setHostConfig
Call registerMountPoints after the rest of the container's
configuration has been set up.

This will make it possible to call an NRI plugin with the
container's config, allowing it to adjust the mounts in that
config, before it's used to find volumes etc.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-11-16 18:25:06 +00:00
Rob Murray
48709e502f Split OS-specific container config and volume creation
Daemon.createContainerOSSpecificSettings adds container config for
the OS, and creates volumes. Split those two things.

This will make it possible to call an NRI plugin after the config
is complete, before volumes are created - so the NRI plugin can
adjust a full set of config, including volumes.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-11-16 18:20:12 +00:00
Rob Murray
4434236088 Daemon.setHostConfig - don't set default network mode
It's set later in Daemon.create, setHostConfig's only caller.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-11-16 18:20:12 +00:00
Rob Murray
e757bbb4ea Move call to Daemon.registerLinks out of Daemon.setHostConfig
The call from Daemon.create -> Daemon.setHostConfig acquired
container.Lock, but didn't need to because the container is
newly created and solely owned by the caller. The call from
Daemon.restore did not acquire the lock.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-11-16 18:20:12 +00:00
Rob Murray
92b4902b8d Daemon.registerMountPoints: var 'container' -> 'ctr'
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-11-16 18:19:56 +00:00
Sebastiaan van Stijn
17552fc792 Merge pull request #51542 from robmry/rootless-noipv6
rootless: ignore error when enabling IPv6 forwarding
2025-11-16 14:20:19 +01:00
Rob Murray
5c9f2e0388 rootless: ignore error when enabling IPv6 forwarding
For hosts with IPv6 disabled.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-11-16 11:51:14 +00:00
Sebastiaan van Stijn
4622dd0ccc client: Client.buildRequest, jsonEncode improve handling of content
- add early returns for `nil` body, `http.NoBody`, and `json.RawMessage`
- use `http.NoBody` instead of `nil` for empty bodies; it's more clear
  on intent.
- use json.Encode instead of json.Encoder.Encode(), as we're marshaling
  a single JSON document; this also avoid adding a trailing newline.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-15 00:39:59 +01:00
Sebastiaan van Stijn
20d65620f9 client: Client.buildRequest: don't set content-header if not set
This function was setting `text/plain` as default content-type for any
request that had a non-nil body.

However, this would also set the content-type if (e.g.) `http.NoBody` was set,
or if an empty reader was used, which would result in the daemon potentialy
rejecting the request, as it validates request to be using `application/json`;
d9ee22d1ab/daemon/server/httputils/httputils.go (L47-L58)

    === RUN   TestCommitInheritsEnv
        commit_test.go:30: assertion failed: error is not nil: Error response from daemon: unsupported Content-Type header (text/plain): must be 'application/json'
    --- FAIL: TestCommitInheritsEnv (0.02s)

This patch removes setting the default content-type.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-15 00:39:59 +01: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
Lincoln Wallace
b17eee7aad Update DOCKERCLI_VERSION to v29.0.1
Signed-off-by: Lincoln Wallace <lincoln.wallace@canonical.com>
2025-11-14 16:38:36 -03:00
Sebastiaan van Stijn
4e2e2cde7e client: simplify logic for manual vs auto API versions
When manually setting the API version to use, automatic API version
negotiation should no longer be performed. Instead of keeping track
of these options individually, we can mark negotiation to have happend
if either the version was set manually, or if API version negotiation
took place.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-14 20:30:49 +01:00
Sebastiaan van Stijn
d9ee22d1ab Merge pull request #51530 from thaJeztah/allow_renegotiate
client: client.Ping: allow ForceNegotiate with manual override
2025-11-14 20:07:27 +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
Sebastiaan van Stijn
f156a683b0 Merge pull request #51527 from thaJeztah/validate_versions
client: improve validation and handling of WithAPIVersion, WithAPIVersionFromEnv
2025-11-14 18:17:13 +01:00
Sebastiaan van Stijn
6857132911 client: client.Ping: allow ForceNegotiate with manual override
While a manual overridden version shouldn't perform automatic version
negotiation, the "ForceNegotiate" option could still be used to (re)
negotiate a version. This allows a client to be configured with an
initial API version, then triggered to perform API-version negotiation.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-14 17:41:56 +01:00
Sebastiaan van Stijn
c1e217d18d Merge pull request #51529 from thaJeztah/skip_TestBuildWithHugeFile
integration: skip TestBuildWithHugeFile
2025-11-14 17:35:48 +01:00
Akihiro Suda
57e8ef9d30 Merge pull request #51484 from thaJeztah/vendor_oci_cgroups
vendor: github.com/opencontainers/cgroups v0.0.6
2025-11-14 11:32:06 -05:00
Aditya Mishra
8f1134b46d integration/image: migrate TestAPIImagesDelete to the new integration test framework
Migrated TestAPIImagesDelete from the legacy integration-cli suite
(docker_api_images_test.go) to the new integration test framework under
integration/image/remove_test.go.

This update:
- Fixes ENV instruction syntax to use "ENV FOO=bar"
- Adds error type check using errdefs.IsNotFound for cleaner assertions
- Ensures consistent cleanup handling

Signed-off-by: Aditya Mishra <mishraaditya675@gmail.com>
2025-11-14 22:00:15 +05:30
Sebastiaan van Stijn
3e4a3cb03e integration: skip TestBuildWithHugeFile
We've seen various failures recently where GitHub actions runners are
running out of space. Skip this test for now.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-14 17:23:05 +01:00
Albin Kerouanton
c151d52562 Merge pull request #51525 from akerouanton/revendor-ishidawataru-sctp
vendor: github.com/ishidawataru/sctp v0.0.0-20251114114122-1
2025-11-14 16:05:37 +01:00
Sebastiaan van Stijn
53764de815 client: make WithAPIVersion, WithAPIVersionFromEnv order-independent
Environment-variables are expected to override config / defaults, so
make sure that the DOCKER_API_VERSION env-var always takes priority.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-14 13:54:32 +01:00
Sebastiaan van Stijn
a5c7f3f9c8 client: don't negotiate malformed responses
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-14 13:54:31 +01:00
Sebastiaan van Stijn
bcc1db1ce5 client: WithAPIVersion, WithAPIVersionFromEnv: validate well-formedness
Make these options more strict to not allow arbitrary values. Historically,
the `DOCKER_API_VERSION` env-var did not perform any validation as it was
intended for testing-purposes, but given the wider use of this env-var,
we should perform some amount of validation.

Both `WithAPIVersion` and `WithAPIVersionFromEnv` still allow specifying
API versions that are not supported by the client for testing purposes
(e.g. to use API versions beyond `MinAPIVersion` and `MaxAPIVersion`),
but must be well-formed.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-14 13:54:31 +01:00
Sebastiaan van Stijn
83ad5c92f7 client: Client.ping() fix duplicate ping
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-14 13:54:27 +01:00
Sebastiaan van Stijn
b98c41f124 Merge pull request #51520 from thaJeztah/rename_api_version
client: export fallbackAPIVersion as MinAPIVersion
2025-11-14 13:05:09 +01:00
Albin Kerouanton
49c8d77639 vendor: github.com/ishidawataru/sctp v0.0.0-20251114114122-1
full diff: 4b890084db..19ddcbc6aa

Signed-off-by: Albin Kerouanton <albin.kerouanton@docker.com>
2025-11-14 12:59:14 +01:00
Albin Kerouanton
ddc3603647 Merge pull request #51425 from thaJeztah/no_pointer_slice_step2
daemon: reduce use of pointer-slices in backend
2025-11-14 12:01:45 +01:00
Sebastiaan van Stijn
611c7dce43 client: export fallbackAPIVersion as MinAPIVersion
Export the const and rename it to better reflect its intent.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-14 10:26:37 +01:00
Sebastiaan van Stijn
16880e9e1b Merge pull request #51512 from thaJeztah/client_test_cleanups
client: assorted test-cleanups and fixes
2025-11-13 21:01:42 +01: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
53ea70ea46 inte/networking: TestDisableIPv6OnInterface: add '-c1' to ping
If the DNS name still resolves to an IP address, and that address is
assigned to a running container, the ping command will run indefinitely
and the test suite will time out for 10 mins.

This is confusing, as it looks like a daemon hang, or a test suite hang,
whereas it's just a test failure. Add '-c1' to ping to make it return
immediately.

Signed-off-by: Albin Kerouanton <albin.kerouanton@docker.com>
2025-11-13 18:42:11 +01:00
Albin Kerouanton
47bd247d4d inte/networking: test DNS resolution for non swarm-scoped nws
Previous commit reverted a faulty change that broke DNS resolution for
non swarm-scoped networks once a node has joined a Swarm cluster.

This commit adds an integration test to verify that we don't break DNS
resolution again.

Signed-off-by: Albin Kerouanton <albin.kerouanton@docker.com>
2025-11-13 18:42:11 +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
Sebastiaan van Stijn
94e83af71a client: TestImageListWithSharedSize: merge with TestImageList
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-13 15:57:24 +01:00
Sebastiaan van Stijn
62589a6961 client: TestTLSCloseWriter: cancel context after test
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-13 15:46:54 +01:00
Sebastiaan van Stijn
a5dec0a779 client: make sure context is canceled for ContainerWait tests
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-13 15:44:09 +01:00