Commit Graph

9838 Commits

Author SHA1 Message Date
Sebastiaan van Stijn
587d38292b Merge pull request #51629 from vvoland/c8d-fix-images
c8d/inspect: Fix image inspect for incomplete images
2025-12-02 12:35:27 +01:00
Brian Goff
a1836eb283 Merge pull request #51631 from thaJeztah/fix_df_shared_usage
system: df: fix SharedUsage on non-containerd
2025-12-01 13:30:07 -08:00
Paweł Gronowski
2e3a23c8ec c8d/inspect: Fix image inspect for incomplete images
When inspecting multi-platform images where some layer blobs were
missing from the content store, the image inspect operation would return
too early causing some data (like config details or unpacked size) to be
omitted even though are available.

This ensures that `docker image inspect` returns as much information as
possible.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-12-01 17:38:45 +01:00
Sebastiaan van Stijn
69c4ea7aad system: df: fix SharedUsage on non-containerd
The value was calculated, but due to 0af2962fdd
changing to a non-pointer, the value was not written back to the resulting
slice.

Before this patch:

    docker pull nginx:alpine
    docker pull alpine

    docker system df -v
    Images space usage:

    REPOSITORY   TAG       IMAGE ID       CREATED       SIZE      SHARED SIZE   UNIQUE SIZE   CONTAINERS
    nginx        alpine    cbad6347cca2   4 weeks ago   53.4MB    N/A           N/A           0
    alpine       latest    171e65262c80   7 weeks ago   8.51MB    N/A           N/A           0

With this patch:

    docker system df -v
    Images space usage:

    REPOSITORY   TAG       IMAGE ID       CREATED       SIZE      SHARED SIZE   UNIQUE SIZE   CONTAINERS
    nginx        alpine    cbad6347cca2   4 weeks ago   53.4MB    8.512MB       44.91MB       0
    alpine       latest    171e65262c80   7 weeks ago   8.51MB    8.512MB       0B            0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-12-01 16:45:38 +01:00
Rob Murray
7517464283 PublishAllPorts: don't crash with nil PortBindings
Introduced by commit 85b260f ("PublishAllPorts: create
port mappings for exposed ports").

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-11-29 19:43:30 +00:00
Albin Kerouanton
310aa9241a libnet/pm: log when stopping userland proxy
Signed-off-by: Albin Kerouanton <albin.kerouanton@docker.com>
2025-11-28 19:40:37 +01:00
Albin Kerouanton
52fae09ec0 libnet/pms/nat: don't bind IPv6 ports if not supported by port driver
In rootless mode, the Engine needs to call the rootless port driver to
know which IP address it should bind to inside of its network namespace.

The slirp4netns port drivers doesn't support binding to IPv6 address, so
we need to detect that before listening on the port.

Before commit 201968cc0, this wasn't a problem because the Engine was
binding the port, then calling rootless port driver to learn whether the
proto/IP family was supported, and listen on the port if so.

Starting with that commit, the Engine does bind + listen in one go, and
then calls the port driver — this is too late. Fix the bug by checking
if the port driver supports the PortBindingReq, and only allocate the
port if so.

Signed-off-by: Albin Kerouanton <albin.kerouanton@docker.com>
2025-11-28 19:40:34 +01:00
Albin Kerouanton
56e8e43339 Revert "libnet: populateNetworkResourcesOS: updateDNS only if !needResolver"
This reverts commit 937246a868.

Signed-off-by: Albin Kerouanton <albin.kerouanton@docker.com>
2025-11-28 09:47:07 +01:00
Albin Kerouanton
83f00e9f2b Revert "libnet: rebuildDNS: update the hash file"
This reverts commit eb18b398d4.

Signed-off-by: Albin Kerouanton <albin.kerouanton@docker.com>
2025-11-28 09:47:04 +01:00
Albin Kerouanton
14a955db2f Revert "libnet: setupDNS: don't overwrite user-modified resolv.conf"
This reverts commit 7639e193ff.

Signed-off-by: Albin Kerouanton <albin.kerouanton@docker.com>
2025-11-28 09:47:01 +01:00
Albin Kerouanton
20634eddce Merge pull request #51496 from thaJeztah/discoverapi_cleanups
libnetwork: some minor refactor / cleanups
2025-11-27 12:22:01 +01:00
Rob Murray
baf59d62d6 Merge pull request #51592 from robmry/sbleave_gw_config_error
Suppress errors from gateway re-config when disconnecting a network
2025-11-26 16:07:41 +00:00
Rob Murray
8f2aa3e0f5 Network disconnect: log rather than error on gateway update
During a network disconnect, log rather than returning an error
if it's not possible to set up a new gateway.

This restores the behaviour from before commit 53390f8 ("Put
clearNetworkResources() inline in its only caller"). It's not
ideal, but by the time new gateways are selected the old
endpoint has been disconnected - and nothing puts things back.
Until that's cleaned up, a broken state is inevitable, but
letting endpoint deletion complete means the container can
be restarted or re-connected to the network without a zombie
endpoint causing further issues.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-11-26 14:45:18 +00:00
Derek McGowan
e4a1657762 Check containerd client before using on Windows
Throw an error if the containerd snapshotter is enabled on Windows but
containerd has not been configured. This fixes a panic in this case when
trying to use an uninitialized client.

Signed-off-by: Derek McGowan <derek@mcg.dev>
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-11-26 15:40:08 +01:00
Rob Murray
18d2a08fcf Merge pull request #51587 from robmry/unmap_ipv6_addr
Unmap() more netip.Addr vars created from slices
2025-11-25 19:30:27 +00:00
Rob Murray
731ae07e65 Endpint.sbLeave: when deleting container, no new gateway
When the endpoint providing a container's default gateway
is removed, there's no need to select a new gateway if the
container is being removed.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-11-25 18:11:07 +00:00
Albin Kerouanton
03797acd88 Merge pull request #51586 from robmry/ep_options_exposed_ports
PublishAllPorts: create port mappings for exposed ports
2025-11-25 18:21:59 +01:00
Rob Murray
abd4c104dc Merge pull request #51526 from robmry/refactor-create-mounts
Refactor Daemon.create - prep for call to NRI plugin
2025-11-25 16:13:57 +00:00
Rob Murray
56dda25227 Merge pull request #51507 from zhangguanzhang/fix-pause-restart
libnet: setupDNS: don't overwrite user-modified resolv.conf
2025-11-25 13:53:10 +00:00
zhangguanzhang
7639e193ff libnet: setupDNS: don't overwrite user-modified resolv.conf
Call resolvconf.UserModified() in sandbox.setupDNS() to check if
resolv.conf was manually modified before regenerating it during
container restart for non-host network modes.

Signed-off-by: zhangguanzhang <zhangguanzhang@qq.com>
Signed-off-by: Albin Kerouanton <albin.kerouanton@docker.com>
2025-11-25 20:32:40 +08:00
Albin Kerouanton
eb18b398d4 libnet: rebuildDNS: update the hash file
Signed-off-by: Albin Kerouanton <albin.kerouanton@docker.com>
2025-11-25 11:51:27 +01:00
Albin Kerouanton
937246a868 libnet: populateNetworkResourcesOS: updateDNS only if !needResolver
When ep.needResolver() is true, sb.startResolver() calls sb.rebuildDNS()
which doesn't update the resolv.conf hash file.

Subsequent calls to sb.updateDNS() (which is only called by
populateNetworkResourcesOS) won't have any effect since it'll compare
the hash file and consider that the file was manually modified.

Make this explicit by gating the call to updateDNS() on !needResolver().

Signed-off-by: Albin Kerouanton <albin.kerouanton@docker.com>
2025-11-25 11:43:36 +01:00
Rob Murray
85b260fba8 PublishAllPorts: create port mappings for exposed ports
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-11-24 20:38:46 +00:00
Rob Murray
a2de9bb334 Unmap more netip.Addr vars created using AddrFromSlice
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-11-24 16:51:14 +00:00
Rob Murray
2effc1bfd4 inspect: unmap IPv6-mapped IPv4 host address
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-11-24 16:29:32 +00:00
Rob Murray
84a251d039 Allow configured address with no configured subnet
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-11-24 14:14:27 +00:00
Brian Goff
6e52828ec3 Merge pull request #51517 from corhere/opencensus-bridge
daemon: install OpenCensus-to-OTEL trace bridge
2025-11-20 11:07:51 -08:00
Rob Murray
ed10b98506 Restore missing nwEndpointsMu.Lock
- introduced by 4f7afb8 (Remove libnet's logic to track a driver's
  port mapping state)

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-11-18 15:38:48 +00:00
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
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
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
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
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
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
Paweł Gronowski
391247ce96 daemon: Fix image store choice priority for prior graphdriver state
The priority order for determining image store choice was incorrect when
a prior graphdriver existed.

The issue occurred because the prior graphdriver check happened after
processing explicit driver configuration, effectively ignoring user
intent when prior state existed.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-11-13 10:05:49 +01:00
Paweł Gronowski
c5d0e3e6fa daemon: Add TestDetermineImageStoreChoice
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-11-13 10:05:49 +01:00
Sebastiaan van Stijn
9824080b57 Merge pull request #51012 from tonistiigi/attestation-signature-referrers
image: pull/load/save attestation manifest and signatures with image
2025-11-12 18:04:21 +01:00
Tonis Tiigi
47e852f061 image: pull/load/save attestation manifest and signatures with image
Updates docker pull to pull related attestation manifest and
any signatures for that manifest in cosign referrer objects.

These objects are transferred with the image when running
docker save and docker load and can be used to identify
the image in future updates.

Push is not updated atm as the currect push semantics
in containerd mode do not have correct immutability
guaranteed and don't work with image indexes.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2025-11-12 07:53:46 -08:00