582 Commits

Author SHA1 Message Date
Sebastiaan van Stijn
e529aa7d7c integration/container: TestStats: explicitly check zero-value
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-01-05 13:40:04 +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
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
Akihiro Suda
cc30833181 integration: increase timeout
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2025-12-08 12:39:14 +09:00
Akihiro Suda
b9d18a107a integration: cdi: add TestEtcCDI to verify /etc/cdi is used in rootless mode
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2025-12-02 02:30:14 +09:00
Sopho Merkviladze
5a5d5b4c5f integration: add Windows network driver and isolation tests
Add integration tests for Windows container functionality focusing on network drivers and container isolation modes.

Signed-off-by: Sopho Merkviladze <smerkviladze@mirantis.com>
2025-11-26 13:35:19 +04: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
Sebastiaan van Stijn
dae3650dcc client: rename/deprecate WithVersion, WithVersionFromEnv
Add WithAPIVersion and WithAPIVersionFromEnv to be more clear on
the intent, and to align with other related options and fields.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-12 22:39:05 +01:00
Sebastiaan van Stijn
db71c6a914 api/types/container: make HealthStatus a concrete type
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-10 16:08:15 +01:00
Sebastiaan van Stijn
1fd87e9fdf api/types/container: make ContainerState a concrete type
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-10 16:08:12 +01:00
Sebastiaan van Stijn
7aa036ef2e client: rename CheckpointDelete to CheckpointRemove, and add output struct
Align with other "delete" options, which are all named "remove".

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-10 11:42:27 +01:00
Sebastiaan van Stijn
e2bdc51508 client: CheckpointCreate: add output struct
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-10 11:42:23 +01:00
Sebastiaan van Stijn
da25838fc3 client: CheckpointListResult: rename Checkpoints to Items
Align with other ListResult structs

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-10 11:23:34 +01:00
Sebastiaan van Stijn
d35d8ec81b client: Client.ContainerLogs: close reader on context cancellation
Use a cancelReadCloser to automatically close the reader when the context
is cancelled. Consumers are still recommended to manually close the reader,
but the cancelReadCloser makes the Close idempotent.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-06 00:09:33 +01:00
Sebastiaan van Stijn
c5aedacb4f client: Client.ContainerExport: close reader on context cancellation
Use a cancelReadCloser to automatically close the reader when the context
is cancelled. Consumers are still recommended to manually close the reader,
but the cancelReadCloser makes the Close idempotent.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-06 00:07:57 +01:00
Sebastiaan van Stijn
08cd02cab6 client: Client.ImageImport: close reader on context cancellation
Use a cancelReadCloser to automatically close the reader when the context
is cancelled. Consumers are still recommended to manually close the reader,
but the cancelReadCloser makes the Close idempotent.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-06 00:07:52 +01:00
Sebastiaan van Stijn
de9ab07188 client: ExecCreateOptions: change ConsoleSize to a ConsoleSize type
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-05 15:53:28 +01:00
Sebastiaan van Stijn
443b548efa client: ExecCreate: rename Tty to TTY
Align with ExecStartOptions

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-05 15:53:03 +01:00
Salim Dohri
9b749d7c85 integration-cli: migrate TestAPIStatsContainerNotFound to integration tests
Migrate TestAPIStatsContainerNotFound from the deprecated integration-cli
test suite to the modern integration test framework in integration/container.

The test verifies that the container stats API returns a NotFound error
for non-existent containers, testing both streaming and non-streaming modes.

Changes made:
- Migrated test to integration/container/stats_test.go using standard
  Go testing patterns
- Refactored to use test array pattern for better test organization
- Removed test from integration-cli/docker_api_stats_test.go
- Removed unused imports from integration-cli file
- Removed Windows skip as it may not be necessary

Signed-off-by: Salim Dohri <dohri.salim@gmail.com>
2025-11-02 10:46:22 +01:00
Sebastiaan van Stijn
b77f2055f7 Merge pull request #51219 from ricardobranco777/selinux
integration/container: Make tests runnable on SELinux enabled daemon
2025-10-31 02:46:39 +01:00
Rob Murray
43b48f1929 Merge pull request #51355 from corhere/api-macaddr-marshaltext
api/t/network: represent MAC addrs as byte slices
2025-10-30 23:43:12 +00:00
Cory Snider
19f4c27d81 api/t/network: represent MAC addrs as byte slices
Make invalid states unrepresentable by moving away from stringly-typed
MAC address values in API structs. As go.dev/issue/29678 has not yet
been implemented, provide our own HardwareAddr byte-slice type which
implements TextMarshaler and TextUnmarshaler to retain compatibility
with the API wire format.

When stdlib's net.HardwareAddr type implements TextMarshaler and
TextUnmarshaler and GODEBUG=netmarshal becomes the default, we should be
able to make the type a straight alias for stdlib net.HardwareAddr as a
non-breaking change.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-10-30 17:11:38 -04:00
Paweł Gronowski
5a871b8299 Merge pull request #51156 from corhere/client-pkg-jsonmessage
client/pkg/jsonmessage: refactor in terms of `api/types/jsonstream`
2025-10-30 19:33:21 +01:00
Sebastiaan van Stijn
d1f70d4f54 client: deprecate NewClientWithOpts in favor of New
Use a more idiomatic name so that it can be used as `client.New()`.

We should look if we want `New()` to have different / updated defaults
i.e., enable `WithEnv` as default, and have an opt-out and have API-
version negotiation enabled by default (with an opt-out option).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-30 18:09:44 +01:00
Austin Vazquez
c5e318dbde Merge pull request #51328 from vvoland/client-containercopy-structs
client/container_copy: Wrap options and result struct
2025-10-29 10:44:59 -05:00
Sebastiaan van Stijn
b910408187 Merge pull request #51326 from vvoland/client-containerupdate-structs
client/container_update: Wrap options and result
2025-10-29 15:17:28 +01:00
Paweł Gronowski
1cc2ab16ce client/container_copy: Wrap options and result struct
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-10-29 14:34:19 +01:00
Sebastiaan van Stijn
e9631b507e Merge pull request #51323 from thaJeztah/container_wait_nits
client: ContainerWait: touch-up GoDoc, and remove legacy code, and use singular for channels (ContainerWaitResult)
2025-10-29 13:41:02 +01:00
Paweł Gronowski
38d703ff6f client/container_update: Wrap options and result
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-10-29 13:30:22 +01:00
Paweł Gronowski
c755b9635d Merge pull request #51322 from vvoland/client-fixup
client: Rename ContainerUnPause* to ContainerUnpause*
2025-10-29 12:56:32 +01:00
Sebastiaan van Stijn
29ad05b130 client: ContainerWaitResult: use singular for channels
These channels should ever only return a single result, so rename
them to match that expectation.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-29 12:37:46 +01:00
Sebastiaan van Stijn
7041c02abd Merge pull request #51320 from thaJeztah/refactor_client_system_step1
client: refactor Events, Info, RegistryLogin
2025-10-29 12:25:28 +01:00
Sebastiaan van Stijn
b5971b6ae3 Merge pull request #51315 from austinvazquez/refactor-client-container-rename
client: refactor `ContainerRename` to wrap options/result structs
2025-10-29 11:41:33 +01:00
Paweł Gronowski
fc97a2ff0d client: Rename ContainerUnPause* to ContainerUnpause*
To better match the method name itself

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-10-29 11:32:32 +01:00
Sebastiaan van Stijn
d3eb04fe59 Merge pull request #51312 from austinvazquez/refactor-client-container-wait
client: refactor ContainerWait to use client defined options/results structs
2025-10-29 11:12:52 +01:00
Austin Vazquez
40bf2b05f3 Merge pull request #51317 from austinvazquez/refactor-client-container-logs
client: refactor `ContainerLogs` to wrap result
2025-10-29 05:06:22 -05:00
Austin Vazquez
d2e7465293 client: refactor ContainerRename to wrap options/result structs
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-29 10:14:26 +01:00
Sebastiaan van Stijn
a0f877d1b3 Merge pull request #51316 from austinvazquez/refactor-client-container-export
client: refactor `ContainerExport` to wrap options/result structs
2025-10-29 10:01:07 +01:00
Austin Vazquez
28ed1ef927 client: refactor ContainerLogs to wrap result
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-29 09:54:23 +01:00
Austin Vazquez
e46058cbae client: refactor Events, Info, RegistryLogin
Co-authored-by: Claude <noreply@anthropic.com>
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-29 09:36:23 +01:00
Austin Vazquez
749c980d4e client: refactor ContainerExport to wrap options/result structs
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-28 19:39:13 -05:00
Austin Vazquez
c5ddef1122 client: refactor ContainerList to wrap result
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-28 18:52:52 -05:00
Austin Vazquez
cf173bc941 client: refactor ContainerWait to use client defined options/results structs
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-28 18:15:01 -05:00
Cory Snider
bbaeb9036f client/pkg/jsonmessage: use api message def'ns
Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-10-28 17:10:34 -04:00
Sebastiaan van Stijn
1f5c82b9fa client: add option and output structs for various container methods
Add option- and output structs for;

- Client.ContainerKill
- Client.ContainerPause
- Client.ContainerRemove
- Client.ContainerResize
- Client.ContainerRestart
- Client.ContainerStart
- Client.ContainerStop
- Client.ContainerUnpause

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-27 23:46:28 +01:00
Sebastiaan van Stijn
8118385ba8 client: ContainerStats: add option, output-structs, remove ContainerStatsOneShot
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-27 14:03:55 +01:00
Sebastiaan van Stijn
155d697010 integration/container: TestStats: use sub-tests
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-27 12:43:47 +01:00
Sebastiaan van Stijn
425975313a client: merge ContainerInspectWithRaw with ContainerInspect
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-24 22:01:23 +02:00
Sebastiaan van Stijn
12123eb592 client: merge ExecInspectResult with ExecInspect
The `ExecInspectResult` type was embedding `ExecInspect`, which is also
defined by the client, so there's no need to abstract it.

While updating, also;

- Rename `ExecID` to `ID`, to match the field-name returned by the API.
- Rename `Pid` to `PID`, to be in the right casing.
- Remove `json` labels, as option-types are not (un)marshaled to JSON.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-24 15:05:36 +02:00
Sebastiaan van Stijn
832590155c client: ExecCreateResult: define local type with ID field
The `ExecCreateResult` was embedding the `container.ExecCreateRespons`,
which in itself was an alias for `common.IDResponse`. This type has a
single field (`ID`) currently, but the embedding made it awkward to use,
for example, when mocking a `ExecCreateResult` using struct-literals:

    func execCreateWithID(_ string, _ client.ExecCreateOptions) (client.ExecCreateResult, error) {
        return client.ExecCreateResult{ExecCreateResponse: container.ExecCreateResponse{ID: "execid"}}, nil
    }

This patch defines it as a local type with the `ID` as field.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-24 15:05:35 +02:00