2394 Commits

Author SHA1 Message Date
Paweł Gronowski
3b2f5575b2 Merge pull request #52722 from notandruu/integration/migrate-TestInspectAPIImageResponse
integration: migrate TestInspectAPIImageResponse to integration suite
2026-06-18 17:41:26 +02:00
Paweł Gronowski
62b3aaee3c Merge pull request #52901 from vvoland/c8d-imageusage
daemon/c8d: Count image usage from their actual snapshots
2026-06-18 17:40:45 +02:00
Paweł Gronowski
0802db572b integration/TestDiskUsage: Clarify comment
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2026-06-18 15:58:27 +02:00
Paweł Gronowski
f46ac3c48a integration/TestDiskUsage: Drop size adjustment
The image usage drift is fixed at the source, so the disk usage test no
longer needs to tolerate a one-block difference on rootless.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2026-06-18 15:58:27 +02:00
Sebastiaan van Stijn
f591e4f5c4 Merge pull request #52905 from vvoland/c8d-fix-prune-snapshots
c8d/prune: Track removed snapshots
2026-06-18 15:39:39 +02:00
Daniel Villavicencio
2dedfa0c63 integration/container: Added missed requirement for a local daemon to test TestStatsNetworkStats
Signed-off-by: Daniel Villavicencio <dvm3099@pm.me>
2026-06-18 04:42:23 -07:00
Paweł Gronowski
dffbb16e52 c8d/prune: Track removed snapshots
Include deleted snapshots in the deleted size report.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2026-06-18 13:28:55 +02:00
Andrew Liu
1567f9e65f integration: migrate TestInspectAPIImageResponse to integration suite
Signed-off-by: Andrew Liu <andrewjliu22@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-06-18 13:27:35 +02:00
Paweł Gronowski
77bebe7030 Merge pull request #52096 from deahtstroke/50159-migrate-TestAPIStatsNetworkStats-from-integration-cli
integration/container: Migrate TestAPIStatsNetworkStats to integratio…
2026-06-18 12:54:22 +02:00
Daniel Villavicencio
47f6e9248b integration/container: migrate TestAPIStatsNetworkStats to integration suite
Signed-off-by: Daniel Villavicencio <dvm3099@pm.me>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-06-18 10:56:51 +02:00
5h4rk-lab
c8f44969df integration: migrate TestAPICreateDeletePredefinedNetworks from integration-cli
Signed-off-by: Go Charan Kilaru <sharkmagic07@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-06-18 02:12:52 +02:00
Paweł Gronowski
ee896559da integration/container: Skip process-kill restart test on Windows CI
The legacy integration-cli coverage skipped this host PID kill path on
Windows GitHub Actions because process-isolated Windows containers can
fail with access denied when the test process tries to kill the
container process directly.

Keep the migrated test aligned with that compatibility guard while
preserving coverage for local process-isolated Windows runs and
non-Windows daemons.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2026-06-17 18:43:20 +02:00
Paweł Gronowski
e7ac69f482 integration-cli: Migrate restart suite
Migrate non-redundant `DockerCLIRestartSuite` cases to modern integration tests:

- `TestRestartStoppedContainer` -> `TestContainerRestartStoppedContainer`
- `TestRestartWithVolumes` -> `TestContainerRestartWithVolumes`
- `TestRestartContainerSuccess` -> `TestContainerRestartPolicyAfterProcessExit/direct-process-exit`
- `TestRestartPolicyAfterRestart` -> `TestContainerRestartPolicyAfterProcessExit/after-manual-restart`
- `TestRestartWithPolicyUserDefinedNetwork` -> `TestContainerRestartPolicyUserDefinedNetwork`

Drop redundant deprecated cases:

- `TestRestartRunningContainer`
  covered by `TestWaitRestartedContainer`.
- `TestRestartPolicyNO`, `TestRestartPolicyAlways`, `TestRestartPolicyOnFailure`
  covered by modern create/restart-policy tests.
- `TestRestartAutoRemoveContainer`
   covered by `TestContainerWithAutoRemoveCanBeRestarted`.
- `TestRestartDisconnectedContainer`
  low-value adjacent coverage already exercised by networking restart tests.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2026-06-17 18:43:05 +02:00
Sebastiaan van Stijn
532e50b773 Merge pull request #50494 from Abubacarr075/50159-migrate-test-api-images
migrate TestAPIImagesSearchJSONContentType to integration
2026-06-16 19:05:07 +02:00
Sebastiaan van Stijn
c891cf6dcb Merge pull request #52858 from vvoland/fix-flaky-windows
integration-cli: Migrate TestContainersAPICreateMountsCreate
2026-06-16 17:32:29 +02:00
Abubacarr Ceesay
269c1eda0f migrate TestAPIImagesSearchJSONContentType to integration
Migrate test api images search json content type from integration cli to integration tests

Signed-off-by: Abubacarr Ceesay <abubacarr671@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-06-16 17:14:22 +02:00
Sebastiaan van Stijn
fee7908162 Merge pull request #52882 from vvoland/restrartcontainer-good
integration-cli/container: Rewrite on-failure restart tests
2026-06-16 16:41:34 +02:00
Sebastiaan van Stijn
bad07d3b7c Merge pull request #52885 from vvoland/deflake-TestStopContainerWithTimeoutCancel
integration/container: Wait for trap setup before signaling
2026-06-16 12:08:18 +02:00
Paweł Gronowski
cfe0e72854 integration-cli: Migrate TestContainersAPICreateMountsCreate
Move the useful Mounts API create coverage out of integration-cli and
into the container integration tests that own the behavior.

Add volume mount inspect assertions to TestContainerVolumeAnonymous for
destination normalization, read-only named volumes, explicit driver
configuration, and NoCopy mounts.

Add a focused bind mount inspect test for read-only bind mounts and
shared propagation.

Do not port the full integration-cli matrix. Existing integration tests
already cover anonymous volume creation and labeling, anonymous volume
removal with RemoveVolumes, and generic bind propagation handling.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2026-06-15 21:10:34 +02:00
Paweł Gronowski
9148248216 integration/container: Wait for trap setup before signaling
Try to deflake:

- TestStopContainerWithTimeoutCancel
- TestContainerRestartWithCancelledRequest
- TestWaitBlocked
- TestWaitRestartedContainer

Several container integration tests rely on shell TERM traps to produce
specific stop, restart, or wait behavior.
They issue stop or restart requests immediately after container
creation, so dockerd can signal the process before the shell installs
its trap.
When that happens, the process uses default signal behavior and tests
can miss the expected log line or observe the wrong exit status.

Emit a readiness log after installing each trap and wait for it before
issuing stop or restart. Move logsContains into a shared helper so the
readiness check can be reused by the affected tests.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2026-06-15 20:05:38 +02:00
Paweł Gronowski
b764e28d55 integration-cli/container: Rewrite on-failure restart tests
Replace flaky legacy CLI restart-policy tests with container API
integration coverage.

The CLI tests poll inspect output after short-lived detached containers
exit, which can observe transient daemon monitor state while cleanup or
restart-policy handling is still settling.

On Windows this can race a manual restart against an `on-failure:3`
container that has not exhausted its automatic retries.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2026-06-15 19:35:31 +02:00
Paweł Gronowski
1ba0b7b9c4 integration: Extend TestRenameAnonymousContainer wait
Use the Windows stop poll timeout when waiting for ping to exit.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2026-06-15 16:29:54 +02:00
Paweł Gronowski
352fef3916 integration: Extend TestStopContainerWithRestartPolicyAlways wait
Use the Windows stop poll timeout when waiting for stopped containers.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2026-06-15 16:29:37 +02:00
Paweł Gronowski
077777b6f7 integration: Extend TestRemoveContainerWithRemovedVolume wait
Use the Windows stop poll timeout when waiting for exit.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2026-06-15 16:29:05 +02:00
Alexis Couvreur
ca30e0d8ec daemon: support per-device blkio throttle in ContainerUpdate
The POST /containers/{id}/update API accepts BlkioWeightDevice,
BlkioDeviceReadBps, BlkioDeviceWriteBps, BlkioDeviceReadIOps, and
BlkioDeviceWriteIOps in its Resources body, but these five fields were
silently ignored when updating a running container.

The root cause was in toContainerdResources (daemon/update_linux.go):
only BlkioWeight was mapped into specs.LinuxBlockIO; the per-device
fields were never converted, so tsk.UpdateResources never wrote to
cgroupv2 io.max or the cgroupv1 blkio throttle files.

Fix by calling the existing getBlkioWeightDevices and
getBlkioThrottleDevices helpers (already used in oci_linux.go for
container creation) to populate all five fields. The function signature
is extended to return an error so that stat(2) failures on invalid
device paths are surfaced to the caller instead of being silently
dropped.

The API makes distinction between nil and zero-length slices while
doing. A nil per-device blkio field means the caller did not request an
update for that setting, while a non-nil empty slice means the caller
explicitly requested the setting to be cleared.

The Windows stub is updated to match the new signature.

Signed-off-by: Alexis Couvreur <alexiscouvreur.pro@gmail.com>
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2026-06-12 15:52:14 +02:00
Paweł Gronowski
5eda928bb8 Merge pull request #52636 from smerkviladze/add-attestation-statements
image: expose in-toto attestation statements via the API
2026-06-12 15:49:34 +02:00
Paweł Gronowski
f39fa9b651 integration/system: Extend rootless disk usage drift tolerance
Rootless snapshotter mode can report image TotalSize one filesystem
block above the per-image and reclaimable sizes after loading BusyBox.
The empty disk usage case already accepts this overlayfs accounting
artifact.

Allow the same bounded 4096-byte positive drift in the
after_LoadBusybox assertions while keeping strict equality for other
daemon modes.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2026-06-12 14:38:00 +02:00
Sopho Merkviladze
0b2c3780be api: declare ImageAttestations platform and type as repeatable
Both query parameters are now collectionFormat: multi arrays in the
swagger so they can accept multiple values later without an API
version bump. The server still operates on a single platform and
rejects requests passing more than one; type is read directly as a
list of repeated values instead of a comma-separated string.

Signed-off-by: Sopho Merkviladze <smerkviladze@mirantis.com>
2026-06-12 16:20:52 +04:00
Sopho Merkviladze
a0b6dbc2fc api: add GET /images/{name}/attestations endpoint
Add a new Engine API endpoint that returns the in-toto attestation
statements attached to an image for a given platform. The endpoint
locates the attestation manifest(s) referencing the requested platform's
image manifest, enumerates the statement layers, and returns each
layer's OCI descriptor (including media type, digest, size, and
annotations) together with its in-toto predicate type.

Query parameters:
  - platform: JSON-encoded OCI platform; defaults to the daemon's host
    platform if omitted.
  - type: comma-separated list of in-toto predicate type URIs; if
    omitted, all statements are returned.
  - statement: boolean, defaults to false. When true, the daemon reads
    each matching statement blob and includes the verbatim in-toto JSON
    in the response. When false (or omitted), statement blobs are not
    read and the Statement field is absent from each entry.

The manifest-chain walk (locating the platform image manifest and its
associated attestation manifest) is delegated to policy-helpers'
image.ResolveSignatureChain so that moby and BuildKit agree on how to
interpret the attestation storage format. The statement-layer iteration
and blob reading is inlined: when statement bodies are requested it
fails fast on the first unreadable blob and reads matching blobs
eagerly into memory; otherwise statement-layer blobs are never read
from the content store.

The endpoint is implemented for the containerd image store. The legacy
graphdriver store returns errdefs.NotImplemented (HTTP 501).

Signed-off-by: Sopho Merkviladze <smerkviladze@mirantis.com>
2026-06-12 13:40:58 +04:00
Paweł Gronowski
29f6cd5c90 Merge pull request #41963 from thaJeztah/prefix_slash
testing: refactor uses of "getPrefixAndSlashFromDaemonPlatform()"
2026-06-11 17:33:42 +02:00
Andrew Liu
df4e5607ed libnet/rlkclient: don't collapse loopback host IPs to 127.0.0.1
In rootless mode, ChildHostIP maps every IPv4 host address to 127.0.0.1
in the child network namespace. Port bindings on the same port but
distinct loopback addresses (e.g. 127.0.1.2:80 and 127.0.1.3:80) were
therefore both reserved as 127.0.0.1:80 by the port allocator in the
child namespace, and the second binding failed with "Bind for
127.0.0.1:8080 failed: port is already allocated" even though the
requested addresses do not conflict.

Preserve IPv4 loopback host addresses as the child host IP instead. The
child namespace's lo interface covers all of 127.0.0.0/8, so the
addresses are bindable as-is, and RootlessKit's builtin port driver
both listens on the requested parent address and dials the requested
child address verbatim. Port drivers that disallow loopback child IPs
(slirp4netns) are unaffected: their forced non-loopback childIP is
selected before the loopback fallback.

Signed-off-by: Andrew Liu <andrewjliu22@gmail.com>
2026-06-10 01:12:57 -07:00
Sebastiaan van Stijn
3230c07369 Merge pull request #52736 from takumi12311123/fix/52601-nri-sync-once
integration/d/nri: close synchronized channel exactly once
2026-06-05 15:24:34 +02:00
Paweł Gronowski
73127bfd67 integration: Avoid foreign binary execution in image history test
Keep the cross-platform image history regression coverage focused on
non-native image metadata by using a COPY step instead of RUN.

This avoids requiring QEMU/binfmt support when the test builds an image
for a non-native platform.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2026-06-03 18:39:49 +02:00
Takumi Akasaka
7005d82559 integration/d/nri: close synchronized channel exactly once
The Synchronize method on the integration-test plugin closed
p.synchronized inside a select/default block that is not safe under
concurrent invocation: two goroutines can both observe the channel as
still open and panic on the second close. Use sync.Once so the channel
is closed exactly once.

Signed-off-by: Takumi Akasaka <takumiakasaka1231@gmail.com>
2026-06-03 23:01:06 +09:00
Paweł Gronowski
fb3702d033 daemon: resolve in-container symlinks before os.Root mount ops
The security fix in GHSA-vp62-88p7-qqf5 switched openContainerFS to
os.Root for mount-destination operations, but stopped walking the
destination through in-container symlinks.

os.Root refuses to follow absolute symlinks, so any container whose
image had an absolute symlink along the mount target's path (e.g. the
common /var/run -> /run in ubuntu/alpine/busybox) broke `docker cp`.

Walk m.Destination through ctr.GetResourcePath first which follows
symlinks to get a path relative to BaseFS, then keep using os.Root for
the actual MkdirAll/OpenFile/Open calls.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2026-05-19 18:05:46 +02:00
Sebastiaan van Stijn
f806aacca8 testing: refactor uses of "getPrefixAndSlashFromDaemonPlatform()"
Implement a `dPath()` utility function that converts paths to Windows paths
(add `c:` drive-letter, and convert to backslashes) if the daemon is running
on Windows.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-05-18 23:21:39 +02:00
Paweł Gronowski
2022313ffe daemon: Decompress archives before entering container filesystem
Move decompression outside RunInFS to prevent executing
attacker-controlled binaries from within the container filesystem.

When dockerd handles `PUT /containers/{id}/archive`, it switches root
into the container's filesystem before extracting the archive.
Previously, archive.Untar was called inside RunInFS, which meant
decompression binaries (xz, unpigz) were resolved via PATH inside the
container's filesystem. A malicious binary at /usr/bin/xz in the
container would be executed as host root.

Fix by calling decompressing the archive before entering the container
filesystem, then using unpacking the uncompressed tar stream inside
RunInFS.
This ensures decompression binaries are always resolved from the host
filesystem.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2026-05-18 16:20:32 +02:00
Paweł Gronowski
71f6a9695b integration: Make some tests Parallel
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2026-05-13 17:28:17 +02:00
Sebastiaan van Stijn
cc511e685a Merge pull request #52598 from vvoland/build-userns-test
Test build with userns-remap and revert setkey reexec removal
2026-05-11 21:28:04 +02:00
Sebastiaan van Stijn
6bfe82c404 Merge pull request #52584 from vvoland/fix-subpath-file
volume: Fix file subpath mount over existing image file
2026-05-11 19:05:12 +02:00
Paweł Gronowski
9160ad1dd7 integration/build: Add userns-remap test
Verify building with userns-remap enabled works.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2026-05-11 15:53:40 +02:00
Paweł Gronowski
b9fe5eb4ab integration/build: Add error assertion in GetImageIDFromBody
Add assertion to check for build errors in JSON messages during image
building.
When a JSON message contains an error, the test will now fail with the
error details.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2026-05-11 15:53:31 +02:00
Paweł Gronowski
ee281d16a1 integration/internal/build: let Do accept ImageBuildOptions
Tests that use the build helper currently cannot influence the build
beyond providing the context (e.g. they cannot set Tags, BuildArgs, or
Version).

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2026-05-11 15:39:35 +02:00
Paweł Gronowski
d3adafd853 volume: Fix file subpath mount over existing image file
When a volume subpath pointing to a single file was mounted onto a
target path that already existed as a file in the container image, the
container creation failed with "open /var/lib/docker/tmp/safe-mountXXX:
not a directory".

Skip the volume population step when the volume mount path is a file,
since directory content copying is not applicable to single-file mounts.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2026-05-11 13:55:43 +02:00
Cory Snider
cfb2ed2acd integration/d/nri: block until plugin is registered
Fix NRI tests racing plugin registration by blocking the test until the
plugin has been synchronized at least once, signifying that it has
completed registration with the NRI infrastructure.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2026-05-08 17:12:22 -04:00
Sebastiaan van Stijn
6a676818c2 Merge pull request #52333 from agners/fix-image-list-canonical-reference-filter
image list: match reference filter against canonical names
2026-05-08 15:03:49 +02:00
Stefan Agner
daf25751d5 image list: match reference filter against canonical names
The reference filter on the image list endpoint only matched against
the "familiar" (shortened) form of image names via FamiliarMatch,
which strips the "docker.io/library/" prefix. Filtering with a full
canonical reference like "docker.io/library/alpine" never matched.

Match the filter pattern against both the familiar and canonical
forms of the image reference (with and without tag), so e.g.
"alpine" and "docker.io/library/alpine" (and their glob variants)
both match. This preserves the long-standing path.Match-based glob
behavior introduced in 2013 (b44d113120 "filter image listing using
path.Match"), including patterns that span the familiar / canonical
boundary like "*5000*/*".

The same fix is applied to the legacy (graphdriver) backend so
filter behavior is consistent across storage backends.

Adds integration test cases in TestAPIImagesFilters covering
canonical name matching.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Stefan Agner <stefan@agner.ch>
2026-05-08 12:02:04 +02:00
Paweł Gronowski
34e3b001b7 integration/container: Handle socketcall return EPERM
With the apparmor based block, it will now fail with EPERM

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2026-05-06 15:23:33 +02:00
Paweł Gronowski
d4fc496755 integration/container: skip socketcall test without AppArmor or SELinux
Seccomp cannot filter socketcall(2) arguments because the address
family is behind a userspace pointer that BPF cannot dereference.
Only an LSM (AppArmor or SELinux) can deny AF_ALG via the
security_socket_create hook in the socketcall path.

Skip the socketcall_int80 subtest when neither AppArmor nor SELinux
is reported by the daemon, since the test would always fail without
an LSM to enforce the deny rule.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2026-05-06 15:22:56 +02:00
Paweł Gronowski
b9e11cf1a6 integration/container: Verify AF_INET socketcall still works
Add a positive test that creates an AF_INET socket via int $0x80
socketcall to ensure the AppArmor "deny network alg" rule only
blocks AF_ALG and does not break legitimate socketcall usage.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2026-05-06 15:22:56 +02:00