Compare commits

...

1990 Commits

Author SHA1 Message Date
Paweł Gronowski
64df04c897 Merge pull request #51370 from vvoland/vendor-api
vendor: github.com/moby/moby/api v1.52.0-beta.4
2025-10-31 19:11:57 +01:00
Paweł Gronowski
93c273dc11 vendor: github.com/moby/moby/api v1.52.0-beta.4
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-10-31 18:57:59 +01:00
Paweł Gronowski
3d96d16e7a Merge pull request #51338 from vvoland/drop-replace
client: Drop replace rules
2025-10-31 18:55:28 +01:00
Paweł Gronowski
56bd456694 Drop replace rules
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-10-31 18:41:46 +01:00
Sebastiaan van Stijn
ba3f5f56dc Merge pull request #51368 from vvoland/hack-vendor-dropreplace
hack/vendor: Make dropreplace vendor latest version
2025-10-31 18:23:12 +01:00
Sebastiaan van Stijn
42eb0aa973 Merge pull request #51360 from AkihiroSuda/deprecate-cgroup1
Deprecate cgroup v1
2025-10-31 17:41:23 +01:00
Paweł Gronowski
1e56b87f7f hack/vendor: Make dropreplace vendor latest version
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-10-31 17:24:21 +01:00
Paweł Gronowski
76ba3b6a4b Merge pull request #51366 from vvoland/client-removeimagecreate
client: Remove ImageCreate in favor of ImagePull/ImageImport
2025-10-31 16:36:38 +01:00
Sebastiaan van Stijn
455e4e523f Merge pull request #51269 from austinvazquez/refactor-client-network
client: refactor create network api implementation to define options/result struct
2025-10-31 15:46:53 +01:00
Paweł Gronowski
73455ce01a client: Remove ImageCreate in favor of ImagePull/ImageImport
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-10-31 14:48:54 +01:00
Sebastiaan van Stijn
560dfb13c9 Merge pull request #51362 from vvoland/inspcet-config-nonnil
api/container_inspect: Ensure Config is not nil in inspect response
2025-10-31 13:49:01 +01:00
Paweł Gronowski
fd1593c067 api/container_inspect: Ensure Config is not nil in inspect response
Ensure that the JSON response for the `GET /containers/{name}/json`
outputs an empty object instead of a nil config.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-10-31 12:41:39 +01:00
Paweł Gronowski
3287abc965 Merge pull request #51187 from thaJeztah/bump_test_cli
Dockerfile: update integration-cli CLI to v25.0.5
2025-10-31 11:51:12 +01:00
Sebastiaan van Stijn
6aea8c2591 Dockerfile: update integration-cli CLI to v25.0.5
Now that we're raising the minimum API version, we can also update
the CLI used in our integration-cli tests.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-31 09:22:40 +01:00
Akihiro Suda
4bcd446f03 Deprecate cgroup v1
Fix issue 51111

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2025-10-31 17:00:33 +09:00
Austin Vazquez
a087d03e0c client: refactor create network api implementation to wrap options/results
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-30 23:45:18 -05:00
Sebastiaan van Stijn
d96f50518f Merge pull request #51359 from thaJeztah/move_version_types
api/types: move Version to api/types/system
2025-10-31 03:15:17 +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
Sebastiaan van Stijn
12c9de37e9 api/types: move Version to api/types/system
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-31 02:09:38 +01:00
Sebastiaan van Stijn
f6ee11fe60 Merge pull request #51357 from thaJeztah/internalize_pushresult
api/types: remove PushResult type, and move internal
2025-10-31 02:02:06 +01:00
Austin Vazquez
ec3b3a235d Merge pull request #51358 from thaJeztah/add_deprecated_version_fields
client: ServerVersionResult: add back legacy fields
2025-10-30 19:45:33 -05:00
Sebastiaan van Stijn
3d28cb8bbd client: ServerVersionResult: add back legacy fields
Short term solution; we need to decide whether these should be kept
or removed.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-31 01:21:10 +01:00
Sebastiaan van Stijn
d7bd5092d9 Merge pull request #51356 from robmry/compat-replace-nil-pointer
API compat: replace nil values when adding fields
2025-10-31 01:13:20 +01:00
Sebastiaan van Stijn
ebe464ea45 api/types: remove PushResult type, and move internal
This type was used as Aux message for docker push, was not documented,
and only present for Docker Content Trust (which is deprecated).

This patch removes it from the API module, and moves the type internal.
We can stop sending this Aux message once DCT is fully phased out.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-31 00:47:23 +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
Sebastiaan van Stijn
466f2d2e5d Merge pull request #51354 from vvoland/bye-namegen
Move namesgenerator to internal
2025-10-31 00:25:03 +01:00
Rob Murray
22c037982c API compat: replace nil values when adding fields
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-10-30 22:48:32 +00:00
Sebastiaan van Stijn
97a1d44f05 Merge pull request #51342 from thaJeztah/client_platforms
client: prepare option-structs for multiple platforms
2025-10-30 22:18:58 +01: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
433023a03d Move namesgenerator to internal
It's frozen and only kept for historical/legacy purposes.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-10-30 19:41:58 +01: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
72f6cec125 Merge pull request #51333 from thaJeztah/new_client
client: deprecate NewClientWithOpts in favor of New
2025-10-30 18:23:46 +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
Sebastiaan van Stijn
137adde33d client: prepare option-structs for multiple platforms
Some methods currently support a single platform only, but we may
be able to support multiple platforms.

This patch prepares the option-structs for multi-platform support,
but (for now) returning an error if multiple options are provided.

We need a similar check on the daemon-side, but still need to check
on the client, as older daemons will ignore multiple platforms, which
may be unexpected.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-30 18:04:34 +01:00
Sebastiaan van Stijn
a96bc9e93c Merge pull request #51233 from austinvazquez/refactor-client-version
client: refactor ServerVersion to return ServerVersionResult
2025-10-30 17:59:05 +01:00
Austin Vazquez
860307c4ea client: refactor ServerVersion to return ServerVersionResult
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-30 14:22:41 +01:00
Sebastiaan van Stijn
32f90ab113 Merge pull request #51340 from thaJeztah/client_subtests
client: use sub-tests for ContainerLogs, ServiceLogs tests
2025-10-30 14:11:36 +01:00
Sebastiaan van Stijn
6c042389a3 client: use sub-tests for ServiceLogs
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-30 11:31:18 +01:00
Sebastiaan van Stijn
e8e7f1a500 client: use sub-tests for ContainerLogs
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-30 11:27:48 +01:00
Paweł Gronowski
7a97e1cb40 Merge pull request #51334 from thaJeztah/rename_auth
api/types/registry: rename AuthenticateOKBody to AuthResponse
2025-10-29 23:51:39 +01:00
Paweł Gronowski
fc889b10dd Merge pull request #51336 from thaJeztah/rename_validation
daemon: improve validation for container rename
2025-10-29 23:33:42 +01:00
Paweł Gronowski
4a93d62d39 Merge pull request #51329 from thaJeztah/runc_bump
Dockerfile: update runc binary to v1.3.2
2025-10-29 21:25:02 +01:00
Sebastiaan van Stijn
a5c0f152a7 daemon: improve validation for container rename
Improve validation for empty name; while the daemon already handled empty
strings, it didn't account for the "canonical" name with "/" prefix, for
which it would produce an obscure error:

    Error response from daemon: Error when allocating new name: Invalid container name (/ ), only [a-zA-Z0-9][a-zA-Z0-9_.-] are allowed

Before this change:

    curl -XPOST --unix-socket /var/run/docker.sock 'http://localhost/v1.51/containers/old/rename?name='
    {"message":"Neither old nor new names may be empty"}

    curl -XPOST --unix-socket /var/run/docker.sock 'http://localhost/v1.51/containers/old/rename?name=/'
    {"message":"Error when allocating new name: Invalid container name (/), only [a-zA-Z0-9][a-zA-Z0-9_.-] are allowed"}

    curl -XPOST --unix-socket /var/run/docker.sock 'http://localhost/v1.51/containers/old/rename?name=/hello'
    # OK

A check was added in the client as well for situations where an older daemon
is used; the same code currently was implemented in the CLI.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-29 18:42:36 +01:00
Sebastiaan van Stijn
7a8d8733c0 Merge pull request #51330 from thaJeztah/fix_client_example
client: fix example, and add runnable example
2025-10-29 18:17:34 +01:00
Sebastiaan van Stijn
0eba2989e0 api/types/registry: rename AuthenticateOKBody to AuthResponse
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-29 18:06:29 +01:00
Sebastiaan van Stijn
ef17deb3a0 Merge pull request #51332 from austinvazquez/remove-unused-import
client: remove unused import
2025-10-29 17:58:53 +01:00
Austin Vazquez
6cf02b5cba client: remove unused import
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-29 11:21:52 -05: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
Sebastiaan van Stijn
3c62b06de2 client: fix example, and add runnable example
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-29 15:16:58 +01:00
Sebastiaan van Stijn
90e7232c8e Dockerfile: update runc binary to v1.3.2
Update the version used in CI and for the static binaries.

- release notes: https://github.com/opencontainers/runc/releases/tag/v1.3.2
- full diff: https://github.com/opencontainers/runc/compare/v1.3.0...v1.3.2

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-29 14:38:17 +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
Austin Vazquez
214cd508c0 Merge pull request #51327 from thaJeztah/unexport_NewVersionError
client: un-export NewVersionError, rename to requiresVersion
2025-10-29 08:08:41 -05:00
Austin Vazquez
a7a94c393d Merge pull request #51325 from thaJeztah/refactor_client_network_step1
client: refactor NetworkConnect, NetworkDisconnect, NetworkRemove
2025-10-29 08:06:32 -05: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
Austin Vazquez
e9f28e2a41 client: refactor NetworkConnect, NetworkDisconnect, NetworkRemove
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-29 13:02:01 +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
Paweł Gronowski
f708214dbf Merge pull request #51324 from thaJeztah/network_connect_disconnect
api/types/network: define `ConnectRequest` and `DisconnectRequest`
2025-10-29 12:56:15 +01:00
Sebastiaan van Stijn
2d6bf9332b client: un-export NewVersionError, rename to requiresVersion
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-29 12:44:41 +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
51a0584088 client: ContainerWait: touch-up GoDoc, remove legacy code
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-29 12:37:42 +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
Austin Vazquez
bae45f766d api/types/network: define ConnectRequest and DisconnectRequest
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-29 11:44:18 +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
Sebastiaan van Stijn
755a8c9e6c Merge pull request #51321 from vvoland/gha-labeler-fix
gha/labeler: Fix dependencies
2025-10-29 11:41:13 +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
Paweł Gronowski
f8b9396c2c gha/labeler: Fix dependencies
Make sure that ALL (not ANY) conditions are satisfied

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-10-29 11:21:51 +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
Sebastiaan van Stijn
c438b3fbbf Merge pull request #51314 from austinvazquez/refactor-client-container-list
client: refactor `ContainerList` to wrap result
2025-10-29 08:31:22 +01:00
Sebastiaan van Stijn
2bb019b1d2 Merge pull request #51313 from austinvazquez/refactor-client-container-top
client: refactor `ContainerTop` to wrap options and results
2025-10-29 08:29:22 +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
ec22a1e5b2 client: refactor ContainerTop to wrap options and results
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-28 18:54:43 -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
Austin Vazquez
4ce86e2c9b Merge pull request #51310 from thaJeztah/volume_output_structs
client: VolumeRemove, VolumeUpdate: add output struct
2025-10-28 18:14:24 -05:00
Austin Vazquez
aa380c26fc Merge pull request #51304 from thaJeztah/faulty_defers
fix some faulty defers in tests
2025-10-28 18:11:19 -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
Austin Vazquez
e95f6c8191 Merge pull request #51307 from thaJeztah/ping_once
client: remove NegotiateAPIVersion, NegotiateAPIVersionPing
2025-10-28 14:08:56 -05:00
Sebastiaan van Stijn
848b0452d3 client: VolumesPrune: rename argument for consistency
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-28 15:42:34 +01:00
Sebastiaan van Stijn
1985a8979e client: VolumeUpdate: add output struct, and move "version"
- Add a VolumeUpdateResult output struct
- Move the swarm version argument to the options, to align
  with other swarm-related methods.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-28 15:42:33 +01:00
Sebastiaan van Stijn
faee204c02 client: VolumeRemove: add output struct
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-28 15:42:33 +01:00
Sebastiaan van Stijn
90109a373d Merge pull request #51308 from thaJeztah/client_container_types
client: add option and output structs for various container methods
2025-10-28 15:42:25 +01:00
Sebastiaan van Stijn
9e7e01ef16 Merge pull request #51153 from corhere/excise-json-streams-from-api
api: move `pkg/streamformatter`, `pkg/progress` to `daemon/internal`
2025-10-28 13:36:16 +01: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
bbf3dea9b2 Merge pull request #51305 from thaJeztah/stats_ostype
api/types/container: StatsResponse: add OSType field, remove client.ContainerStatsResult.OSType
2025-10-27 21:14:43 +01:00
Sebastiaan van Stijn
edbf321ce6 client: remove NegotiateAPIVersion, NegotiateAPIVersionPing
Remove these methods in favor of adding negotiation options to the
Ping method.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-27 19:27:48 +01:00
Sebastiaan van Stijn
c4aee2a50e client: remove ContainerStatsResult.OSType field
The API now includes this information per record, and clients can
get this information using the `Ping` method if needed as fallback.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-27 17:20:16 +01:00
Sebastiaan van Stijn
6a2a1dd6cf api/types/container: StatsResponse: add OSType field
Adds a per-stats OSType field to allow handle the platform-specific fields.
Before this change, the client had to get the OSType field from the server's
API response header and copy it to each record.

Older daemon versions don't have this field, so the client still needs to
handle fallbacks.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-27 16:39:32 +01:00
Sebastiaan van Stijn
25d16ddc0e Merge pull request #51293 from thaJeztah/merge_stats
client: ContainerStats: add option, output-structs, remove ContainerStatsOneShot
2025-10-27 16:13:47 +01:00
Sebastiaan van Stijn
8498525a98 Merge pull request #51298 from thaJeztah/cleaner_stats
daemon: stats: cleanup and remove "OneShot" error
2025-10-27 15:18:39 +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
de2ff4973f Merge pull request #51303 from thaJeztah/merge_stats_step1
integration-cli, integration: cleanup and improve some "stats" tests
2025-10-27 13:59:04 +01:00
Sebastiaan van Stijn
5df881f3a7 daemon: Daemon.ContainerStats: don't escape HTML in responses
We have no need for it, and keeps the response more readable in case
it would ever contain any values that need escaping; it also would save
some cycles to check for such characters.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-27 12:46:03 +01:00
Sebastiaan van Stijn
7623979aba daemon: Daemon.ContainerStats: combine some conditions and remove error
When streaming stats, the `OneShot` option is implied; streaming results
never populate the Pre* fields on the first result, so instead of producing
an error, we may as well ignore the option.

While updating this, also combine some of the conditions for non-streaming
results in an attempt to make the logic (early return on non-streaming,
one-shot requests) slightly clearer.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-27 12:46:02 +01:00
Sebastiaan van Stijn
95a3880197 daemon: Daemon.ContainerStats: inline getStatJSON closure
Inline the code that handles preserving the previous read and putting
it in the next read, and rename some variables for clarity.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-27 12:46:02 +01:00
Sebastiaan van Stijn
f7003ef7de integration-cli: minor cleanups in stats tests
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-27 12:45:12 +01:00
Sebastiaan van Stijn
5742b40c87 integration-cli: simplify, improve some stats tests
Remove the go-routines and just fetch the result for non-streaming stats.
Also check for the result to be valid for some tests.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-27 12:45:05 +01:00
Sebastiaan van Stijn
e690c84bed integration-cli: remove TestAPIStatsNetworkStatsVersioning
It was a leftover for pre-API v1.21 tests.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-27 12:43:48 +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
6511d86797 Merge pull request #51302 from thaJeztah/fix_one_shot_stats
daemon: Daemon.stats: fill-in container ID and Name when collecting
2025-10-27 12:42:47 +01:00
Sebastiaan van Stijn
6040a2f686 fix some faulty defers in tests
Calling "defer assert.NilError(t, someCommand())" executes "someCommand()"
immediately, but doesn't assert the error until the defer.
https://go.dev/play/p/EO--y7OYerg

    package main

    import (
        "errors"
        "testing"

        "gotest.tools/v3/assert"
    )

    func TestDefer(t *testing.T) {
        doSomething := func() error {
            t.Log("doSomething failed with an error!")
            return errors.New("foo error")
        }

        defer assert.NilError(t, doSomething())

        t.Log("running test")
        t.Log("running test")
        t.Log("running test")
    }

Produces:

    === RUN   TestDefer
        prog_test.go:12: doSomething failed with an error!
        prog_test.go:18: running test
        prog_test.go:19: running test
        prog_test.go:20: running test
        prog_test.go:21: assertion failed: error is not nil: foo error
    --- FAIL: TestDefer (0.00s)
    FAIL

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-27 12:39:21 +01:00
Sebastiaan van Stijn
370ca31ecf Merge pull request #51299 from thaJeztah/cleanup_stats_type
api/types/container: StatsResponse: cleanup fields and GoDoc
2025-10-27 12:08:58 +01:00
Sebastiaan van Stijn
e410daf8f7 integration-cli: TestContainerAPIStatsWithNetworkDisabled: check result
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-27 10:55:01 +01:00
Sebastiaan van Stijn
7439f09cd2 daemon: Daemon.stats: fill-in container ID and Name when collecting
Propagate these fields when collecting the data, instead of patching the
result inside the router.

This also fixes a bug where the ID and Name fields were not set when using
one-shot.

Before this patch, the "id" and "name" fields were not set in one-shot mode:

    curl -s --unix-socket /var/run/docker.sock 'http://localhost/v1.51/containers/foo/stats?stream=false' | jq .id
    "125d7f3df7919c33195fa4ec0636c27cdbe6d9b14339867d2920900565bcaf7e"
    curl -s --unix-socket /var/run/docker.sock 'http://localhost/v1.51/containers/foo/stats?stream=false' | jq .name
    "/foo"

    curl -s --unix-socket /var/run/docker.sock 'http://localhost/v1.51/containers/foo/stats?stream=false&one-shot=true' | jq .id
    null
    curl -s --unix-socket /var/run/docker.sock 'http://localhost/v1.51/containers/foo/stats?stream=false&one-shot=true' | jq .name
    null

With this patch, both are set:

    curl -s --unix-socket /var/run/docker.sock 'http://localhost/v1.51/containers/foo/stats?stream=false&one-shot=true' | jq .id
    "125d7f3df7919c33195fa4ec0636c27cdbe6d9b14339867d2920900565bcaf7e"
    curl -s --unix-socket /var/run/docker.sock 'http://localhost/v1.51/containers/foo/stats?stream=false&one-shot=true' | jq .name
    "/foo"

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-27 10:55:01 +01:00
Sebastiaan van Stijn
882cffee93 Merge pull request #51297 from thaJeztah/remove_ImageLoadResult_json
client: remove ImageLoadResult.JSON
2025-10-26 21:35:03 +01:00
Sebastiaan van Stijn
3088c4e192 api/types/container: StatsResponse: cleanup fields and GoDoc
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-26 20:37:40 +01:00
Sebastiaan van Stijn
9b795c53a7 client: remove ImageLoadResult.JSON field
The JSON field was added in [moby@9fd2c0f], to address [moby#19177], which
reported an incompatibility with Classic (V1) Swarm, which produced a non-
standard response;

> Make docker load to output json when the response content type is json
> Swarm hijacks the response from docker load and returns JSON rather
> than plain text like the Engine does. This makes the API library to return
> information to figure that out.

A later change in [moby@96d7db6] added additional logic to make sure the
correct content-type was returned, depending on whether the `quiet` option
was set (which produced a non-JSON response). This caused inconsistency in
the API response, and [moby@2f27632] changed the endpoint to always produce
JSON (only skipping the "progress" output if `quiet` was set).

This means that the "load" endpoint ([`imageRouter.postImagesLoad`]) now
unconditionally returns JSON, making the `JSON` field fully redundant.

We should consider deprecating the "quiet" option, as it's really the client's
responsibility to show or hide progress-bars, but we can do this separately.

This patch removes the JSON field, as it's redundant, and the way it handles
the content-type is incorrect because it would not handle correct, but different
formatted response-headers (`application/json; charset=utf-8`), which could
result in malformed output on the client.

[moby@9fd2c0f]: 9fd2c0feb0
[moby#19177]: https://github.com/moby/moby/issues/19177
[moby@96d7db6]: 96d7db665b
[moby@2f27632]: 2f27632cde
[`imageRouter.postImagesLoad`]: 7b9d2ef6e5/api/server/router/image/image_routes.go (L248-L255)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-26 19:46:49 +01:00
Rob Murray
0a134ecc16 Merge pull request #51296 from thaJeztah/fix_ImageLoadResult_godoc
client: fix ImageLoadResult GoDoc
2025-10-26 15:22:50 +00:00
Sebastiaan van Stijn
ef589ef824 client: fix ImageLoadResult GoDoc
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-26 12:30:18 +01:00
Paweł Gronowski
c8df751f86 Merge pull request #51294 from thaJeztah/daemon_cleanups
daemon: some minor cleanups
2025-10-26 11:21:27 +01:00
Sebastiaan van Stijn
bc2d0b4b5a Merge pull request #51289 from vvoland/client-container-exec2
client/container_exec: Separate structs for Start and Attach
2025-10-25 19:30:59 +02:00
Sebastiaan van Stijn
5cf4d68121 daemon: subscribeToContainerStats: return cancel / unsubscribe function
Rewrite this method to return a function to cancel / unsubscribe, so that
callers are encouraged to handle this.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-25 16:15:50 +02:00
Sebastiaan van Stijn
99410827c7 daemon: use errdefs instead of string-matching in some places
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-25 16:13:30 +02:00
Paweł Gronowski
4aac139fc0 client/container_exec: Separate structs for Start and Attach
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-10-25 12:23:14 +02:00
Austin Vazquez
f3635236b6 Merge pull request #51290 from thaJeztah/container_noraw
client: merge ContainerInspectWithRaw with ContainerInspect
2025-10-24 19:25:10 -05: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
be8d6e2f28 Merge pull request #51288 from thaJeztah/json_raw
client: change Raw fields to be json.RawMessage
2025-10-24 21:35:08 +02:00
Sebastiaan van Stijn
58356450fa client: remove redundant closing and draining of response
For methods using the decodeWithRaw utility, we were handling closing
of the body twice. The ensureReaderClosed utility also drains the
response to let the transport reuse the connnection. Let's use that
utility in decodeWithRaw as well.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-24 19:30:22 +02:00
Sebastiaan van Stijn
ddbb503dc7 client: change Raw fields to be json.RawMessage
These fields store the raw JSON data that we received, and should
never container bytes that are non-JSON (as we'd error out when
failing to unmarshal).

Change the type to a json.RawMessage, which:

- Is more explicit on intent
- Can still be used as a regular []byte in all cases

And, while it's not expected to be marshaled to JSON, doing so will also
print the output in a readable format instead of base64 encoding;

    package main

    import (
        "encoding/json"
        "fmt"
    )

    func main() {
        foo := struct {
            Bytes []byte
            Raw   json.RawMessage
        }{
            Bytes: []byte(`{"hello": "world"}`),
            Raw:   json.RawMessage(`{"hello": "world"}`),
        }

        out, _ := json.MarshalIndent(foo, "", "  ")
        fmt.Println(string(out))
    }

Will print:

    {
      "Bytes": "eyJoZWxsbyI6ICJ3b3JsZCJ9",
      "Raw": {
        "hello": "world"
      }
    }

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-24 19:07:26 +02:00
Sebastiaan van Stijn
2bda4a2001 Merge pull request #51285 from thaJeztah/client_fixes
client: assorted fixes and refactor
2025-10-24 18:44:10 +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
378116a84f client: ImageImportResult: prevent panic on nil reader
This panicked when creating a stub; we need to look for better ways to
allow stubbing these (perhaps we need to expose the rc / body)?

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-24 15:05:36 +02:00
Sebastiaan van Stijn
0b7b7625c6 client: rename NodeUpdateOptions.Node to NodeUpdateOptions.Spec
Align with the other swarm-types, which use `Spec` for updates.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-24 15:05:35 +02:00
Sebastiaan van Stijn
875c577711 client: consolidate node options with their methods
Move them together, as we did for most of the other options.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-24 15:05:35 +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
Sebastiaan van Stijn
c6a45784f9 client: VolumeListResult: define local type
The `VolumeListResult.Items` field was a `volume.ListResponse`, which
in itself also had two slices (for volumes, and warnings). The Volumes
field contained a slice of pointers to Volumes.

This patch:

- Re-defines `ImageRemoveResult` as a distinct type, containing the
  content of the `volume.ListResponse.Volumes` and `.Warnings`.
- The `VolumeListResult` doesn't use a pointer for the volumes to make
  it slightly easier to deal with (possibly the API type could be
  changed as well, which could allow us to simplify the client code.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-24 15:05:30 +02:00
Cory Snider
687c3d7f42 api/types/jsonstream: define Message type
The schema of a JSON-stream message is very pertinent to the api module.
Provide a canonical definition in the api module and refactor the daemon
code to use it. Drop the long-deprecated ErrorMessage field from the API
definition, but have the daemon continue to emit it for compatibility
with docker-py v7.1.0.

Co-authored-by: Cory Snider <csnider@mirantis.com>
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-24 07:56:58 -05:00
Cory Snider
ae28867804 api/pkg/progress: move to client and daemon/internal
Move the progress package up into the client as a temporary shared location for
common clients like CLI and compose.

The progress package is used by the daemon to write progress updates to
some sink, typically a streamformatter. This package is of little use to
API clients as this package does not provide any facilities to consume
the progress updates.

Co-authored-by: Cory Snider <csnider@mirantis.com>
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-24 07:56:57 -05:00
Cory Snider
6baf274fa3 api/pkg/streamformatter: move to client and daemon/internal
Move the streamformatter package up into the client for a temporary
shared location between common clients like CLI and compose.

The streamformatter package is used by the daemon to write streams of
status and progress messages to API clients. It is completely out of
scope of the api module and not used outside the daemon. Remove the
unused rawSteamFormatter, whose purpose is to render the progress as a
TUI.

Co-authored-by: Cory Snider <csnider@mirantis.com>
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-24 07:56:51 -05:00
Sebastiaan van Stijn
c246639baa client: rename ImageRemoveResult.Deleted to ImageRemoveResult.Items
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-24 14:07:10 +02:00
Sebastiaan van Stijn
8222a3f1d9 Merge pull request #51286 from thaJeztah/fix_integration
integration/service: fix tests for updated client
2025-10-24 14:06:55 +02:00
Sebastiaan van Stijn
fb85d123c1 integration/service: fix tests for updated client
These tests were added in ea59a8d74e, but it
was merged out of order, not yet picking up changes made in the client.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-24 13:51:47 +02:00
Sebastiaan van Stijn
f9082484c9 Merge pull request #51278 from vvoland/client-container-opts2
client_(attach,commit,create,diff): Wrap result and options
2025-10-24 13:41:23 +02:00
Paweł Gronowski
ea59a8d74e Merge pull request #51114 from dperny/memory_flags_for_swarm
Add support for memory swap settings for services
2025-10-24 10:04:17 +02:00
Paweł Gronowski
963d9c7fee Merge pull request #51284 from austinvazquez/move-pkg-versions
api: move types/versions to client/pkg and daemon/internal
2025-10-24 09:59:22 +02:00
Austin Vazquez
f40e1a7582 api: move types/versions to client/pkg and daemon/internal
This change moves the api/types/versions package out into client and daemon versions.

Co-authored-by: Claude <noreply@anthropic.com>
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-23 19:22:31 -05:00
Austin Vazquez
e62b820f36 Merge pull request #51282 from austinvazquez/vendor-aws-dependencies
vendor: github.com/aws/smithy-go@v1.23.1; github.com/aws/aws-sdk-go-v2@v1.39.4; github.com/aws/aws-sdk-go-v2/*
2025-10-23 17:11:39 -05:00
Austin Vazquez
d2fb85bef6 Merge pull request #51281 from austinvazquez/vendor-golang.org-x
vendor: golang.org/x/* dependencies
2025-10-23 17:11:07 -05:00
Austin Vazquez
c9b3c65f37 vendor: github.com/aws/aws-sdk-go-v2/config@v1.31.15
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-23 15:41:34 -05:00
Austin Vazquez
b3129817a7 vendor: github.com/aws/aws-sdk-go-v2/credentials v1.18.19
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-23 15:41:34 -05:00
Austin Vazquez
1b2015a26f vendor: github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs v1.58.5
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-23 15:41:33 -05:00
Austin Vazquez
7f7588be22 vendor: github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.11
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-23 15:41:33 -05:00
Austin Vazquez
f82fa7a4b2 vendor: github.com/aws/aws-sdk-go-v2 v1.39.4
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-23 15:41:33 -05:00
Austin Vazquez
529076c7b4 vendor: github.com/aws/smith-go v1.23.1
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-23 15:41:33 -05:00
Austin Vazquez
031f30340b vendor: golang.org/x/net v0.46.0
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-23 15:27:37 -05:00
Austin Vazquez
8afa422f0c vendor: golang.org/x/time v0.14.0
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-23 15:26:45 -05:00
Austin Vazquez
8c88244d7f vendor: golang.org/x/text v0.30.0
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-23 15:26:01 -05:00
Austin Vazquez
8d3ae564e0 vendor: golang.org/x/mod v0.29.0
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-23 15:25:03 -05:00
Austin Vazquez
7563a498f0 vendor: golang.org/x/sys v0.37.0
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-23 15:24:17 -05:00
Paweł Gronowski
8fb561ca9a client/container_create: Add Image outside of Config
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-10-23 21:11:30 +02:00
Paweł Gronowski
3340c86db9 client/container_create: Rename ContainerName to Name
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-10-23 21:11:30 +02:00
Paweł Gronowski
bd31b8b1c7 client_(attach,commit,create,diff): Wrap result and options
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-10-23 21:11:30 +02:00
Sebastiaan van Stijn
b398d92e82 Merge pull request #51277 from thaJeztah/tidy_client_utils_step2
client: simplify test with mock-responses
2025-10-23 20:45:06 +02:00
Sebastiaan van Stijn
47fd987af2 client: simplify test with mock-responses
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-23 17:43:10 +02:00
Sebastiaan van Stijn
1d8c8e192f Merge pull request #51279 from thaJeztah/refactor_service_update
client: refactor ServiceCreate, ServiceUpdate, SwarmUpdate
2025-10-23 17:40:33 +02:00
Sebastiaan van Stijn
3a43b5b559 client: refactor ServiceCreate, ServiceUpdate, SwarmUpdate
Put the version and spec in the options-struct, as we did for other
swarm-related methods.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-23 15:40:18 +02:00
Sebastiaan van Stijn
dcd668d579 Merge pull request #51276 from thaJeztah/tidy_client_utils
client: tidy-up test/mock-utilities
2025-10-23 15:40:03 +02:00
Sebastiaan van Stijn
11809618f6 Merge pull request #51270 from robmry/inspect-api-bc
Inspect: API v1.51 compatibility
2025-10-23 14:59:11 +02:00
Sebastiaan van Stijn
0fe6be8c38 client: remove roundTripFunc, bytesBufferClose
- Use the `mockResponse` instead
- `bytesBufferClose` was our own implementation of `io.NopCloser`

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-23 13:01:54 +02:00
Sebastiaan van Stijn
b9dd7c0d59 client: tidy-up mock-utilities
- Add a `mockResponse` utility, and slightly enhance it to also include
  the request Headers and Status message, to be more closely to actual
  responses.
- Add a `mockJSONResponse` utility, implemented using `mockResponse`
- Remove `plainTextErrorMock` in favor of `mockResponse`

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-23 13:01:41 +02:00
Sebastiaan van Stijn
a315437e1c client: rename transportFunc -> testRoundTripper
Rename it so that it's clearer that it's intended for test-purposes,
and adding a `skipConfigureTransport()` method to the signature to
prevent IDEs considering is a redundant convert, and to be more explicit
on intent.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-23 13:01:33 +02:00
Rob Murray
0971a3bcb8 Inspect: API v1.51 compatibility
For API < v1.52:
- In container inspect:
  - Restore GraphDriver when a snapshotter is used.
  - Remove field Storage
  - Related to commit efa077848f
- In image inspect:
  - Restore GraphDriver when a snapshotter is used.
  - Related to commit c441b2ef19

Co-authored-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-10-23 09:24:08 +01:00
Albin Kerouanton
37ac6cec6c Merge pull request #50114 from danegsta/50107-defaultpoolsize
Proposal: Allow specifying the subnet size for networks allocated from default pools
2025-10-23 08:53:38 +02:00
Sebastiaan van Stijn
d9c950f824 Merge pull request #51275 from thaJeztah/client_deadcode
client: remove unused hasEndpointSpecificMacAddress utility
2025-10-23 08:25:02 +02:00
Sebastiaan van Stijn
0049df8315 Merge pull request #51273 from austinvazquez/refactor-client-service-list
client: rename `ServiceListResult.Services` to `ServiceListResult.Items`
2025-10-23 00:19:30 +02:00
Sebastiaan van Stijn
f733b411a1 client: remove unused hasEndpointSpecificMacAddress utility
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-22 23:16:37 +02:00
Sebastiaan van Stijn
f2412e7ab4 Merge pull request #51262 from vvoland/client-containerexec-opts
client/container_exec: Wrap options and result
2025-10-22 23:08:50 +02:00
Austin Vazquez
5a5d39205c client: rename ServiceListResult.Services to ServiceListResult.Items
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-22 15:55:03 -05:00
Paweł Gronowski
94ab385eb5 client/container_exec: Wrap options and result, rename to Exec
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-10-22 22:48:59 +02:00
David Negstad
ea0d934ff2 Allow requesting networks with a custom prefix size from the default pools
Signed-off-by: David Negstad <David.Negstad@microsoft.com>
2025-10-22 12:45:55 -07:00
Akihiro Suda
00abc3a9d5 Merge pull request #51266 from thaJeztah/please_linters
client: please the linters
2025-10-23 01:42:46 +09:00
Rob Murray
f8ceccd969 Merge pull request #51267 from robmry/delve-1.25.2
Dockerfile: upgrade Delve to v1.25.2
2025-10-22 15:03:30 +01:00
Rob Murray
5c67034952 Dockerfile: upgrade Delve to v1.25.2
Update to the latest version:
- https://github.com/go-delve/delve/releases/tag/v1.25.2
- https://github.com/go-delve/delve/blob/v1.25.2/CHANGELOG.md#1252-2025-08-26

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-10-22 14:38:44 +01:00
Sebastiaan van Stijn
4ae709eaa4 Merge pull request #51264 from vvoland/client-distrib-opts
client/distribution_inspect: Wrap options and result
2025-10-22 15:12:22 +02:00
Sebastiaan van Stijn
c1ab6eb5f9 Merge pull request #51256 from austinvazquez/refactor-client-plugin
client: refactor plugin api client functions to define options/result…
2025-10-22 15:11:39 +02:00
Sebastiaan van Stijn
5b46429122 client: please the linters
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-22 14:25:09 +02:00
Sebastiaan van Stijn
01c36ec0cd Merge pull request #51265 from thaJeztah/client_gofumpt
client: gofumpt
2025-10-22 14:11:02 +02:00
Sebastiaan van Stijn
c7fe7136d2 client: gofumpt
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-22 14:01:01 +02:00
Austin Vazquez
909e32b27d client: refactor plugin api client functions to define options/results structs
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-22 13:45:03 +02:00
Paweł Gronowski
ee49bbabb3 Merge pull request #51261 from thaJeztah/fix_api_godoc
api/types: fix godoc
2025-10-22 13:35:09 +02:00
Paweł Gronowski
eddf1a1ad6 Merge pull request #51260 from vvoland/client-node-opts
client/node: Wrap options and output
2025-10-22 13:09:21 +02:00
Paweł Gronowski
362e9d088f client/distribution_inspect: Wrap options and result
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-10-22 13:00:44 +02:00
Sebastiaan van Stijn
78d228b84e Merge pull request #51258 from thaJeztah/client_ping
api/types: move Ping and swarm.Status to client
2025-10-22 12:47:42 +02:00
Sebastiaan van Stijn
f09ca78b45 api/types: fix godoc
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-22 12:09:04 +02:00
Paweł Gronowski
7ceea4148a client/node: Wrap options and output
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-10-22 12:02:05 +02:00
Sebastiaan van Stijn
25c509b026 Merge pull request #51251 from thaJeztah/secret_refactor
client/secrets: Wrap results and options
2025-10-22 11:50:01 +02:00
Sebastiaan van Stijn
8dc5d1e64d api/types: move Ping and swarm.Status to client
The API does not produce these as a response; the fields in the Ping
struct, including the Swarm status are propagated from headers returned
by the /_ping endpoint.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-22 11:05:08 +02:00
Akihiro Suda
695a465211 Merge pull request #47335 from thaJeztah/containerd_binary_2.0.0-beta.2
Dockerfile: test containerd v2.1.4
2025-10-22 17:16:30 +09:00
Austin Vazquez
9821df9b8e Merge pull request #51227 from vvoland/client-image-opts
client/image: Wrap result and options in structs
2025-10-21 20:42:14 -05:00
Austin Vazquez
a1cb9fe444 Merge pull request #51252 from austinvazquez/refactor-client-service
client: refactor service api client functions for defined options/res…
2025-10-21 20:25:13 -05:00
Paweł Gronowski
6819a9fc1e client/image_tag: Wrap options and result
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-10-21 19:38:12 -05:00
Paweł Gronowski
347693a580 client/image_remove&search: Wrap options and result
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-10-21 19:37:18 -05:00
Paweł Gronowski
b3974f07f5 client/image_list: Wrap options and result
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-21 19:37:12 -05:00
Paweł Gronowski
a7f409014f client/image_create&import: Wrap options and result
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-10-21 19:27:46 -05:00
Paweł Gronowski
5cc1e5f800 client/build_cancel: Wrap options and result
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-10-21 19:27:46 -05:00
Paweł Gronowski
51ed1a9a37 client/image_build: Rename output to ImageBuildResult
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-10-21 19:27:46 -05:00
Austin Vazquez
136c3b85e2 Merge pull request #51253 from thaJeztah/rm_config_utils
internal/testutil/daemon: remove "Config" utilities
2025-10-21 19:26:35 -05:00
Austin Vazquez
cd08b79c02 client: refactor service api client functions for defined options/result structs
Co-authored-by: Claude <noreply@anthropic.com>
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-21 19:18:07 -05:00
Austin Vazquez
13374b5a72 Merge pull request #51254 from thaJeztah/refactor_plugin_inspect
client: PluginInspectWithRaw: refactor and rename to PluginInspect
2025-10-21 17:48:02 -05:00
Austin Vazquez
fee557c2e2 Merge pull request #51255 from thaJeztah/inspect_options
client: SwarmInspect, VolumeInspect: add options struct
2025-10-21 17:47:26 -05:00
Sebastiaan van Stijn
e3c6dc2a91 client: VolumeInspect: add options struct
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-21 23:36:20 +02:00
Sebastiaan van Stijn
8f50d38231 client: SwarmInspect: add options struct
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-21 23:30:21 +02:00
Sebastiaan van Stijn
95fac07ccc client/secrets: Wrap results and options
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-21 23:18:39 +02:00
Sebastiaan van Stijn
ebc92e015a client: PluginInspectWithRaw: refactor and rename to PluginInspect
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-21 23:14:08 +02:00
Sebastiaan van Stijn
8cd377bd9c internal/testutil/daemon: remove "Config" utilities
These were just shallow wrappers around the api-client, and some
were not used; inline them to help transition these tests to the
integration-suite in future.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-21 22:40:47 +02:00
Austin Vazquez
2401bd1e12 Merge pull request #51250 from thaJeztah/less_log
integration/network: TestServiceWithDefaultAddressPoolInit fix log
2025-10-21 15:15:48 -05:00
Austin Vazquez
94501410a5 Merge pull request #51249 from thaJeztah/config_list_refactor
client: rename ConfigListResult.Configs to ConfigListResult.Items
2025-10-21 15:15:04 -05:00
Austin Vazquez
a6be6140a9 Merge pull request #51247 from thaJeztah/remove_withraw
client: remove VolumeInspectWithRaw, merge with VolumeInspect
2025-10-21 15:13:55 -05:00
Sebastiaan van Stijn
f5b0ce3988 integration/network: TestServiceWithDefaultAddressPoolInit fix log
This log was logging the whole inspect-response, including the "Raw" field;

    === RUN   TestServiceWithDefaultAddressPoolInit
        service_test.go:448: TestServiceWithDefaultAddressPoolInit: NetworkInspect: {Network:{Network:{Name:sthiraTestServiceWithDefaultAddressPoolInit ID:j4k7ql2dbyycbyew1i7fiyif3 Created:2025-10-21 19:00:32.418877317 +0000 UTC Scope:swarm Driver:overlay EnableIPv4:true EnableIPv6:false IPAM:{Driver:default Options:map[] Config:[{Subnet:20.20.1.0/24 IPRange:invalid Prefix Gateway:20.20.1.1 AuxAddress:map[]}]} Internal:false Attachable:false Ingress:false ConfigFrom:{Network:} ConfigOnly:false Options:map[com.docker.network.driver.overlay.vxlanid_list:4097] Labels:map[] Peers:[{Name:661bf7d013f3 IP:127.0.0.1}]} Containers:map[27af69f425142a8916c35f2d3a0ad4b7ea100db2d8309cfb8fb1fd65c1fd0bc1:{Name:TestServiceTestServiceWithDefaultAddressPoolInit.1.kss6lqx8nspg0o42evczitpda EndpointID:692933d4206760cd24b46a3df036dc2b3b8f87bc6f8fc711528a041f95fef084 MacAddress:02:42:14:14:01:03 IPv4Address:20.20.1.3/24 IPv6Address:invalid Prefix} lb-sthiraTestServiceWithDefaultAddressPoolInit:{Name:sthiraTestServiceWithDefaultAddressPoolInit-endpoint EndpointID:4685f15d277e748004bd963919fb34d9ea110415e7267ac68d5900f3dd8abb5d MacAddress:02:42:14:14:01:04 IPv4Address:20.20.1.4/24 IPv6Address:invalid Prefix}] Services:map[TestServiceTestServiceWithDefaultAddressPoolInit:{VIP:20.20.1.2 Ports:[] LocalLBIndex:256 Tasks:[{Name:TestServiceTestServiceWithDefaultAddressPoolInit.1.kss6lqx8nspg0o42evczitpda EndpointID:692933d4206760cd24b46a3df036dc2b3b8f87bc6f8fc711528a041f95fef084 EndpointIP:20.20.1.3 Info:map[Host IP:127.0.0.1]}]}] Status:0xc0001341d0} Raw:[123 34 78 97 109 101 34 58 34 115 116 104 105 114 97 84 101 115 116 83 101 114 118 105 99 101 87 105 116 104 68 101 102 97 117 108 116 65 100 100 114 101 115 115 80 111 111 108 73 110 105 116 34 44 34 73 100 34 58 34 106 52 107 55 113 108 50 100 98 121 121 99 98 121 101 119 49 105 55 102 105 121 105 102 51 34 44 34 67 114 101 97 116 101 100 34 58 34 50 48 50 53 45 49 48 45 50 49 84 49 57 58 48 48 58 51 50 46 52 49 56 56 55 55 51 49 55 90 34 44 34 83 99 111 112 101 34 58 34 115 119 97 114 109 34 44 34 68 114 105 118 101 114 34 58 34 111 118 101 114 108 97 121 34 44 34 69 110 97 98 108 101 73 80 118 52 34 58 116 114 117 101 44 34 69 110 97 98 108 101 73 80 118 54 34 58 102 97 108 115 101 44 34 73 80 65 77 34 58 123 34 68 114 105 118 101 114 34 58 34 100 101 102 97 117 108 116 34 44 34 79 112 116 105 111 110 115 34 58 110 117 108 108 44 34 67 111 110 102 105 103 34 58 91 123 34 83 117 98 110 101 116 34 58 34 50 48 46 50 48 46 49 46 48 47 50 52 34 44 34 73 80 82 97 110 103 101 34 58 34 34 44 34 71 97 116 101 119 97 121 34 58 34 50 48 46 50 48 46 49 46 49 34 125 93 125 44 34 73 110 116 101 114 110 97 108 34 58 102 97 108 115 101 44 34 65 116 116 97 99 104 97 98 108 101 34 58 102 97 108 115 101 44 34 73 110 103 114 101 115 115 34 58 102 97 108 115 101 44 34 67 111 110 102 105 103 70 114 111 109 34 58 123 34 78 101 116 119 111 114 107 34 58 34 34 125 44 34 67 111 110 102 105 103 79 110 108 121 34 58 102 97 108 115 101 44 34 79 112 116 105 111 110 115 34 58 123 34 99 111 109 46 100 111 99 107 101 114 46 110 101 116 119 111 114 107 46 100 114 105 118 101 114 46 111 118 101 114 108 97 121 46 118 120 108 97 110 105 100 95 108 105 115 116 34 58 34 52 48 57 55 34 125 44 34 76 97 98 101 108 115 34 58 123 125 44 34 80 101 101 114 115 34 58 91 123 34 78 97 109 101 34 58 34 54 54 49 98 102 55 100 48 49 51 102 51 34 44 34 73 80 34 58 34 49 50 55 46 48 46 48 46 49 34 125 93 44 34 67 111 110 116 97 105 110 101 114 115 34 58 123 34 50 55 97 102 54 57 102 52 50 53 49 52 50 97 56 57 49 54 99 51 53 102 50 100 51 97 48 97 100 52 98 55 101 97 49 48 48 100 98 50 100 56 51 48 57 99 102 98 56 102 98 49 102 100 54 53 99 49 102 100 48 98 99 49 34 58 123 34 78 97 109 101 34 58 34 84 101 115 116 83 101 114 118 105 99 101 84 101 115 116 83 101 114 118 105 99 101 87 105 116 104 68 101 102 97 117 108 116 65 100 100 114 101 115 115 80 111 111 108 73 110 105 116 46 49 46 107 115 115 54 108 113 120 56 110 115 112 103 48 111 52 50 101 118 99 122 105 116 112 100 97 34 44 34 69 110 100 112 111 105 110 116 73 68 34 58 34 54 57 50 57 51 51 100 52 50 48 54 55 54 48 99 100 50 52 98 52 54 97 51 100 102 48 51 54 100 99 50 98 51 98 56 102 56 55 98 99 54 102 56 102 99 55 49 49 53 50 56 97 48 52 49 102 57 53 102 101 102 48 56 52 34 44 34 77 97 99 65 100 100 114 101 115 115 34 58 34 48 50 58 52 50 58 49 52 58 49 52 58 48 49 58 48 51 34 44 34 73 80 118 52 65 100 100 114 101 115 115 34 58 34 50 48 46 50 48 46 49 46 51 47 50 52 34 44 34 73 80 118 54 65 100 100 114 101 115 115 34 58 34 34 125 44 34 108 98 45 115 116 104 105 114 97 84 101 115 116 83 101 114 118 105 99 101 87 105 116 104 68 101 102 97 117 108 116 65 100 100 114 101 115 115 80 111 111 108 73 110 105 116 34 58 123 34 78 97 109 101 34 58 34 115 116 104 105 114 97 84 101 115 116 83 101 114 118 105 99 101 87 105 116 104 68 101 102 97 117 108 116 65 100 100 114 101 115 115 80 111 111 108 73 110 105 116 45 101 110 100 112 111 105 110 116 34 44 34 69 110 100 112 111 105 110 116 73 68 34 58 34 52 54 56 53 102 49 53 100 50 55 55 101 55 52 56 48 48 52 98 100 57 54 51 57 49 57 102 98 51 52 100 57 101 97 49 49 48 52 49 53 101 55 50 54 55 97 99 54 56 100 53 57 48 48 102 51 100 100 56 97 98 98 53 100 34 44 34 77 97 99 65 100 100 114 101 115 115 34 58 34 48 50 58 52 50 58 49 52 58 49 52 58 48 49 58 48 52 34 44 34 73 80 118 52 65 100 100 114 101 115 115 34 58 34 50 48 46 50 48 46 49 46 52 47 50 52 34 44 34 73 80 118 54 65 100 100 114 101 115 115 34 58 34 34 125 125 44 34 83 101 114 118 105 99 101 115 34 58 123 34 84 101 115 116 83 101 114 118 105 99 101 84 101 115 116 83 101 114 118 105 99 101 87 105 116 104 68 101 102 97 117 108 116 65 100 100 114 101 115 115 80 111 111 108 73 110 105 116 34 58 123 34 86 73 80 34 58 34 50 48 46 50 48 46 49 46 50 34 44 34 80 111 114 116 115 34 58 91 93 44 34 76 111 99 97 108 76 66 73 110 100 101 120 34 58 50 53 54 44 34 84 97 115 107 115 34 58 91 123 34 78 97 109 101 34 58 34 84 101 115 116 83 101 114 118 105 99 101 84 101 115 116 83 101 114 118 105 99 101 87 105 116 104 68 101 102 97 117 108 116 65 100 100 114 101 115 115 80 111 111 108 73 110 105 116 46 49 46 107 115 115 54 108 113 120 56 110 115 112 103 48 111 52 50 101 118 99 122 105 116 112 100 97 34 44 34 69 110 100 112 111 105 110 116 73 68 34 58 34 54 57 50 57 51 51 100 52 50 48 54 55 54 48 99 100 50 52 98 52 54 97 51 100 102 48 51 54 100 99 50 98 51 98 56 102 56 55 98 99 54 102 56 102 99 55 49 49 53 50 56 97 48 52 49 102 57 53 102 101 102 48 56 52 34 44 34 69 110 100 112 111 105 110 116 73 80 34 58 34 50 48 46 50 48 46 49 46 51 34 44 34 73 110 102 111 34 58 123 34 72 111 115 116 32 73 80 34 58 34 49 50 55 46 48 46 48 46 49 34 125 125 93 125 125 44 34 83 116 97 116 117 115 34 58 123 34 73 80 65 77 34 58 123 34 83 117 98 110 101 116 115 34 58 123 34 50 48 46 50 48 46 49 46 48 47 50 52 34 58 123 34 73 80 115 73 110 85 115 101 34 58 53 44 34 68 121 110 97 109 105 99 73 80 115 65 118 97 105 108 97 98 108 101 34 58 50 53 49 125 125 125 125 125 10]}

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-21 21:29:59 +02:00
Sebastiaan van Stijn
2c5e0a008a client: rename ConfigListResult.Configs to ConfigListResult.Items
Also consolidate the options with the method.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-21 20:43:38 +02:00
Sebastiaan van Stijn
30490759b9 Merge pull request #51221 from thaJeztah/libnet_controller
libnetwork: move Network.resolveDriver to Controller
2025-10-21 19:41:14 +02:00
Sebastiaan van Stijn
c18c432852 Merge pull request #51246 from thaJeztah/volume_list
client: rename VolumeListResult.List to VolumeListResult.Items
2025-10-21 19:19:23 +02:00
Sebastiaan van Stijn
67cbf36ac9 client: remove VolumeInspectWithRaw, merge with VolumeInspect
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-21 19:00:57 +02:00
Sebastiaan van Stijn
26d57f42a8 Merge pull request #51245 from thaJeztah/network_opts
client: NetworkInspect, NetworkList: wrap output structs, and remove NetworkInspectWithRaw
2025-10-21 18:50:33 +02:00
Austin Vazquez
e30e80de0a Merge pull request #51244 from austinvazquez/refactor-client-swarm
client: refactor swarm api functions to wrap params/responses
2025-10-21 11:35:56 -05:00
Sebastiaan van Stijn
5a04a9718d client: rename VolumeListResult.List to VolumeListResult.Items
Trying to find a common naming for these fields.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-21 18:07:50 +02:00
Sebastiaan van Stijn
485b95600a client: NetworkList: wrap result
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-21 17:40:19 +02:00
Sebastiaan van Stijn
3fbf5a3bd1 client: NetworkInspect: wrap result and remove NetworkInspectWithRaw
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-21 17:26:24 +02:00
Austin Vazquez
612342198c client: refactor swarm api functions to wrap params/responses
Co-authored-by: Claude <noreply@anthropic.com>
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-21 10:17:04 -05:00
Sebastiaan van Stijn
ac9838ffd1 Merge pull request #51236 from vvoland/client-image-opts-functionalwrap
client/image_(inspect,history,load,save): Wrap return values
2025-10-21 16:54:02 +02:00
Sebastiaan van Stijn
b60738d19f Merge pull request #51234 from austinvazquez/refactor-client-task
client: refactor task responses
2025-10-21 16:52:00 +02:00
Sebastiaan van Stijn
343185cf1a libnetwork: move Network.resolveDriver to Controller
In this method, the network was controlling the controller, and its
driver-registry. That really felt like two steps too far; let's just
move this method to the controller, so that it can stay, at least
_somewhat_ in control of its own, non-exported, properties.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-21 16:50:33 +02:00
Sebastiaan van Stijn
8c1a909601 Merge pull request #51148 from ndeloof/decode-JSONMessage-push
introduce ImagePushResponse
2025-10-21 16:15:49 +02:00
Sebastiaan van Stijn
68e1a8805b Dockerfile: test against containerd v2.1.4
Update the version of containerd used in CI and for static binaries
to v2.1.4

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-21 08:55:48 -05:00
Sebastiaan van Stijn
8a211dea40 Merge pull request #51240 from thaJeztah/hotel_notel
hack: disable go telemetry in integration tests
2025-10-21 15:30:10 +02:00
Rob Murray
7989fea6d2 Merge pull request #51241 from thaJeztah/overlay_pass_context
libnetwork/drivers/overlay: pass context for logger
2025-10-21 14:22:12 +01:00
Sebastiaan van Stijn
ee3cab4158 libnetwork/drivers/overlay: pass context for logger
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-21 15:08:03 +02:00
Sebastiaan van Stijn
bdc7474826 Merge pull request #51229 from olljanat/win-overlay-custom-dns
libnetwork: support custom DNS servers in Windows overlay driver
2025-10-21 14:40:07 +02:00
Austin Vazquez
38ef4fd576 client: refactor task responses
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-21 14:36:30 +02:00
Paweł Gronowski
2d69edd28a client/image_(inspect,history,load,save): Wrap return values
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-21 14:23:38 +02:00
Rob Murray
7066eb3736 Merge pull request #51223 from thaJeztah/cleaner_marshal
libnetwork: EndpointInterface: cleanup marshal/unmarshal
2025-10-21 12:10:36 +01:00
Sebastiaan van Stijn
acc9563f48 Merge pull request #51228 from thaJeztah/move_some_integration_cli_tests
integration-cli: move some tests to integration
2025-10-21 12:48:12 +02:00
Sebastiaan van Stijn
35acf347eb hack: disable go telemetry in integration tests
commit 081987b647 updated the Dockerfile
to disable go's telemetry in our dev / test-environment; as collecting
this data doesn't serve much purpose.

However, the configuration to disable telemetry is tied to the user's
home-directory (HOME); and disabling telemetry writs a config-file to the
user's home-directory (`~/.config/go/telemetry/mode`). While go provides
env-vars about the mode and location (`GOTELEMETRY` and `GOTELEMETRYDIR`),
those env-vars are read-only and cannot be used to either disable telemetry
or to set the location;

> Information about telemetry configuration is also available via read-only Go environment variables:
>
>  go env GOTELEMETRY reports the telemetry mode.
> go env GOTELEMETRYDIR reports the directory holding telemetry configuration and data.

Some steps in our CI set up a different home-directory, which is not configured
to disable telemetry, which means that CI currently leaves behind a bunch of
files related to this;

    make TEST_FILTER=TestPruneDontDeleteUsedDangling test-integration
    tree -a bundles/test-integration/fake-HOME/
    bundles/test-integration/fake-HOME/
    └── .config
        └── go
            └── telemetry
                ├── local
                │   ├── asm@go1.25.3-go1.25.3-linux-arm64-2025-10-21.v1.count
                │   ├── compile@go1.25.3-go1.25.3-linux-arm64-2025-10-21.v1.count
                │   ├── go@go1.25.3-go1.25.3-linux-arm64-2025-10-21.v1.count
                │   ├── link@go1.25.3-go1.25.3-linux-arm64-2025-10-21.v1.count
                │   ├── test2json@go1.25.3-go1.25.3-linux-arm64-2025-10-21.v1.count
                │   ├── upload.token
                │   └── weekends
                └── upload

    6 directories, 7 files

This patch disables go telemetry also for this home-directory to prevent
those files from being created, and to prevent go from producing the
telemetry.

With this patch, only the file to disable telemetry is produced:

    make TEST_FILTER=TestPruneDontDeleteUsedDangling test-integration
    tree -a bundles/test-integration/fake-HOME/
    bundles/test-integration/fake-HOME/
    └── .config
        └── go
            └── telemetry
                └── mode

    4 directories, 1 file

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-21 12:17:30 +02:00
Sebastiaan van Stijn
79f01e4ffc Merge pull request #51217 from thaJeztah/hotel_california
libnetwork/drivers/macvlan, ipvlan: remove some redundant code, and cleanups / fixes
2025-10-21 12:03:01 +02:00
Sebastiaan van Stijn
9fe856a5f3 integration-cli: move some tests to integration
Migrates:

- TestAPIErrorJSON
- TestContainerAPIInvalidPortSyntax
- TestContainerAPIRestartPolicyInvalidPolicyName
- TestContainerAPIRestartPolicyRetryMismatch
- TestContainerAPIRestartPolicyNegativeRetryCount
- TestContainerAPIRestartPolicyDefaultRetryCount
- TestCreateWithTooLowMemoryLimit

Co-authored-by: Sameer Gupta <sameergupta4873@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-21 12:01:55 +02:00
Sebastiaan van Stijn
1ff6a963ad Merge pull request #51216 from sameergupta4873/50159-migrate-test-api-error-not-found-json
test: migrate test api error not found json
2025-10-21 11:57:56 +02:00
Sebastiaan van Stijn
ebfcc6cf61 Merge pull request #51194 from thaJeztah/handle_macaddr
api/types/container: remove deprecated Config.MacAddress
2025-10-21 11:16:05 +02:00
Sameer Gupta
62a71a8261 test: migrate test api error not found json
Signed-off-by: Sameer Gupta <sameergupta4873@gmail.com>
2025-10-21 14:18:04 +05:30
Sebastiaan van Stijn
33fc45e5c5 libnetwork: EndpointInterface: cleanup marshal/unmarshal
Define an intermediate struct for marshaling/unmarshaling; this
struct already uses netip types (in case we want to migrate the
actual struct to use these types as well).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-21 10:37:05 +02:00
Sebastiaan van Stijn
461b8fe502 Merge pull request #51237 from vvoland/label-depsnomods
gha/labeler: Exclude client and api modules from dependencies label
2025-10-21 09:33:20 +02:00
Olli Janatuinen
48c2d8c458 libnetwork: support custom DNS servers in Windows overlay driver
Signed-off-by: Olli Janatuinen <olli.janatuinen@gmail.com>
2025-10-21 07:33:02 +00:00
Sebastiaan van Stijn
a8950e0192 api/types/container: remove deprecated Config.MacAddress
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-21 09:15:26 +02:00
Sebastiaan van Stijn
79912d4c7f daemon: Daemon.getInspectData: move migration code to router
There also appeared to be duplication between daemon.getInspectData,
and the containerRouter.postContainersCreate methods, as both were
back-filling the field.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-21 09:15:18 +02:00
Sebastiaan van Stijn
91ce33d4b0 daemon/server/router/container: remove uses of deprecated MacAddress
Rewrite the router to use a local struct to unmarshal the deprecated
field for requests that send it, and adjust the adoption code.

There also appeared to be duplication between daemon.getInspectData,
and the containerRouter.postContainersCreate methods, as both were
back-filling the field.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-21 08:33:42 +02:00
Sebastiaan van Stijn
0030ba21e3 client: ContainerCreate: remove handling of legacy MacAddress
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-21 08:33:42 +02:00
Sebastiaan van Stijn
e5864a51ac integration/networking: TestWatchtowerCreate: rewrite with request util
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-21 08:33:42 +02:00
Sebastiaan van Stijn
8088de791c integration/networking: TestInspectCfgdMAC: rewrite with request util
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-21 08:33:42 +02:00
Sebastiaan van Stijn
b4b0b6f10f integration/container: rewrite with request for MacAddress
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-21 08:33:42 +02:00
Austin Vazquez
0ad58d39a4 Merge pull request #51078 from vvoland/client-config-opts
client/config: Wrap results and options
2025-10-20 18:41:31 -05:00
Paweł Gronowski
762fc029f0 Merge pull request #51232 from dmcgowan/fix-container-os-migration
Move container platform migration logic
2025-10-20 23:52:48 +02:00
Paweł Gronowski
4b22807a0f gha/labeler: Exclude client and api modules from dependencies label
Prevent applying `area/dependencies` when the `client` and `api` modules
are changed.

Due to the replace rule present for these modules, we have to revendor
them with each change which would trigger the previous rule.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-10-20 23:47:35 +02:00
Paweł Gronowski
abf5679049 client/inspect: Better Raw handling
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-10-20 22:29:36 +02:00
Paweł Gronowski
ee22a50b75 client/config: Use Config instead of Spec as field
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-10-20 22:29:36 +02:00
Paweł Gronowski
f4b06e66e1 client/config: Wrap results and options
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-10-20 22:29:36 +02:00
Sebastiaan van Stijn
72e9c3af99 Merge pull request #51211 from austinvazquez/move-client-volume-create-options
api/types/volume: move `CreateOptions` to `client.VolumeCreateOptions`
2025-10-20 21:44:03 +02:00
Austin Vazquez
42ba5466c7 api: rename volumes.CreateOptions to volumes.CreateRequest
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-20 13:23:41 -05:00
Austin Vazquez
a2fd724453 client: wrap volume create api options with client options
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-20 12:55:52 -05:00
Derek McGowan
600edfe55c Move container platform migration logic
Defer the logic to fill in the container platform information from the
image service until container restore. During container restore the
image backend is fully initialized and can be used to fill in the
missing platform fields for older containers.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-10-20 10:39:16 -07:00
Sebastiaan van Stijn
2ba58d3c7f Merge pull request #51208 from thaJeztah/volume_prune_all
client: VolumePruneOptions: add "All" option
2025-10-20 19:04:36 +02:00
Sebastiaan van Stijn
acb67509e0 Merge pull request #51210 from austinvazquez/refactor-client-volume
client/volume: refactor volume options and responses
2025-10-20 18:59:42 +02:00
Jean Rouge
3a90dd8b8f Adding support for memory swap settings for services
With integration tests

Relevant Swarmkit PR: https://github.com/docker/swarmkit/pull/2816
(updated the vendored version of Swarkit to that)

Signed-off-by: Jean Rouge <rougej+github@gmail.com>

Updated for latest master, fixed bitrot.

Signed-off-by: Drew Erny <derny@mirantis.com>
2025-10-20 10:34:05 -05:00
Austin Vazquez
d4e6d4f697 client/volume: refactor volume options and responses
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-20 09:05:55 -05:00
Sebastiaan van Stijn
663aa7aeab Merge pull request #51224 from thaJeztah/datastore_cleanups
libnetwork/datastore: small cleanups
2025-10-20 15:51:18 +02:00
Sebastiaan van Stijn
2f09e6d6d8 Merge pull request #51184 from thaJeztah/remove_servicespec_networks
api/types/swarm: remove deprecated ServiceSpec.Networks field
2025-10-20 12:33:58 +02:00
Sebastiaan van Stijn
975e46f726 libnetwork/datastore: small cleanups
- Use an intermediate struct for (un)marshaling dummyObject
- Remove dummyObject.SkipSave as it would always be set to "false"
  (i.e., persisted to disk).
- Minor cleanups in handling locks and some unused vars

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-20 11:49:03 +02:00
Sebastiaan van Stijn
4a89449eab Merge pull request #51220 from thaJeztah/request_json_util
internal/testutil/request: add ReadJSONResponse utility
2025-10-20 11:39:05 +02:00
Sebastiaan van Stijn
10faa629fe libnetwork/drivers/macvlan, ipvlan: assorted minor cleanups
- Inline some vars and align between drivers
- Remove nested if's where possible
- Use `WithError` for some logs, and use the context if available
- Scope variables locally where only used locally and, the reverse,
  make it clear where a (function-)global variable is used.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-20 08:52:09 +02:00
Sebastiaan van Stijn
a013147c40 libnetwork/drivers/macvlan: parentHasSingleUser: don't create copy of networks
This function was calling driver.getNetworks, which copies the networks map
into a new slice. As we're not mutating the networks, we can just use the
networks map itself to check if there's any networks configured with the
same parent.

While changing;

- Also change the signature to accept the parent to compare to as a string
- Return early once we determined there's more than one user

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-20 08:14:45 +02:00
Sebastiaan van Stijn
65296cd0e7 libnetwork/drivers/macvlan, ipvlan: un-embed mutexes
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-20 08:14:44 +02:00
Sebastiaan van Stijn
a2f4f09f91 libnetwork/drivers/macvlan, ipvlan: remove unused sync.Once
Both were added as part of the initial implementation in commit [moby@ea30113]
([libnetwork@1d6f2c5]), but never used.

[moby@ea30113]: ea30113303
[libnetwork@1d6f2c5]: 1d6f2c59c4

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-20 08:14:44 +02:00
Sebastiaan van Stijn
5276dd8e9a libnetwork/drivers/ipvlan: remove ifaceGateway utility
This utility was only called with two constant values;

    const (
        defaultV4RouteCidr = "0.0.0.0/0"
        defaultV6RouteCidr = "::/0"
    )

However;

- calling it would always execute a `net.ParseCIDR`
- verify if it would produce an error (which would be very unlikely)
- it used a `staticRoute` struct that was ONLY used for this function
- and immediately deconstructed into its components
- furthermore, the `NextHop` field would be discarded by jinfo.AddStaticRoute,
  which only used the third argument for `routeType == types.NEXTHOP`

This patch:

- removes the `ifaceGateway` and associated `staticRoute` and consts
- defines two package-level vars for `defaultV4Net` and `defaultV6Net`,
  which can be reused (no need to parse / construct them for every join)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-20 08:14:44 +02:00
Sebastiaan van Stijn
d481c09fa7 libnetwork/drivers/macvlan, ipvlan: make driver.leave a stub
These drivers did not do anything meaningful in the `Leave` method; they
would check if the network and/or endpoint were missing, in which case
they produced an error, but the network and endpoint (if present) would
not be used, so it was only validation.

Such validation could still be relevant elsewhere, but looking at where
this method is called; the `Driver.Leave()` is called in two places, both
of which don't handle the error, other than logging it as a warning / error;

It's called by `Endpoint.sbJoin()`, as part of the rollback;
d5c838dc5e/daemon/libnetwork/endpoint.go (L539-L545)

And `Endpoint.sbLeave()`, which also discards the error;
d5c838dc5e/daemon/libnetwork/endpoint.go (L772-L776)

Based on he above, this code looks to be redundant, so replacing it with
a stub; returning `nil`.

As replacing the code removed the use of network.getEndpoint, which was effectively
a copy of network.endpoint (which didn't have error handling), I merged the two
methods, and removed custom error-handling elsewhere.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-20 08:14:44 +02:00
Sebastiaan van Stijn
aec6e7f7b6 libnetwork/drivers/macvlan, ipvlan: remove networkTable, endpointTable
These types were just a straight map[string]XXX, with no methods or other
properties attached.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-20 08:14:44 +02:00
Sebastiaan van Stijn
bf7277f8fe libnetwork/drivers/macvlan, ipvlan: remove getSubnetforIPv6, getSubnetforIPv4
These methods were just wrappers around getSubnetforIP; let's peel away the
abstraction and call it directly; we're already checking for n.config.Ipv4Subnet
and n.config.Ipv6Subnets on the call-site, so may as well just pass it in.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-20 08:14:34 +02:00
Sebastiaan van Stijn
a294445345 ibnetwork/drivers/macvlan, ipvlan: align and fix potential panic
There were some missing checks whether ep.addr, ep.addrv6 were nil,
which could panic in getSubnetForIP.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-19 13:35:25 +02:00
Sebastiaan van Stijn
17425cff08 libnetwork/drivers/macvlan, ipvlan: driver.Join: don't fetch endpoint twice
The function was fetching a reference to the endpoint twice; while this
did give the option for an early return, in practice it didn't mean much,
because it could still fail if the endpoint was removed in between.

This code still has a race condition, because while a reference to the
endpoint is retrieved while acquiring a lock, the result is mutated without.
This probably needs to either have some accessor, or the function should
keep a lock for the whole operation (possibly switching to an RWMutex).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-19 13:17:56 +02:00
Sebastiaan van Stijn
3906199019 internal/testutil/request: add ReadJSONResponse utility
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-18 22:15:31 +02:00
Ricardo Branco
ee043729a0 integration/container: Make tests runnable on SELinux enabled daemon
Signed-off-by: Ricardo Branco <rbranco@suse.de>
2025-10-18 21:54:13 +02:00
Sebastiaan van Stijn
5061d0a74d api/types/swarm: remove deprecated ServiceSpec.Networks field
This field was deprecated in [engine-api@5c4b684], which got vendored into
Moby in [moby@8f7a8c7] (API v1.25), and wired up in [moby@99a98cc].

[engine-api@5c4b684]: 5c4b684b2f
[moby@8f7a8c7]: 8f7a8c75ae
[moby@99a98cc]: 99a98ccc14

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-17 22:20:00 +02:00
Austin Vazquez
ec83dd46ed Merge pull request #51212 from thaJeztah/bump_docker_py
ci: update docker-py to main (v7.2.0-dev)
2025-10-17 15:11:31 -05:00
Sebastiaan van Stijn
acda47637c ci: update docker-py to main (v7.2.0-dev)
full diff: https://github.com/docker/docker-py/compare/7.1.0...65f7f0c772577beb5e2cd6daac4e5ca806ccc4af

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-17 18:46:44 +02:00
Sebastiaan van Stijn
6da63a3ed5 client: VolumePruneOptions: add "All" option
Abstract away that the "all" option is currently implemented as
a filter (which may change in future).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-17 17:40:01 +02:00
Sebastiaan van Stijn
d1a720cb15 Merge pull request #51042 from akerouanton/userns-remapping-disable-snapshotter
daemon/command: disable c8d snapshotter when userns remapping enabled
2025-10-17 17:21:31 +02:00
Sebastiaan van Stijn
5856ec5348 Merge pull request #51207 from thaJeztah/plugin_structs
client: Client.PluginList: add options-struct
2025-10-17 09:42:01 +02:00
Sebastiaan van Stijn
bb749bafa2 Merge pull request #51205 from austinvazquez/move-volume-update-options-to-client
api/types/volume: move `UpdateOptions` to `client.VolumeUpdateOptions`
2025-10-17 02:00:07 +02:00
Sebastiaan van Stijn
5fa3c65682 client: Client.PluginList: add options-struct
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-17 00:59:52 +02:00
Austin Vazquez
05393648da Merge pull request #51202 from thaJeztah/denoise_test
integration-cli: TestDockerCLIBuildSuite/TestBuildEmitsEvents: reduce…
2025-10-16 16:08:25 -05:00
Austin Vazquez
aa36c44ef9 api/types/volume: move UpdateOptions to client.VolumeUpdateOptions
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-16 16:07:28 -05:00
Sebastiaan van Stijn
44beb53e63 Merge pull request #51203 from thaJeztah/move_macaddress_operational
api/types/network: EndpointSettings: make MacAddress "operational data"
2025-10-16 23:01:46 +02:00
Austin Vazquez
31a97204cf Merge pull request #51188 from thaJeztah/integration_less_version_checks
integration: remove some version-gates for API < v1.44
2025-10-16 15:38:08 -05:00
Sebastiaan van Stijn
9720ee037d Merge pull request #51190 from thaJeztah/remove_virtualsize
api/types/image: remove deprecated Summary.VirtualSize field
2025-10-16 21:43:19 +02:00
Sebastiaan van Stijn
9635f04e91 Merge pull request #51196 from austinvazquez/remove-image-inspect-parent-from-swagger
api: remove image inspect `Parent`, `DockerVersion` from swagger docs
2025-10-16 21:38:31 +02:00
Sebastiaan van Stijn
709336a2c3 api/types/network: EndpointSettings: make MacAddress "operational data"
The MacAddress field currently reflects _either_ the user-specified
(DesiredMacAddress) _or_ the actual / assigned MacAddress (when running).

Internal structs already have a separate DesiredMacAddres field, but
this field is not (yet) reflected in the API response. The intent is
to move towards better separation of config ("desired state") and
operational ("actual state") data.

Let's move the MacAddress field under "operational" data; the field's
description still describes its dual-personality, but potentially we
can move towards separate fields in future.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-16 20:43:39 +02:00
Sebastiaan van Stijn
e84bbc09b1 integration/container: fix daemon min API version
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-16 20:43:22 +02:00
Sebastiaan van Stijn
c5abafb459 Merge pull request #51186 from thaJeztah/deprecate_api_v1.43
daemon: raise default minimum API version to v1.44
2025-10-16 17:40:54 +02:00
Sebastiaan van Stijn
248333d43f Merge pull request #51201 from thaJeztah/fix_backfil
daemon/server/router/container: fix back-filling of top-level network fields
2025-10-16 16:41:08 +02:00
Sebastiaan van Stijn
1402c025e1 Merge pull request #51192 from vvoland/handle-docker-tags
gha: add support for docker-v* tags
2025-10-16 15:40:39 +02:00
Rob Murray
20061f7cd4 Merge pull request #51198 from thaJeztah/move_log_opts
daemon: consolidate "log-level" and "log-format" options and flags
2025-10-16 14:24:19 +01:00
Sebastiaan van Stijn
f6e52c8260 Merge pull request #51200 from thaJeztah/prune_option_structs
client: rewrite prune functions to use option structs and result
2025-10-16 15:20:24 +02:00
Austin Vazquez
44c97382b6 Merge pull request #51199 from thaJeztah/rm_nondistributable_flag
daemon/command: remove placeholder
2025-10-16 08:11:36 -05:00
Nicolas De Loof
2d1429c62c introduce ImagePushResponse
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2025-10-16 14:43:43 +02:00
Sebastiaan van Stijn
1caf3dd3b2 integration-cli: TestDockerCLIBuildSuite/TestBuildEmitsEvents: reduce logs
This test was always logging build output and output of the events stream;

    === RUN   TestDockerCLIBuildSuite/TestBuildEmitsEvents/buildkit=false/no_tag
        docker_cli_build_test.go:6246: Sending build context to Docker daemon  2.048kB
            Step 1/2 : FROM busybox
             ---> c004456a6868
            Step 2/2 : RUN echo hi >/hello
             ---> Running in dd4f3ec8bd9e
             ---> Removed intermediate container dd4f3ec8bd9e
             ---> 25ee0d9e2b4a
            Successfully built 25ee0d9e2b4a

        docker_cli_build_test.go:6247:
        docker_cli_build_test.go:6259: 2025-10-16T12:28:34.113785300Z image create sha256:25ee0d9e2b4af90101abc6f2f3339807e7bcd0bfe5af6113c3a71c9edff6e858 (name=sha256:25ee0d9e2b4af90101abc6f2f3339807e7bcd0bfe5af6113c3a71c9edff6e858)

    --- PASS: TestDockerCLIBuildSuite/TestBuildEmitsEvents/buildkit=false/no_tag (6.56s)

This patch:

- Uses a manual assert to check if the build succeeded; on failure, it
  prints the combined output (stdout, stderr)
- Removes the log for the events output; the `assert` function used in
  the test already asserts the output, which would print the output when
  the assertion fails.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-16 14:41:57 +02:00
Paweł Gronowski
acfe4e8613 gha: add support for docker-v* tags
ci(bin-image): strip prefix for bin-image tags

Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-10-16 14:26:10 +02:00
Sebastiaan van Stijn
b87ed4512a integration/container: fix test using wrong daemon
The TestMacAddressIsAppliedToMainNetworkWithShortID was starting its
own daemon, but the apiClient was created with the defaults, so was
connecting to the global test-daemon.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-16 13:47:39 +02:00
Sebastiaan van Stijn
ecd7551310 daemon/server/router/container: fix back-filling of top-level network fields
This was introduced in fc1ff44bc2, which
back-filled the top-level network-properties for the bridge network,
but the fields ended up at the top-level of the response, not the top-level
of the NetworkSettings.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-16 13:47:32 +02:00
Sebastiaan van Stijn
865cfe9a7f client: VolumesPrune: rewrite to use option structs and result
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-16 12:29:21 +02:00
Sebastiaan van Stijn
b11d9d410f client: NetworksPrune: rewrite to use option structs and result
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-16 12:29:15 +02:00
Sebastiaan van Stijn
0672a0f999 client: ImagesPrune: rewrite to use option structs and result
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-16 12:28:10 +02:00
Sebastiaan van Stijn
91323b7a35 client: ContainersPrune: rewrite to use option structs and result
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-16 12:26:49 +02:00
Sebastiaan van Stijn
d9a03a374f daemon: consolidate "log-level" and "log-format" options and flags
The `LogLevel` and `LogFormat` options were defined in two locations;

- in the `daemon/commands.daemonOptions` struct.
- in the `daemon/config.Config` (`CommonConfig`) struct.

While we may need some options-struct to initialize the daemon, we currently
don't and the separate structs means they have to be kept in sync, and for
flags to be distributed across multiple places.

Note that some flags will not be configurable in the config-file (such as
the path of the config-file itself), so those options will need to have a
separate struct (which may still live in the `daemon/config` package).

This patch;

- Removes the `LogLevel` and `LogFormat` from `daemon/commands.daemonOptions`
  to `daemon/config.CommonConfig`.
- Adds a bare-bones `stringVar` implementation using generics to allow using
  strong-typed string values to be used for flags.
- Moves the flags together with the other flags in `installCommonConfigFlags`.
- Sets the default options in the `Config` struct.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-16 10:02:47 +02:00
Sebastiaan van Stijn
4e6c955e78 daemon/command: configureDaemonLogs: don't panic
Return an error instead of panicking.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-16 10:02:46 +02:00
Sebastiaan van Stijn
06ff7d9cd4 daemon/config: add validateDaemonLogConfig function
extract validation of the log-config to a separate function.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-16 10:02:46 +02:00
Sebastiaan van Stijn
c73fe6d26e daemon/config: move daemon log-config to a separate struct
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-16 10:02:43 +02:00
Sebastiaan van Stijn
a6cf5e19e8 daemon/command: remove placeholder
It's no longer functional since 7435e4a1be22a5a44f945d6b45e1e81273fd868d;
(v28.1.0) this flag was purely to print the deprecation message. The
daemon.json handling still has an exception to ignore the field (if
present).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-16 09:54:34 +02:00
Sebastiaan van Stijn
c584855329 daemon/command: configureProxyEnv: accept smaller struct
Also pass through the context

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-16 01:27:20 +02:00
Sebastiaan van Stijn
0a2ab376ff daemon/config: slight cleanup of Config struct
Move embedded types together, and add some minimal godoc.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-16 00:57:25 +02:00
Rob Murray
b514589124 Merge pull request #51197 from thaJeztah/green_checks
fix minor linting issues
2025-10-15 22:11:25 +01:00
Sebastiaan van Stijn
69702bd821 fix minor linting issues
Making my IDE less noisy

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-15 22:30:38 +02:00
Sebastiaan van Stijn
40715adc99 Merge pull request #51189 from austinvazquez/stop-support-for-container-config-mac-address
api/types/container: remove support for config mac address
2025-10-15 20:53:26 +02:00
Sebastiaan van Stijn
761a829051 Merge pull request #51195 from austinvazquez/minor-backend-bug-fix-for-volumes-init
daemon: initialize volumes if nil on decode
2025-10-15 18:52:53 +02:00
Austin Vazquez
3b075a79b9 api: remove image inspect Parent, DockerVersion from swagger docs
Follow-up to f8d3c4e4a7,
this change removes the `Parent` and `DockerVersion` fields from the swagger documentation.

Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-15 09:56:43 -05:00
Austin Vazquez
d62a521c7d daemon: initialize volumes if nil on decode
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-15 09:40:37 -05:00
Sebastiaan van Stijn
c8cfb12dc3 Merge pull request #51191 from thaJeztah/denoise_startup
libnetwork/osl/kernel: ApplyOSTweaks: don't log errors if not found
2025-10-15 09:20:37 +02:00
Sebastiaan van Stijn
a65293c036 libnetwork/osl/kernel: ApplyOSTweaks: don't log errors if not found
I noticed these errors logged inside the dev-container;

    ERRO[2025-10-14T16:15:46.603781797Z] error reading the kernel parameter net.ipv4.neigh.default.gc_thresh1  error="open /proc/sys/net/ipv4/neigh/default/gc_thresh1: no such file or directory"
    ERRO[2025-10-14T16:15:46.603808089Z] error reading the kernel parameter net.ipv4.neigh.default.gc_thresh2  error="open /proc/sys/net/ipv4/neigh/default/gc_thresh2: no such file or directory"
    ERRO[2025-10-14T16:15:46.603819922Z] error reading the kernel parameter net.ipv4.neigh.default.gc_thresh3  error="open /proc/sys/net/ipv4/neigh/default/gc_thresh3: no such file or directory"

Given that these happen during an initial check, we can probably ignore them
if there's nothing to tweak.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-15 02:26:25 +02:00
Sebastiaan van Stijn
adb4269928 api/types/image: remove deprecated Summary.VirtualSize field
The `VirtualSize` field became redundant with the introduction of content-
addressable images in docker v1.10 (4352da7803),
after which the field was identical to the `Size` field. The field was marked
to be deprecated, which happened in 1261fe69a3
(API v1.43) and removed in API v1.44 (913b0f51ca).

Now that we stop supporting API versions older than v1.44, we can drop this
field; it's a minor breakage of old API versions, but the same information
is available in the "Size" field.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-15 01:49:57 +02:00
Sebastiaan van Stijn
e6fd1ce06b Merge pull request #51185 from thaJeztah/remove_buildcache_parent
api/types/build: remove deprecated BuildCache.Parent field
2025-10-15 00:50:56 +02:00
Austin Vazquez
2537eae6f3 api/types/container: remove support for config mac address
This change stops daemon support for the container config MacAddress field.

Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-14 17:42:02 -05:00
Sebastiaan van Stijn
e77f116c9c integration: remove some version-gates for API < v1.44
We don't run these tests against older daemons, but if we would,
we no longer have to consider API < v1.44 as versions of the daemon
below v25.0 reached EOL.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-15 00:30:05 +02:00
Sebastiaan van Stijn
2c59be7011 daemon: raise default minimum API version to v1.44
- relates to 96b29f5a1f
- similar to 08e4e88482

The daemon currently provides support for API versions all the way back
to v1.24, which is the version of the API that shipped with docker 1.12.0
(released in 2016).

Such old versions of the client are rare, and supporting older API versions
has accumulated significant amounts of code to remain backward-compatible
(which is largely untested, and a "best-effort" at most).

This patch updates the minimum API version to v1.44, matching the minimum
version of the client, and matching the API version of docker v25.0, which
is the oldest supported version (through Mirantis MCR).

The intent is to start deprecating older API versions when daemons implementing
them reach EOL. This patch does not yet remove backward-compatibility code
for older API versions, and the DOCKER_MIN_API_VERSION environment variable
allows overriding the minimum version (to allow restoring the behavior from
before this patch), however, API versions below v1.44 should be considered
"best effort", and we may remove compatibility code to provide "degraded"
support.

With this patch the daemon defaults to API v1.44 as minimum:

    docker version
    Client:
     Version:           28.5.0
     API version:       1.51
     Go version:        go1.24.7
     Git commit:        887030f
     Built:             Thu Oct  2 14:54:39 2025
     OS/Arch:           linux/arm64
     Context:           default

    Server:
     Engine:
      Version:          dev
      API version:      1.52 (minimum version 1.44)
    ....

Trying to use an older version of the API produces an error:

    DOCKER_API_VERSION=1.43 docker version
    Client:
     Version:           28.5.0
     API version:       1.43 (downgraded from 1.51)
     Go version:        go1.24.7
     Git commit:        887030f
     Built:             Thu Oct  2 14:54:39 2025
     OS/Arch:           linux/arm64
     Context:           default
    Error response from daemon: client version 1.43 is too old. Minimum supported API version is 1.44, please upgrade your client to a newer version

To restore the previous minimum, users can start the daemon with the
DOCKER_MIN_API_VERSION environment variable set:

    DOCKER_MIN_API_VERSION=1.24 dockerd

API 1.24 is the oldest supported API version;

    docker version
    Client:
     Version:           28.5.0
     API version:       1.24 (downgraded from 1.51)
     Go version:        go1.24.7
     Git commit:        887030f
     Built:             Thu Oct  2 14:54:39 2025
     OS/Arch:           linux/arm64
     Context:           default

    Server:
     Engine:
      Version:          dev
      API version:      1.52 (minimum version 1.24)
    ....

When using the `DOCKER_MIN_API_VERSION` with a version of the API that
is not supported, an error is produced when starting the daemon;

    DOCKER_MIN_API_VERSION=1.23 dockerd --validate
    invalid DOCKER_MIN_API_VERSION: minimum supported API version is 1.24: 1.23

    DOCKER_MIN_API_VERSION=1.99 dockerd --validate
    invalid DOCKER_MIN_API_VERSION: maximum supported API version is 1.52: 1.99

Specifying a malformed API version also produces the same error;

    DOCKER_MIN_API_VERSION=hello dockerd --validate
    invalid DOCKER_MIN_API_VERSION: minimum supported API version is 1.24: hello

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-14 23:42:12 +02:00
Sebastiaan van Stijn
47fe719b33 api/types/build: remove deprecated BuildCache.Parent field
The BuildCache.Parent field was removed in API v1.42 in [moby@e0db820].
While we had to keep the Go struct field around to backfill the field for
older API versions, it's no longer part of API v1.42 and up (using the
"omitempty" is just an implementation detail).

Older clients unconditionally use the `Parents` field if set, and usage
of this field is very limited, so let's remove the field without back-
filling, and have clients use the replacement field;
https://github.com/docker/cli/blob/v28.5.1/cli/command/formatter/buildcache.go

[moby@e0db820]: e0db8207f3

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-14 14:51:31 +02:00
Paweł Gronowski
79c6247281 Merge pull request #51182 from thaJeztah/add_replace
add back replace rules and re-vendor
2025-10-14 14:42:46 +02:00
Sebastiaan van Stijn
9c39c3e158 Merge pull request #51179 from thaJeztah/fix_buildcache_parent_docs
api/docs: remove BuildCache.Parent field for API v1.42 and up
2025-10-14 14:16:48 +02:00
Sebastiaan van Stijn
36f1c830bb add back replace rules and re-vendor
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-14 14:14:03 +02:00
Sebastiaan van Stijn
a2fa716874 Merge pull request #51180 from thaJeztah/rm_buildersize
api/types/sytem: remove deprecated DiskUsage.BuilderSize
2025-10-14 13:35:23 +02:00
Paweł Gronowski
ee0810e2f1 Merge pull request #51177 from vvoland/vendor-client
vendor: github.com/moby/moby/client v0.1.0-beta.2
2025-10-14 12:43:19 +02:00
Sebastiaan van Stijn
45caa74e3b api/types/sytem: remove deprecated DiskUsage.BuilderSize
The `DiskUsage.BuilderSize` field was added as part of the, then experimental,
BuildKit builder in [moby@5c3d2d5] (API v1.31). It was deprecated in API v1.32
(through [moby@b225258]) but that change still returned the field. Commit
[moby@31348af] removed it in API v1.42. This field was never documented,
and part of an experimental feature, so we can remove it altogether.

[moby@5c3d2d5]: 5c3d2d552b
[moby@b225258]: b225258496
[moby@31348af]: 31348afa19

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-14 11:42:28 +02:00
Paweł Gronowski
554c37fa92 Merge pull request #51178 from vvoland/update-go
update to go1.25.3
2025-10-14 11:35:48 +02:00
Sebastiaan van Stijn
a5d9619093 api/docs: remove BuildCache.Parent field for API v1.42 and up
The BuildCache.Parent field was removed in API v1.42 in [moby@e0db820].
While we had to keep the Go struct field around to backfil the field for
older API versions, it's no longer part of API v1.42 and up (using the
"omitempty" is just an implementation detail).

This patch corrects the swagger files to match this.

[moby@e0db820]: e0db8207f3

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-14 11:19:46 +02:00
Albin Kerouanton
e1722eb8d8 daemon/command: disable c8d snapshotter when userns remapping enabled
Buildkit fails when userns remapping is enabled and c8d snapshotter is
used. As a temporary workaround, disable c8d snapshotter when userns
remapping is enabled. This will need a proper fix in the future.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-10-14 10:14:35 +02:00
Paweł Gronowski
1aa73144f2 update to go1.25.3
This release addresses breakage caused by a security patch included in
Go 1.25.2 and 1.24.8, which enforced overly restrictive validation on
the parsing of X.509 certificates. We've removed those restrictions
while maintaining the security fix that the initial release addressed.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-10-14 09:11:27 +02:00
Paweł Gronowski
5e9e261107 vendor: github.com/moby/moby/client v0.1.0-beta.2
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-10-14 09:03:49 +02:00
Akihiro Suda
45ddf37ccd Merge pull request #51174 from vvoland/gha-autolabel
gha/labeler: disable sync-labels to preserve human-added labels
2025-10-14 11:26:21 +09:00
Akihiro Suda
774fdf7458 Merge pull request #51175 from vvoland/vendor-api
vendor: github.com/moby/moby/api v1.52.0-beta.2
2025-10-14 11:25:49 +09:00
Paweł Gronowski
01a19e9d95 vendor: github.com/moby/moby/api v1.52.0-beta.2
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-10-13 22:29:06 +02:00
Sebastiaan van Stijn
aa3b4d1446 Merge pull request #51171 from voffffla/remove-wrapError-in-libcontainerd
Removed all occurrences of wrapError in libcontainerd/remote
2025-10-13 19:22:30 +02:00
Albin Kerouanton
06a78dc67c Merge pull request #51147 from robmry/create_network_error_handling
Clean up bridge device on network create error
2025-10-13 16:56:44 +02:00
Paweł Gronowski
b1e57881c3 gha/labeler: disable sync-labels to preserve human-added labels
The sync-labels option was causing the labeler action to remove labels
that were manually added by humans.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-10-13 15:27:07 +02:00
Paweł Gronowski
e4ad61fcdf Merge pull request #50313 from thaJeztah/update_go1.25
update to go1.25.2
2025-10-13 12:52:17 +02:00
David Warnquist
3848b16bca Removed all occurrences of wrapError in libcontainerd/remote
Signed-off-by: David Warnquist <voffffla@gmail.com>
2025-10-12 18:22:45 +02:00
Austin Vazquez
105fbe44f1 Merge pull request #51163 from thaJeztah/filters_clone
client: Filters: add Clone method
2025-10-11 16:11:01 -05:00
Sebastiaan van Stijn
28018a51d8 update to go1.25.2
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-11 20:14:22 +02:00
Sebastiaan van Stijn
6e5611a217 Merge pull request #51167 from thaJeztah/bump_go_swagger
Dockerfile: update to go-swagger v0.33.1 (for go1.25)
2025-10-11 20:10:34 +02:00
Sebastiaan van Stijn
39cf847787 api: regenerate with go-swagger v0.33.1
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-11 19:59:25 +02:00
Sebastiaan van Stijn
b4c3b29245 Dockerfile: update to go-swagger v0.33.1 (for go1.25)
full diff: https://github.com/go-swagger/go-swagger/compare/v0.32.3...v0.33.1

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-11 19:59:22 +02:00
Sebastiaan van Stijn
11e1368827 Merge pull request #51168 from thaJeztah/align_swagger_templates
api/templates: align with go-swagger v1.32.3
2025-10-11 19:58:43 +02:00
Sebastiaan van Stijn
bbdd24d145 api/templates: align with go-swagger v1.32.3
Align our custom templates with the one from upstream;
https://github.com/go-swagger/go-swagger/tree/v0.32.3/generator/templates

- Add "TODO" comments in places where we applied patches to make it
  easier to compare with upstream, and to see where differences are
  intentional.
- Update the server/operations.gotmpl template;
  - Add the "generated" header in the right place, so that it's
    recognized as generated file.
  - Add back the upstream template code; instead of removing the
    code, put a "if false" block around it; this allows comparing
    our forked templates with upstream when updating the version
    of go-swagger (to make sure we're not missing fixes).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-11 12:23:10 +02:00
Sebastiaan van Stijn
f5fec92ea7 Merge pull request #51166 from thaJeztah/bump_gotestsum
Dockerfile: bump gotest.tools/gotestsum v1.13.0
2025-10-11 11:06:50 +02:00
Sebastiaan van Stijn
b3f74e85aa Dockerfile: bump gotest.tools/gotestsum v1.13.0
full diff: https://github.com/gotestyourself/gotestsum/compare/v1.12.3...v1.13.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-10 23:25:40 +02:00
Sebastiaan van Stijn
4d3da4f2ec Merge pull request #51154 from austinvazquez/add-omits-for-container-config-onbuild
api/types/container: omit `Config.OnBuild` when empty
2025-10-10 19:54:23 +02:00
Sebastiaan van Stijn
0769fe7087 Merge pull request #51157 from corhere/split-stdcopy
api/pkg/stdcopy: move stdWriter to daemon/internal
2025-10-10 17:33:43 +02:00
Austin Vazquez
ac3960a44c api/types/container: omit Config.OnBuild when empty
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-10 08:25:27 -05:00
Sebastiaan van Stijn
c1461d4b17 Merge pull request #51161 from vvoland/gha-autolabel
gha/labeler: Some more file-based rules
2025-10-10 15:18:46 +02:00
Paweł Gronowski
0ee0283c9d gha/labeler: Some more file-based rules
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-10-10 15:09:59 +02:00
Sebastiaan van Stijn
6257bd094d Merge pull request #51158 from thaJeztah/nicer_wrappers
daemon/internal/netiputil: make "MaybeXXX" functions a function, not var
2025-10-10 14:25:38 +02:00
Sebastiaan van Stijn
15289ad2dc client: Filters: add Clone method
This method returns a deep-copy of the filter, which can be used
in situations where the original filter must not be mutated, but
additional filters need to be added for a specific request.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-10 13:24:40 +02:00
Paweł Gronowski
d9cf791df1 Merge pull request #51149 from robmry/rootless-pasta
dockerd-rootless.sh: if no slirp4netns, try pasta
2025-10-10 12:39:17 +02:00
Sebastiaan van Stijn
cfefa339c2 Merge pull request #51160 from thaJeztah/oncevalue
client: ImagePullResponse: use sync.OnceValue
2025-10-10 11:55:46 +02:00
Sebastiaan van Stijn
1964cc7400 Merge pull request #51159 from thaJeztah/no_panic
client: ImagePullResponse: don't panic without reader
2025-10-10 11:30:53 +02:00
Rob Murray
a6206f2da9 dockerd-rootless: default MTU 65520 for slirp4netns
When DOCKERD_ROOTLESS_ROOTLESSKIT_MTU is not set, and ...
- DOCKERD_ROOTLESS_ROOTLESSKIT_NET is not set and slirp4netns
  is selected, MTU defaults to 65520.
- DOCKERD_ROOTLESS_ROOTLESSKIT_NET=slirp4netns, MTU defaults
  to 1500.

Change the logic so that, however slirp4netns is selected, MTU
defaults to 65520.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-10-10 10:13:50 +01:00
Rob Murray
7e63d2a81b dockerd-rootless.sh: if no slirp4netns, try pasta
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-10-10 10:13:50 +01:00
Rob Murray
734fc758f4 Merge pull request #51155 from austinvazquez/add-swarm-vip-endpoint-type-docs
api/types/swarm: add documentation to clarify virtual IP address type
2025-10-10 09:51:47 +01:00
Sebastiaan van Stijn
cfdb9068f0 client: ImagePullResponse: use sync.OnceValue
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-10 10:32:38 +02:00
Sebastiaan van Stijn
3c44bd67b2 client: ImagePullResponse: don't panic without reader
When stubbing a client for tests, and there's no reader set, we
just return an io.EOF, instead of panic.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-10 10:27:29 +02:00
Sebastiaan van Stijn
4210e4ad16 daemon/internal/netiputil: make "MaybeXXX" functions a function, not var
This make it ever so slightly more clear (also when viewing docs).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-10 10:23:03 +02:00
Cory Snider
4c6e571d38 api/pkg/stdcopy: move stdWriter to daemon/internal
Clients have no need for muxing streams using our StdCopy wire format.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-10-09 20:13:26 -04:00
Austin Vazquez
8cf0529a8c api/types/swarm: add documentation to clarify virtual IP address type
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-09 18:02:43 -05:00
Austin Vazquez
6e4684459d Merge pull request #51150 from austinvazquez/fix-swarm-type
api: fix swarm network field from addr to prefix
2025-10-09 14:15:02 -05:00
Sebastiaan van Stijn
e97d6d48ee Merge pull request #51053 from thaJeztah/selinux_socket
contrib: add docker_client SELinux policy module to access socket in container
2025-10-09 19:10:38 +02:00
Sebastiaan van Stijn
a3a605818d Merge pull request #51120 from thaJeztah/raise_fallback_api_step2
client: remove API-version compatibility for API < v1.44
2025-10-09 19:09:27 +02:00
Austin Vazquez
c2812dc285 api: fix swarm network field from addr to prefix
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-09 12:02:57 -05:00
Rob Murray
802142d4cf Merge pull request #50935 from ndeloof/decode-JSONMessage
introduce ImagePullResponse with helper method to manage JSONMessage stream decoding
2025-10-09 16:25:31 +01:00
Rob Murray
9912ccd7b3 Clean up bridge device on network create error
When the bridge driver encounters an error during network
creation, delete the bridge device if one has been added.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-10-09 15:52:25 +01:00
Nicolas De Loof
e6bac8983b introduce ImagePullResponse to manage JSONMessage stream decoding
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2025-10-09 15:36:22 +02:00
Sebastiaan van Stijn
7652f38c28 client: remove API-version compatibility for API < v1.44
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-08 23:43:59 +02:00
Sebastiaan van Stijn
6bbb92df70 Merge pull request #51115 from corhere/api-filter-type
client: add new `Filters` type to replace `api/types/filters` package
2025-10-08 23:30:20 +02:00
Sebastiaan van Stijn
ad728225a4 Merge pull request #51119 from thaJeztah/raise_fallback_api
client: remove support for negotiating API version < v1.44 (docker 25.0)
2025-10-08 23:18:37 +02:00
Sebastiaan van Stijn
e8c4b6ec32 Merge pull request #51139 from smerkviladze/bump-swarmkit-to-v2.1.1
vendor: github.com/moby/swarmkit/v2 v2.1.1
2025-10-08 23:16:27 +02:00
Rob Murray
a04b1aee35 Merge pull request #51134 from robmry/ipam_refactoring
Don't copy old network IPAM state to network config on daemon restart
2025-10-08 17:14:10 +01:00
Cory Snider
7ea066c8d1 client: add Filters type
Add a new type to use for building filter predicates for API requests,
replacing "./api/types/filters".Args in the client. Remove the now
unused api/types/filters package.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-10-08 12:06:31 -04:00
Cory Snider
778e5bfad3 api/types/filters: move to daemon/internal
Most of the code in the filters package relates to the unmarshaling,
validation and application of filters from client requests. None of this
is necessary or particularly useful for Go SDK users. Move the full-fat
filters package into daemon/internal and switch all the daemon code to
import that package so we are free to iterate upon the code without
worrying about source-code interface compatibility.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-10-08 12:06:26 -04:00
Paweł Gronowski
c09d53a1dd Merge pull request #51138 from thaJeztah/bump_x_net
vendor: update golang.org/x/ dependencies
2025-10-08 14:03:30 +02:00
Sebastiaan van Stijn
96b29f5a1f client: remove support for negotiating API version < v1.44 (docker 25.0)
Docker versions below 25.0 have reached EOL; 25.0 is currently maintained
as an LTS version by Mirantis, and we want to allow current versions of the
CLI to be able to connect to such setups.

This patch raises the fallback API version to API v1.44; when negotiating an API
version with a daemon, this will be the lowest version negotiated.

Currently, it still allows manually overriding the version to versions that
are not supported (`WithVersion`, `WithVersionFromEnv`), and no code has
been removed yet that adjusts the client for old API versions, but this
can be done in a follow-up.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-08 13:57:28 +02:00
Sebastiaan van Stijn
ef5feb4992 vendor: golang.org/x/net v0.45.0
full diff: https://github.com/golang/net/compare/v0.44.0...v0.45.0

From the security announcement:

[security] Vulnerabilities in golang.org/x/net

Hello gophers,

We have tagged version v0.45.0 of golang.org/x/net in order to address two
security issues.

This version fixes two vulnerabilities in the golang.org/x/net/html package
which could result in calls to Parse (and associated functions) executing
unexpectedly slowly relative to the size of the input or never returning when
encountering specific inputs.

These vulnerabilities affect programs which parse untrusted HTML documents.

- The parser implements the HTML specification, which contains a number of
  algorithms which are quadratic in complexity by design. This causes the
  processing time to scale non-linearly with respect to the size of the input for
  some HTML documents. We have imposed a depth limit of 512 for nested HTML tags,
  which should be high enough for the vast majority of valid HTML documents, to
  address this.

  Thanks to Jakub Guido Vranken and Jakub Ciolek for both independently reporting
  this issue.

  This is CVE-2025-47911 and Go issue https://go.dev/issue/75682.

- The parser also misimplemented a portion of the HTML specification for table
  related tags. This could cause the parser to enter an infinite loop when
  encountering specific combinations of tags.

  Thanks to Guido Vranken for reporting this issue.

  This is CVE-2025-58190 and Go issue https://go.dev/issue/70179.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-08 13:52:09 +02:00
Sebastiaan van Stijn
3f75e2116f vendor: golang.org/x mod v0.28, net v0.44, text v0.29, crypto v0.42, tools v0.37
full diff:

- https://github.com/golang/mod/compare/v0.24.0...v0.28.0
- https://github.com/golang/net/compare/v0.39.0...v0.44.0
- https://github.com/golang/text/compare/v0.24.0...v0.29.0
- https://github.com/golang/crypto/compare/v0.37.0...v0.42.0
- https://github.com/golang/tools/compare/v0.32.0...v0.37.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-08 13:51:51 +02:00
Sebastiaan van Stijn
6de0417884 vendor: golang.org/x/sync v0.17.0
full diff: https://github.com/golang/sync/compare/v0.16.0...v0.17.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-08 13:51:51 +02:00
Sebastiaan van Stijn
4bc628581d vendor: golang.org/x/sys v0.36.0
full diff: https://github.com/golang/sys/compare/v0.33.0...v0.36.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-08 13:51:51 +02:00
Sebastiaan van Stijn
9169ed2873 client: touch-up some godoc
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-08 13:44:39 +02:00
Sebastiaan van Stijn
04318e0d86 client: update some tests using obsolete API versions
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-08 13:44:39 +02:00
Sebastiaan van Stijn
77ca284d28 Merge pull request #51103 from thaJeztah/image_inspect_rm_deprecated
api/types/image: InspectResponse: remove deprecated fields
2025-10-08 13:06:09 +02:00
Sopho Merkviladze
ca9c5c6f7b vendor: github.com/moby/swarmkit/v2 v2.1.1
- Remove weak TLS cipher suites

full diff: https://github.com/moby/swarmkit/compare/v2.1.0...v2.1.1

Signed-off-by: Sopho Merkviladze <smerkviladze@mirantis.com>
2025-10-08 13:32:24 +04:00
Albin Kerouanton
45bc224dc6 Merge pull request #51127 from thaJeztah/info_remove_deprecated
api/types/system: remove deprecated Commit.Expected field
2025-10-08 11:08:06 +02:00
Austin Vazquez
258f340a46 Merge pull request #51136 from tonistiigi/update-buildkit-v0.25.1
vendor: update buildkit to v0.25.1
2025-10-07 17:59:35 -07:00
Tonis Tiigi
1b1608f2cd hack: add patch to buildkit tests
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2025-10-07 16:51:15 -07:00
Austin Vazquez
a8c0295a51 Merge pull request #51132 from vvoland/update-go
update to go1.24.8
2025-10-07 15:55:03 -07:00
Tonis Tiigi
3c418bea4e vendor: update buildkit to v0.25.1
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2025-10-07 15:12:21 -07:00
Paweł Gronowski
0aed907a86 update to go1.24.8
This minor release includes 10 security fixes following the security policy:

- net/mail: excessive CPU consumption in ParseAddress

    The ParseAddress function constructed domain-literal address components through repeated string concatenation. When parsing large domain-literal components, this could cause excessive CPU consumption.

    Thanks to Philippe Antoine (Catena cyber) for reporting this issue.

    This is CVE-2025-61725 and Go issue https://go.dev/issue/75680.

- crypto/x509: quadratic complexity when checking name constraints

    Due to the design of the name constraint checking algorithm, the processing time
    of some inputs scales non-linearly with respect to the size of the certificate.

    This affects programs which validate arbitrary certificate chains.

    Thanks to Jakub Ciolek for reporting this issue.

    This is CVE-2025-58187 and Go issue https://go.dev/issue/75681.

- crypto/tls: ALPN negotiation errors can contain arbitrary text

    The crypto/tls conn.Handshake method returns an error on the server-side when
    ALPN negotation fails which can contain arbitrary attacker controlled
    information provided by the client-side of the connection which is not escaped.

    This affects programs which log these errors without any additional form of
    sanitization, and may allow injection of attacker controlled information into
    logs.

    Thanks to National Cyber Security Centre Finland for reporting this issue.

    This is CVE-2025-58189 and Go issue https://go.dev/issue/75652.

- encoding/pem: quadratic complexity when parsing some invalid inputs

    Due to the design of the PEM parsing function, the processing time for some
    inputs scales non-linearly with respect to the size of the input.

    This affects programs which parse untrusted PEM inputs.

    Thanks to Jakub Ciolek for reporting this issue.

    This is CVE-2025-61723 and Go issue https://go.dev/issue/75676.

- net/url: insufficient validation of bracketed IPv6 hostnames

    The Parse function permitted values other than IPv6 addresses to be included in square brackets within the host component of a URL. RFC 3986 permits IPv6 addresses to be included within the host component, enclosed within square brackets. For example: "http://[::1]/". IPv4 addresses and hostnames must not appear within square brackets. Parse did not enforce this requirement.

    Thanks to Enze Wang, Jingcheng Yang and Zehui Miao of Tsinghua University for reporting this issue.

    This is CVE-2025-47912 and Go issue https://go.dev/issue/75678.

- encoding/asn1: pre-allocating memory when parsing DER payload can cause memory exhaustion

    When parsing DER payloads, memories were being allocated prior to fully validating the payloads.
    This permits an attacker to craft a big empty DER payload to cause memory exhaustion in functions such as asn1.Unmarshal, x509.ParseCertificateRequest, and ocsp.ParseResponse.

    Thanks to Jakub Ciolek for reporting this issue.

    This is CVE-2025-58185 and Go issue https://go.dev/issue/75671.

- net/http: lack of limit when parsing cookies can cause memory exhaustion

    Despite HTTP headers having a default limit of 1 MB, the number of cookies that can be parsed did not have a limit.
    By sending a lot of very small cookies such as "a=;", an attacker can make an HTTP server allocate a large amount of structs, causing large memory consumption.

    net/http now limits the number of cookies accepted to 3000, which can be adjusted using the httpcookiemaxnum GODEBUG option.

    Thanks to jub0bs for reporting this issue.

    This is CVE-2025-58186 and Go issue https://go.dev/issue/75672.

- crypto/x509: panic when validating certificates with DSA public keys

    Validating certificate chains which contain DSA public keys can cause programs
    to panic, due to a interface cast that assumes they implement the Equal method.

    This affects programs which validate arbitrary certificate chains.

    Thanks to Jakub Ciolek for reporting this issue.

    This is CVE-2025-58188 and Go issue https://go.dev/issue/75675.

- archive/tar: unbounded allocation when parsing GNU sparse map

    tar.Reader did not set a maximum size on the number of sparse region data blocks in GNU tar pax 1.0 sparse files. A maliciously-crafted archive containing a large number of sparse regions could cause a Reader to read an unbounded amount of data from the archive into memory. When reading from a compressed source, a small compressed input could result in large allocations.

    Thanks to Harshit Gupta (Mr HAX) - https://www.linkedin.com/in/iam-harshit-gupta/ for reporting this issue.

    This is CVE-2025-58183 and Go issue https://go.dev/issue/75677.

- net/textproto: excessive CPU consumption in Reader.ReadResponse

    The Reader.ReadResponse function constructed a response string through
    repeated string concatenation of lines. When the number of lines in a response is large,
    this could cause excessive CPU consumption.

    Thanks to Jakub Ciolek for reporting this issue.

    This is CVE-2025-61724 and Go issue https://go.dev/issue/75716.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-10-07 15:49:36 -05:00
Rob Murray
0cc04d0c5c Network restore, don't update config to match state
When a network-create request does not specify any IPAM config, on
daemon restart the network needs to be restored with the previously
allocated subnet and gateway.

Those fields were copied from "ipamInfo" (state from the old network)
into "ipamConfig" (user-requested config).

Avoid that by checking for this situation in the IPAM allocation
function - if no subnet/gateway is specified, and there's a value
in "ipamInfo", use it.

Also eliminate some pointer shenanigans (so now my IDE can find the
assignment to Network.ipamInfo).

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-10-07 18:16:29 +01:00
Sebastiaan van Stijn
104d26b53c Merge pull request #51125 from jsternberg/gcpolicy-invalid-calculations
builder: use proper percentage calculations for default gc policy
2025-10-07 19:07:31 +02:00
Sebastiaan van Stijn
b1e20b6a3a api/types/system: remove deprecated Commit.Expected field
This field was deprecated API v1.48 in [moby@ff191c5], and removed in
API v1.49 in [moby@564abf9].

This patch:

- Removes the field from the API Go types.
- Reimplements the `/info` endpoint with the `compat` package to replace
  the local `infoResponse` implementation.
- Removes the `ServiceConfig.ExtraFields` field in api/types/registry
  introduced in [moby@7d9c50d] to backfill the `AllowNondistributableArtifactsCIDRs`
  and `AllowNondistributableArtifactsHostnames` fields for API < v1.47.

We should also consider deprecating the `ContainerdCommit`, `RuncCommit`
and `InitCommit` fields on the `/info` response (as we also include this
information as part of the components returned in `/version`), but those
can still be useful currently for situations where a user only provides
`docker info` output.

[moby@ff191c5]: ff191c58f7
[moby@564abf9]: 564abf9157
[moby@7d9c50d]: 7d9c50db2b

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-07 18:18:55 +02:00
Paweł Gronowski
b5aae8df00 Merge pull request #51124 from crazy-max/ci-fix-sum
ci: fix cache for go modules
2025-10-07 17:24:02 +02:00
Jonathan A. Sternberg
1a7d7cc015 builder: use proper percentage calculations for default gc policy
The default gc policy calculations based on percentage were calculated
improperly. These were calculated correctly in buildkit, but the
calculation method was not copied over correctly when updating the
values.

Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com>
2025-10-07 10:18:17 -05:00
CrazyMax
dbcbe87d52 ci: fix cache for go modules
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2025-10-07 16:29:10 +02:00
Sebastiaan van Stijn
f8d3c4e4a7 api/types/image: InspectResponse: remove deprecated Parent, DockerVersion
The InspectResponse type contains various fields that are deprecated
and removed from current API versions, but that were kept for the API
server to produce the fields when downgrading to older API versions.

- The `Parent` field is only used for the legacy builder, and only set for
  images that are built locally (i.e., not persisted when pulling an image).
- The `DockerVersion` field is only set when building images with the legacy
  builder, and empty in most cases.

Both fields were implicitly deprecated with the deprecation of the legacy
builder, and deprecated for the API in [moby@bd8a99b], which was backported
to the 28.x release.

This patch:

- Removes the deprecated fields from the `InspectResposne` struct; this
  means that [`client.ImageInspect`] won't unmarshal those fields, but
  the [`docker image inspect`] CLI command defaults to printing the raw
  output as returned by the API, so can continue to show any field returned
  in the API response. As a side-note; we should change the CLI to default
  to show the unmarshalled response, and introduce a `--format=jsonraw`
  (or `--raw`) option to make printing the raw response opt-in.
- Updates the API server to backfill the fields if they are set.

[moby@bd8a99b]: bd8a99b400
[`client.ImageInspect`]: f739c61c69/client/image_inspect.go (L14-L64)
[`docker image inspect`]: 74e3520724/cli/command/image/inspect.go (L59-L81)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-07 13:31:17 +02:00
Sebastiaan van Stijn
1a81903854 api/types/image: InspectResponse: remove deprecated fields
The InspectResponse type contains various fields that are deprecated
and removed from current API versions, but that were kept for the API
server to produce the fields when downgrading to older API versions.

This patch:

- Introduces a `imagebackend.InspectData` type for the daemon to use for
  returning the data needed to propagate the API response. It currently
  embeds the API response type and combines it with the legacy fields,
  but this could be changed to return the internal Image type, and
  mapping the fields to the API response type in the router.
- Removes the deprecated fields from the `InspectResposne` struct; this
  means that [`client.ImageInspect`] won't unmarshal those fields, but
  the [`docker image inspect`] CLI command defaults to printing the raw
  output as returned by the API, so can continue to show any field returned
  in the API response. As a side-note; we should change the CLI to default
  to show the unmarshalled response, and introduce a `--format=jsonraw`
  (or `--raw`) option to make printing the raw response opt-in.

This patch removes the following fields from the `InspectResponse` type;

- `VirtualSize`: this field became obsolete with the migration to content-
  addressable images in docker v1.10 ([moby@4352da7]), but was still returned
  with a copy of the `Size` field. It was deprecated in API v1.43 ([moby@1261fe6]),
  and removed in API v1.44 ([moby@913b0f5]).
- `Container` and `ContainerConfig`: both fields were deprecated in
  API v1.44 ([moby@1602e2f]), and removed in API v1.45 ([moby@03cddc6]).

remove deprecated Container, ContainerConfig, VirtualSize

[moby@4352da7]: 4352da7803
[moby@1261fe6]: 1261fe69a3
[moby@913b0f5]: 913b0f51ca
[moby@1602e2f]: 1602e2f4f1
[moby@03cddc6]: 03cddc62f4
[`client.ImageInspect`]: f739c61c69/client/image_inspect.go (L14-L64)
[`docker image inspect`]: 74e3520724/cli/command/image/inspect.go (L59-L81)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-07 13:31:15 +02:00
Sebastiaan van Stijn
8d4cb6e071 Merge pull request #51101 from thaJeztah/less_dockerversion
daemon: stop propagating Image.DockerVersion, Plugin.Config.DockerVersion fields
2025-10-07 13:01:13 +02:00
Sebastiaan van Stijn
86c418ff49 Merge pull request #51118 from crazy-max/ci-cache-fixes
ci: update gha cache attributes
2025-10-07 12:17:43 +02:00
Sebastiaan van Stijn
a8dd9c5025 daemon/pkg/plugin: stop propagating Plugin.Config.DockerVersion field
The DockerVersion field was present for informational purposes, but was
not used anywhere. This patch stops propagating the field, which also
reduces the number of places where the `dockerversion` package is used,
which still needs a new home.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-07 11:46:52 +02:00
CrazyMax
1d3687aeee ci: update gha cache attributes
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2025-10-07 10:12:22 +02:00
Sebastiaan van Stijn
a99b7947e1 daemon: stop propagating Image.DockerVersion field
The DockerVersion field was used by the legacy builder, and set when
importing an image; when importing an image, this would potentially
result in less reproducible images, as the docker version used to import
the image would be encoded in the image's "v1" fields.

For the legacy builder, including the version of docker used to build
the image could still be useful information (but could be set as comment,
similar to what BuildKit does), however, many code paths were also shared
with other parts of the code; e.g., when listing images or inspecting images,
the `DockerVersion` field would always be set to the current version of
the docker daemon, and not taken from the information available in the
image (if any).

This patch removes locations where the `DockerVersion` field was set to
the current version of the daemon binary. When inspecting an image, the
field is still set with the information in the image itself (which may
be empty in most cases).

This also reduces the number of places where the `dockerversion` package
is used, which still needs a new home.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-07 09:00:09 +02:00
Austin Vazquez
19e498ea65 Merge pull request #51096 from austinvazquez/rework-go-mod-vendor-checks
Rework Go mod tidy/vendor checks
2025-10-06 17:09:38 -07:00
Austin Vazquez
f6e1bf2808 Rework Go mod tidy/vendor checks
This change reworks the Go mod tidy/vendor checks to run for all tracked Go modules by the project and fail for any uncommitted changes.

Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-06 14:43:30 -05:00
Sebastiaan van Stijn
694e30abff Merge pull request #51109 from thaJeztah/deprecate_plugin_dockerversion
api/types/plugin: deprecate Config.DockerVersion field
2025-10-06 16:35:09 +02:00
Sebastiaan van Stijn
2e9531ec35 Merge pull request #51098 from thaJeztah/fix_image_inspect_legacy
image inspect: fix legacy fields for API < v1.52 response
2025-10-06 16:34:22 +02:00
Akihiro Suda
58fdbd13e6 Merge pull request #51108 from thaJeztah/bump_devtools
Dockerfile: update docker CLI v28.5.0, buildx v0.29.1, compose v2.40.0
2025-10-06 22:41:21 +09:00
Sebastiaan van Stijn
45a728a13b image inspect: fix legacy fields for API < v1.52 response
This was a mistake I made in eafca64a6b,
which was extracted from a set of changes that I had in progress, but
I forgot that patch was unfinished (whoops!); before that commit, the
legacy "Config" fields were handled through the `inspectCompatResponse`,
which applied the legacy fields to the `Config` struct within the image
inspect response.

When changing the implementation to use the `compat` package, those
fields were applied at the top-level of the response, instead of the
`Config`; additional changes were needed for the `compat` package to
support pathing nested structs, and to prevent "extra" fields from
overwriting fields that already existed in the response; these changes
were implemented in e204ba1dca.

This patch:

- Removes the old `inspectCompatResponse` implementation, which was
  no longer used.
- Updates the router to patch the `Config` fields, using the fixes
  and enhancements that were implemented in e204ba1dca.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-06 15:12:11 +02:00
Sebastiaan van Stijn
3c4bd367e1 Merge pull request #51099 from thaJeztah/consistent_alias
use consistent alias for docker image spec
2025-10-06 14:51:09 +02:00
Sebastiaan van Stijn
e9c28e684e Merge pull request #51100 from thaJeztah/linty_nits
daemon/images: minor linting fixes
2025-10-06 14:50:31 +02:00
Sebastiaan van Stijn
fdd61821da use consistent alias for docker image spec
This package was aliased as "imagespec" in some places, and "dockerspec"
in other places, which made it easy to confuse.

Change all uses of this package to be aliased as "dockerspec" and configure
an "importas" linting check to enforce it.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-06 14:24:41 +02:00
Sebastiaan van Stijn
c4fda95bea api/types/plugin: deprecate Config.DockerVersion field
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-06 14:19:53 +02:00
Sebastiaan van Stijn
4302ae9d1a Merge pull request #51102 from thaJeztah/move_more_imagebackendopts
daemon/server: move GetImageOpts, ImageInspectOpts to imagebackend
2025-10-06 14:17:32 +02:00
Sebastiaan van Stijn
b0c5090275 Merge pull request #51106 from thaJeztah/rm_deprecated_utils
integration-cli: remove deprecated buildImageSuccessfully, buildImage utilities
2025-10-06 12:45:40 +02:00
Sebastiaan van Stijn
8ddcbbd612 Merge pull request #51094 from austinvazquez/consolidate-api-port-types
Consolidate api port types
2025-10-06 12:35:15 +02:00
Sebastiaan van Stijn
4044497f86 Merge pull request #51104 from thaJeztah/deprecate_legacy_inspect_fields
api/types/image: InspectResponse: deprecate Parent, DockerVersion
2025-10-06 11:42:05 +02:00
Sebastiaan van Stijn
93ea597dde Merge pull request #51097 from thaJeztah/compat_recurse
daemon/internal/compat: add extra fields recursively, and don't replace
2025-10-06 11:41:15 +02:00
Sebastiaan van Stijn
a9a1ac3c45 Dockerfile: update compose to v2.40.0
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-06 11:21:46 +02:00
Sebastiaan van Stijn
94ab6a9c5e Dockerfile: update buildx to v0.29.1
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-06 11:21:07 +02:00
Sebastiaan van Stijn
b9ac2cea0c Dockerfile: update cli to v28.5.0
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-06 11:19:20 +02:00
Sebastiaan van Stijn
222a3fe94e integration-cli: remove deprecated buildImage utility
This was deprecated in 50c4475df6, which
introduced the cli test-utils package.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-06 10:21:52 +02:00
Sebastiaan van Stijn
bd8a99b400 api/types/image: InspectResponse: deprecate Parent, DockerVersion
The image inspect response has various fields that were deprecated as
part of the legacy builder, or Dockerfile syntax;

- The `Parent` field is only used for the legacy builder, and only set for
  images that are built locally (i.e., not persisted when pulling an image).
- The `DockerVersion` field is only set when building images with the legacy
  builder, and empty in most cases.

This patch deprecates the fields in the `InspectResponse` go struct, as
these fields will no longer be set in future once the legacy builder is
removed (`Parent`, `DockerVersion`). The legacy builder's deprecation in
[cli@4d8e457] / [cli@fd22746] (docker 23.0, API v1.42), however the related
API fields were kept so that information of legacy images would not be
discarded.

The API continues to return these fields if set, allowing the client to
print the fields for informational purposes when printing the raw response,
but these fields should be considered "transitional", and not be depended
on; deprecating the fields helps raise awareness.

[cli@4d8e457]: 4d8e45782b
[cli@fd22746]: fd2274692f

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-05 23:00:18 +02:00
Sebastiaan van Stijn
288b9f033b integration-cli: remove deprecated buildImageSuccessfully utility
This was deprecated in 50c4475df6, which
introduced the cli test-utils package.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-05 17:27:26 +02:00
Sebastiaan van Stijn
15bef6ff1a daemon/server: move GetImageOpts, ImageInspectOpts to imagebackend
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-05 13:41:22 +02:00
Sebastiaan van Stijn
95e77d6861 daemon/images: minor linting fixes
Minor issues to make my IDE happy:

- rename var that shadowed import
- rename vars to use the correct camelCase format
- fix minor grammar / formatting in comments

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-05 13:21:19 +02:00
Sebastiaan van Stijn
e204ba1dca daemon/internal/compat: add extra fields recursively, and don't replace
This was a bit of an oversight; when setting additional fields to add,
the compat package currently replaces fields unconditionally. This may
have sounded like an OK idea, but it makes it more complicated to augment
responses where current versions use an "omitempty", but older API versions
should return default / zero-values.

This patch:

- Changes the meaning of "extra fields"; extra fields are only used if
  the field is not present in the response.
- Makes the merging of "extra fields" recursive; this makes it easier
  to patch responses where extra fields must be added to nested structs.
  Previously, this would require the nested struct to be wrapped with a
  `compat.Wrap` and replaced as a whole; lacking a "replace" option made
  that more complicated, so making the extra fields recursive.
- Comment-out a test that tested the old behavior of replacing fields;
  we currently have no cases where we must _replace_ fields or structs,
  so I did not yet implement such an option, but we can implement a
  `WithReplaceFields` (e.g.) once there's a need.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-04 15:09:22 +02:00
Sebastiaan van Stijn
f739c61c69 Merge pull request #51072 from thaJeztah/image_inspect_omit_legacy
api: omit legacy fields from image inspect if not set
2025-10-04 10:31:14 +02:00
Austin Vazquez
42299d751a Merge pull request #51071 from thaJeztah/client_legacy_api_tests
client: reduce uses of obsolete API versions in tests
2025-10-03 17:00:37 -07:00
Austin Vazquez
50269e6e39 api/types/swarm: remove PortConfigProtocol
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-03 17:34:09 -05:00
Austin Vazquez
ea76dbefeb api/types/swarm: deprecate PortConfigProtocol
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-03 17:34:00 -05:00
Austin Vazquez
c646091d57 api: move container port type to network package
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-03 17:30:42 -05:00
Sebastiaan van Stijn
038bfbfbd4 api: omit legacy fields from image inspect if not set
The image inspect response has various fields that are either optional,
or only used if the image was built using the deprecated legacy builder.
This patch marks them as "omitempty" to omit them from the response if
not set:

- The `Parent` field is only used for the legacy builder, and only set for
  images that are built locally (i.e., not persisted when pulling an image).
- The `Comment` field is optional, and may not be set, depending on how the
  image is produced.
- The `DockerVersion` field is only set when building images with the legacy
  builder, and empty in most cases.
- The `Author` field can be set through the `MAINTAINER` instruction in
  Dockerfiles, and through the `--author` option on `docker commit`, but
  is optional, and won't be set in most situations.

With this patch:

On API v1.52

    DOCKER_API_VERSION=v1.52 docker inspect busybox
    [
        {
            "Id": "sha256:d82f458899c9696cb26a7c02d5568f81c8c8223f8661bb2a7988b269c8b9051e",
            "RepoTags": ["busybox:latest"],
            "RepoDigests": ["busybox@sha256:d82f458899c9696cb26a7c02d5568f81c8c8223f8661bb2a7988b269c8b9051e"],
            "Created": "2024-09-26T21:31:42Z",
            "Config": {
                "Env": ["PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"],
                "Cmd": ["sh"]
            },
            "Architecture": "arm64",
            "Variant": "v8",
            "Os": "linux",
            "Size": 1913388,
            "RootFS": {
                "Type": "layers",
                "Layers": ["sha256:6aba5e0d32d91e3e923854dcb30588dc4112bfa1dae82b89535ad31d322a7b19"]
            },
            "Metadata": {
                "LastTagTime": "2025-10-03T22:24:18.440035424Z"
            },
            "Descriptor": {
                "mediaType": "application/vnd.oci.image.index.v1+json",
                "digest": "sha256:d82f458899c9696cb26a7c02d5568f81c8c8223f8661bb2a7988b269c8b9051e",
                "size": 9535
            }
        }
    ]

On API v1.51 or lower:

    DOCKER_API_VERSION=v1.51 docker inspect busybox
    [
        {
            "Architecture": "arm64",
            "Author": "",
            "Cmd": null,
            "Comment": "",
            "Config": {
                "Cmd": ["sh"],
                "Env": ["PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"]
            },
            "Created": "2024-09-26T21:31:42Z",
            "Descriptor": {
                "digest": "sha256:d82f458899c9696cb26a7c02d5568f81c8c8223f8661bb2a7988b269c8b9051e",
                "mediaType": "application/vnd.oci.image.index.v1+json",
                "size": 9535
            },
            "DockerVersion": "",
            "Entrypoint": null,
            "Env": null,
            "Id": "sha256:d82f458899c9696cb26a7c02d5568f81c8c8223f8661bb2a7988b269c8b9051e",
            "Labels": null,
            "Metadata": {
                "LastTagTime": "2025-10-03T22:24:18.440035424Z"
            },
            "OnBuild": null,
            "Os": "linux",
            "Parent": "",
            "RepoDigests": ["busybox@sha256:d82f458899c9696cb26a7c02d5568f81c8c8223f8661bb2a7988b269c8b9051e"],
            "RepoTags": ["busybox:latest"],
            "RootFS": {
                "Layers": ["sha256:6aba5e0d32d91e3e923854dcb30588dc4112bfa1dae82b89535ad31d322a7b19"],
                "Type": "layers"
            },
            "Size": 1913388,
            "User": "",
            "Variant": "v8",
            "Volumes": null,
            "WorkingDir": ""
        }
    ]

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-04 00:30:40 +02:00
Austin Vazquez
9069e681b1 Merge pull request #51095 from thaJeztah/sync_swagger_docs
api: docs: sync v1.52 yaml
2025-10-03 15:17:28 -07:00
Sebastiaan van Stijn
4763719552 Merge pull request #51073 from thaJeztah/server_side_autorm
daemon, client: remove version-gate for daemon-side AutoRemove
2025-10-04 00:01:00 +02:00
Sebastiaan van Stijn
e5a66cb6d6 Merge pull request #51093 from austinvazquez/add-check-for-missing-go-sum
Add existence check for go.mod and go.sum files
2025-10-04 00:00:22 +02:00
Sebastiaan van Stijn
f289cb2d7c api: docs: sync v1.52 yaml
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-03 23:53:46 +02:00
Sebastiaan van Stijn
73bacc61b3 Merge pull request #50953 from ndeloof/ndjson
fix content-type declared by /events API
2025-10-03 23:50:58 +02:00
Sebastiaan van Stijn
88adc28731 Merge pull request #50956 from corhere/api-netip-types
api: change IP address fields over to netip types
2025-10-03 23:10:04 +02:00
Cory Snider
d6899ca5a5 api/types/registry: use netip types as appropriate
Signed-off-by: Cory Snider <csnider@mirantis.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-03 21:41:21 +02:00
Cory Snider
fd4329a620 api/types/container: use netip types as appropriate
Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-10-03 21:39:14 +02:00
Cory Snider
d5c838dc5e internal: move sliceutil from daemon/internal
These utilities are very handy to use in integration tests, too. Move
the package so it can be imported by them.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-10-03 21:39:14 +02:00
Cory Snider
a90adb6dc1 api/types/network: use netip types as appropriate
And generate the ServiceInfo struct from the Swagger spec.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-10-03 21:39:14 +02:00
Cory Snider
ef31514a9f api/t/network: move IPAM validation to daemon
Clients should not make assumptions about the validity of an API struct
as the set of well-formed values may differ across daemon versions.
Remove it from the API module so client-application authors are not
tempted to apply it, which would restrict the forward compatibility of
the client.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-10-03 21:39:14 +02:00
Cory Snider
4d6a2be79d api/t/network: validate EndpointIPAMConfig in daemon
Clients should not make assumptions about the validity of an API struct
as the set of well-formed values may differ across daemon versions.
Remove it from the API module so client-application authors are not
tempted to apply it, which would restrict the forward compatibility of
the client.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-10-03 21:39:14 +02:00
Cory Snider
2da472b1a5 api/types/system: use netip types where appropriate
Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-10-03 21:39:13 +02:00
Cory Snider
cc082add87 api/types/swarm: use netip types as appropriate
Change the types for IP address and prefix struct fields to netip.Addr
and netip.Prefix for convenience. Fields such as
swarm.InitRequest.ListenAddr which may encode non-numeric values such as
a network interface name have not been modified.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-10-03 21:39:13 +02:00
Cory Snider
46ab36ae46 daemon/internal: move netiputil from libnetwork
These utilities are going to be needed elsewhere in the daemon to handle
netip values from API requests.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-10-03 21:39:13 +02:00
Cory Snider
470f5b50a5 internal/sliceutil: map nil to nil
As there is a meaningful distinction between a nil slice and an empty
but non-nil slice in some contexts, having sliceutil.Map return an empty
slice when passed a nil slice can introduce subtle bugs. Modify Map to
return a nil slice when passed a nil slice.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-10-03 21:39:10 +02:00
Nicolas De Loof
df506c107e negociate content-type used by /events API
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2025-10-03 20:27:42 +02:00
Rob Murray
b26972f9f2 Merge pull request #51033 from robmry/use-libnftables
Use libnftables in dynamically linked binary
2025-10-03 16:53:06 +01:00
Austin Vazquez
0ad35e3ef0 Add existence check for go.mod and go.sum files
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-03 08:00:49 -05:00
Austin Vazquez
4279e522e1 Merge pull request #50710 from austinvazquez/define-network-port-types
api: add container network port types
2025-10-02 17:43:58 -07:00
Sebastiaan van Stijn
9b1418f1c9 Merge pull request #51070 from thaJeztah/rm_deprecated_virtualsize
daemon/server: implement image-inspect with "compat" package
2025-10-02 21:34:45 +02:00
Austin Vazquez
cb3abacc52 api/types/container: add network port and port range types
Co-authored-by: Sebastiaan van Stijn <github@gone.nl>
Co-authored-by: Cory Snider <csnider@mirantis.com>
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-02 13:59:34 -05:00
Sebastiaan van Stijn
bb0778635e Merge pull request #51076 from vvoland/client-buildcancel
client/build_*: Add options struct, wrap result
2025-10-01 20:17:06 +02:00
Paweł Gronowski
c46704a80f client/build_prune: Wrap result in a struct
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-10-01 14:14:57 +02:00
Sebastiaan van Stijn
5c877f4d24 Merge pull request #51074 from jsternberg/vendor-buildkit
vendor: github.com/moby/buildkit v0.25.0
2025-10-01 14:11:16 +02:00
Paweł Gronowski
a35b3cd149 client/build_cancel: Add options struct
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-10-01 12:57:46 +02:00
Jonathan A. Sternberg
3f3bbe4430 vendor: github.com/moby/buildkit v0.25.0
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-10-01 11:29:07 +02:00
Sebastiaan van Stijn
9a32a7e0d1 daemon, client: remove version-gate for daemon-side AutoRemove
Support for daemon-side auto-remove was added in API v1.25; on older
versions of the daemon, the client was responsible for removing the
container after it exited (see [moby@6dd8e10])

On API versions < 1.30, it used the events API for this purpose, and
would wait for a "die", "detach" or "detroy" events to know the container
exited, and could be removed or (when attached, but without a TTY) to
get the container's exit-status. (see [cli@38591f2]).

API version 1.24 (docker 1.12) is 9 Years old (July 29, 2016), and API
1.30 (docker 17.06) is 8 Years old (Jun 20, 2017), and long EOL. While
technically, a CLI could negotiate API 1.30 or older, this would only
be in cases where either API version negotiation failed, or the version
was explicitly overridden through `DOCKER_API_VERSION` for testing.

This patch removes the version-gate for daemon-side AutoRemove; version-
specific handling is removed from the client (and a related patch in
the CLI).

[moby@6dd8e10]: 6dd8e10d6e
[cli@38591f2]: 38591f20d0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-30 18:31:22 +02:00
Sebastiaan van Stijn
0b6c94aa7a Merge pull request #51068 from thaJeztah/docs_rm_deprecated_virtualsize
api: swagger: remove VirtualSize fields for API > v1.43
2025-09-30 14:55:38 +02:00
Sebastiaan van Stijn
af5988238a client: reduce uses of obsolete API versions in tests
TestGetAPIPath: don't use obsolete API versions in test

This test was using API v1.22 as "old" version to verify the given
version overrode the default. Update it to use a previous API version
that's still supported by the client.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-30 14:39:48 +02:00
Sebastiaan van Stijn
eafca64a6b daemon/server: implement image-inspect with "compat" package
Trying to remove uses of deprecated fields that are only set for backward-
compatibility with older API versions. This is not a full replacement yet,
as there's still other fields ("Container", "ContainerConfig") that are
harder to replace without an (internal / backend) type to define them,
but this patch removes the dependency of the daemon on the `VirtualSize`
field on image inspect.

The "image ls" endpoint needs a similar patch, because "image.Summary" also
has a `VirtualSize` field that's removed in API v1.44 and up.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-30 14:33:38 +02:00
Sebastiaan van Stijn
51cbd2ed16 api: swagger: remove VirtualSize fields for API > v1.43
The `VirtualSize` field was deprecated in [moby@1261fe6], and omitted / removed
in API v1.44 in [moby@913b0f5]. We should not document the field as part of
those API versions as it no longer exists for those.

[moby@1261fe6]: 1261fe69a3
[moby@913b0f5]: 913b0f51ca

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-30 13:14:06 +02:00
Sebastiaan van Stijn
4ca8aedf92 Merge pull request #51066 from austinvazquez/deprecate-and-remove-kernel-memory-tcp
Deprecate and remove kernel memory tcp
2025-09-30 10:29:20 +02:00
Austin Vazquez
a7edbe8e5f api: remove support for KernelMemoryTCP
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-09-30 10:13:51 +02:00
Austin Vazquez
fb2f8115c8 api: deprecate KernelMemoryTCP support
Starting with kernel v6.12, kernel memory TCP accounting is deprecated for cgroups v1.
Note: kernel memory TCP accounting is not supported by cgroups v2.

See d046ff46ee

Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-30 10:13:30 +02:00
Sebastiaan van Stijn
9a97f59e6e Merge pull request #51058 from thaJeztah/bump_golang_set
vendor: github.com/deckarep/golang-set/v2 v2.8.0
2025-09-29 16:47:31 +02:00
Sebastiaan van Stijn
1e30f2e3c6 Merge pull request #51063 from thaJeztah/rm_libnet_types
daemon/libnetwork/internal/kvstore: remove unused `BOLTDB`, `Backend` type, and `ErrBackendNotSupported`
2025-09-29 16:46:59 +02:00
Sebastiaan van Stijn
b6797dff8c Merge pull request #51062 from robmry/fix_epcnt_warning
Eliminate warning about endpoint count store delete
2025-09-29 15:15:07 +02:00
Sebastiaan van Stijn
a0e91f5284 Merge pull request #51055 from thaJeztah/tls13_changes
client,  integration-cli: adjust for go1.25, TLS1.3 handshake
2025-09-29 15:06:07 +02:00
Sebastiaan van Stijn
eff4f064a3 daemon/libnetwork/internal/kvstore: remove unused ErrBackendNotSupported
The `ErrBackendNotSupported` error was no longer used since [moby@37cbdeb].

[moby@37cbdeb]: 37cbdeb1f2

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-29 14:53:01 +02:00
Sebastiaan van Stijn
1697aecbd5 daemon/libnetwork/internal/kvstore: remove unused BOLTDB and Backend type
The `BOLTDB` const and related `Backend` type are no longer used since
[moby@ed08486].

[moby@ed08486]: ed08486ec7

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-29 14:45:40 +02:00
Austin Vazquez
5fc0251dc2 Merge pull request #51060 from thaJeztah/rm_email_example
api/docs: remove email field from example auth
2025-09-29 05:33:07 -07:00
Austin Vazquez
815936ac14 Merge pull request #51059 from thaJeztah/rm_authconfig_email
api/types/registry: remove deprecated AuthConfig.Email field
2025-09-29 05:29:29 -07:00
Rob Murray
94bcf89412 Eliminate warning about endpoint count store delete
Commit 380ded6 restored a now-unused endpoint count to the
store, so that when the daemon is downgraded it exists for
the old code to find.

But, on network deletion, the endpoint count was not loaded
from the store - so the delete code saw the wrong "index",
and logged a warning before deleting it anyway.

Use DeleteObject instead of DeleteObjectAtomic, so the old
index isn't checked.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-09-29 11:40:23 +01:00
Sebastiaan van Stijn
08d014cac8 api/docs: remove email field from example auth
This field was no longer used since Docker 1.11 (API version 1.23)
through [moby@aee260d] and [engine-api@9a9e468] but kept and deprecated
in [engine-api@167efc7], however the docs still used it in an example.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-29 11:29:56 +02:00
Sebastiaan van Stijn
344ab458a1 api/types/registry: remove deprecated AuthConfig.Email field
This field was no longer used since Docker 1.11 (API version 1.23)
through [moby@aee260d] and [engine-api@9a9e468] but kept, and deprecated
in [engine-api@167efc7] with a fix-up in [moby@6cfff7e8803a7].

This patch removes the field so that we don't have to carry it in the
new moby/api module.

[moby@aee260d]: aee260d4eb
[engine-api@9a9e468]: 9a9e468f50
[engine-api@167efc7]: 167efc72bb
[moby@6cfff7e8803a7]: 6cfff7e880

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-29 11:18:39 +02:00
Sebastiaan van Stijn
3241d46525 client: Client.doRequest: adjust error matching for TLS1.3 handshake
Go 1.25 /  TLS 1.3 may produce a generic "handshake failure" whereas
TLS 1.2 may produce a "bad certificate" TLS alert.
See https://github.com/golang/go/issues/56371

> https://tip.golang.org/doc/go1.12#tls_1_3
>
> In TLS 1.3 the client is the last one to speak in the handshake, so if
> it causes an error to occur on the server, it will be returned on the
> client by the first Read, not by Handshake. For example, that will be
> the case if the server rejects the client certificate.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-29 10:31:43 +02:00
Sebastiaan van Stijn
b8fbd0539e vendor: github.com/deckarep/golang-set/v2 v2.8.0
- feat: Support 1.23 iterator for set
- feat: add ContainsAnyElement method
- feat: add ContainsOne method
- feat: add IsEmpty functionality to set
- feat: add Sorted method
- feat: add ContainsAny functionality to Set
- Switch to pointer receivers, fixes UnmarshalJSON
    - fixes Unmarshalling threadUnsafeSet with json.Unmarshal panics

full diff: https://github.com/deckarep/golang-set/compare/v2.3.0...v2.8.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-29 10:24:39 +02:00
Sebastiaan van Stijn
178d697484 integration-cli: adjust TestHTTPSInfoRogueCert for TLS1.3 handshake
Go 1.25 /  TLS 1.3 may produce a generic "handshake failure"
whereas TLS 1.2 may produce a "bad certificate" TLS alert.
See https://github.com/golang/go/issues/56371

> https://tip.golang.org/doc/go1.12#tls_1_3
>
> In TLS 1.3 the client is the last one to speak in the handshake, so if
> it causes an error to occur on the server, it will be returned on the
> client by the first Read, not by Handshake. For example, that will be
> the case if the server rejects the client certificate.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-29 10:00:32 +02:00
Akihiro Suda
42233dd21e Merge pull request #51048 from thaJeztah/bump_memdb
vendor: github.com/hashicorp/go-memdb v1.3.5
2025-09-28 00:45:00 +09:00
Akihiro Suda
32d8f6883c Merge pull request #51046 from thaJeztah/bump_cgroups
vendor: github.com/opencontainers/cgroups v0.0.5
2025-09-28 00:44:17 +09:00
Sebastiaan van Stijn
9b0c78e7d8 Merge pull request #50857 from austinvazquez/add-container-inspect-storage-driver
Add container inspect storage field
2025-09-27 00:49:07 +02:00
Austin Vazquez
efa077848f api/types/storage: define generic Storage type for container inspect
This change defines the generic `Storage` type for use in container inspect responses when using containerd snapshotter backend.

Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-09-26 14:21:43 -05:00
Paweł Gronowski
8025c40493 Merge pull request #51051 from vvoland/api-checkpoints-list-null
api/checkpoint: Don't return null if no checkpoints
2025-09-26 17:27:02 +00:00
Sebastiaan van Stijn
57c9db5192 Merge pull request #51050 from vvoland/client-checkpointlist
client/checkpoint_list: Wrap result in a struct
2025-09-26 18:43:06 +02:00
Sebastiaan van Stijn
77bf85647c contrib: add docker_client SELinux policy module to access socket in container
When running the docker daemon with `--selinux-enabled`, access to the docker
socket is prevented by SELinux. To access the socket, the container must be
started with `--privileged`, with SELinux disabled (`--security-opt label=disable`),
or with (e.g.) `--security-opt label=type:container_runtime_t`, which gives
it access to files restricted to the runtime ( `dockerd` daemon) itself.

While having access to the docker socket grants full `root` permissions on
the host (e.g. through starting a privileged container using the socket),
it may be preferable to restrict the container to just the socket.

This patch adds a `docker_client.process` SELinux CIL policy module that
defines a container domain (process type). It inherits the base container
template and grants the permissions needed to use the docker socket.

Without this (and the daemon running with `--selinux-enabled`);

    docker run -it --rm -v /var/run/docker.sock:/var/run/docker.sock docker:cli -H unix:///var/run/docker.sock version
    Client:
     Version:           28.4.0
     API version:       1.51
     Go version:        go1.24.7
     Git commit:        d8eb465
     Built:             Wed Sep  3 20:56:28 2025
     OS/Arch:           linux/amd64
     Context:           default
    permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/v1.51/version": dial unix /var/run/docker.sock: connect: permission denied

With this:

    semodule -i /usr/share/udica/templates/base_container.cil
    semodule -i ./contrib/selinux/docker_client.cil

    docker run -it --rm -v /var/run/docker.sock:/var/run/docker.sock --security-opt label=type:docker_client.process docker:cli -H unix:///var/run/docker.sock version
    Client:
     Version:           28.4.0
     API version:       1.51
     Go version:        go1.24.7
     Git commit:        d8eb465
     Built:             Wed Sep  3 20:56:28 2025
     OS/Arch:           linux/amd64
     Context:           default

    Server: Docker Engine - Community
     Engine:
      Version:          28.4.0
      API version:      1.51 (minimum version 1.24)
      Go version:       go1.24.7

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-26 17:38:36 +02:00
Paweł Gronowski
b48fcf6cdb client/checkpoint_list: Wrap result in a struct
The CheckpointList method previously returned a raw slice of
checkpoint.Summary, which made it difficult to extend the API response
with additional metadata or fields in the future without breaking
backward compatibility.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-09-26 17:03:07 +02:00
Paweł Gronowski
646e068cf1 api/checkpoint: Don't return null if no checkpoints
This fixes a bug where no checkpoints would produce a `null` response
instead of an empty array:

```
$ docker run -d --name foo nginx:alpine
17fbeff7185733f101c38cb8208359dd0ef141116a1345da2d3c3f58c11f3e14

$ curl --unix-socket /var/run/docker.sock http://local/containers/foo/checkpoints
null
```

With this patch, this becomes:
```
$ curl --unix-socket /var/run/docker.sock http://local/containers/foo/checkpoints
[]
```

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-09-26 16:45:04 +02:00
Rob Murray
38fb0dd10c Add build tag "no_libnftables"
With this tag, a dynamically linked binary will exec
the nft tool instead of using cgo to call libnftables
directly.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-09-26 13:36:39 +00:00
Paweł Gronowski
2670796a01 Merge pull request #51045 from thaJeztah/t_context
use t.Context() instead of context.TODO() in various tests
2025-09-26 09:09:01 +00:00
Sebastiaan van Stijn
062479f95c vendor: github.com/hashicorp/go-memdb v1.3.5
full diff: https://github.com/hashicorp/go-memdb/compare/v1.3.2...v1.3.5

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-26 00:51:04 +02:00
Sebastiaan van Stijn
3912ffacd6 integration/nw: TestEmptyPortBindingsBC use context
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-25 22:53:49 +02:00
Sebastiaan van Stijn
e80e2908ba dockerversion: use t.Context() in tests
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-25 22:53:49 +02:00
Sebastiaan van Stijn
aca0adfb97 daemon: use t.Context() in tests
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-25 22:53:48 +02:00
Sebastiaan van Stijn
8905c3052b daemon/libnetwork: use t.Context() in tests
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-25 22:53:41 +02:00
Sebastiaan van Stijn
01f9186d6d daemon/logger: use t.Context() in tests
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-25 21:15:02 +02:00
Sebastiaan van Stijn
c1c9087404 daemon/containerd: use t.Context() in tests
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-25 21:15:02 +02:00
Sebastiaan van Stijn
544f8f53ed daemon/builder: use t.Context() in tests
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-25 21:15:02 +02:00
Sebastiaan van Stijn
415274d62a vendor: github.com/opencontainers/cgroups v0.0.5
notable changes:

- Implement AddPid method for cgroup managers

full diff: https://github.com/opencontainers/cgroups/compare/v0.0.4...v0.0.5

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-25 21:01:41 +02:00
Sebastiaan van Stijn
4809fe0ffa Merge pull request #51043 from thaJeztah/bump_go_systemd
vendor: github.com/coreos/go-systemd/v22 v22.6.0
2025-09-25 21:01:19 +02:00
Sebastiaan van Stijn
73a30d9a2b Merge pull request #51031 from thaJeztah/bump_runtime_tools
vendor: opencontainers/runtime-tools v0.9.1-0.20250523060157-0ea5ed0382a2
2025-09-25 21:01:01 +02:00
Sebastiaan van Stijn
73ed41ef79 vendor: github.com/coreos/go-systemd/v22 v22.6.0
notable changes:

- journal: fix return types inside C wrapper functions
- dlopen: make error handling thread safe
- dbus: add AttachProcessesToUnit
- dbus: Add a comment about result channel behaviour

full diff: https://github.com/coreos/go-systemd/compare/v22.5.0...v22.6.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-25 13:45:26 +02:00
Sebastiaan van Stijn
0f393630f8 vendor: opencontainers/runtime-tools v0.9.1-0.20250523060157-0ea5ed0382a2
full diff: 2e043c6bd6...0ea5ed0382

Notable changes:

- Revert "Change /dev to be mounted by default with /noexec".  Mounting /dev
  with 'noexec' option triggers problems when containers try to create Intel
  SGX enclaves: [runtime-tools@0524bb2]
- Switch to github.com/moby/sys/capability [runtime-tools@c2dadba]

[runtime-tools@0524bb2]: 0524bb2cf6
[runtime-tools@c2dadba]: c2dadba13f

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-25 13:33:34 +02:00
Paweł Gronowski
22016b516b Merge pull request #51024 from thaJeztah/custom_metaheaders
daemon/containerd: pass custom metaHeaders to resolver
2025-09-25 11:26:44 +00:00
Paweł Gronowski
4181d934be Merge pull request #50869 from vvoland/c8d-fix-windows-migration
daemon: Fix unwanted c8d migration on Windows
2025-09-25 11:13:39 +00:00
Rob Murray
6db6de2c20 Use libnftables in dynamically linked binary
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-09-24 18:27:17 +01:00
Sebastiaan van Stijn
dcf5db2464 Merge pull request #51029 from tonistiigi/update-buildkit-v0.25.0-rc1
vendor: update buildkit to v0.25.0-rc1
2025-09-24 13:51:38 +02:00
Tonis Tiigi
e8d3609031 hack: use custom ref for buildkit tests
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-09-24 13:19:48 +02:00
Tonis Tiigi
21d2d55500 vendor: update buildkit to v0.25.0-rc1
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2025-09-23 13:33:46 -07:00
Sebastiaan van Stijn
e98849831f Merge pull request #51021 from robmry/setuposcontext_leaks
testutil:SetupTestOSContext - fix ns/netlink handle leaks
2025-09-23 21:03:48 +02:00
Sebastiaan van Stijn
ddcc286e36 Merge pull request #51027 from thaJeztah/api_rm_BridgeNfIptables
api: docs: remove deprecated BridgeNfIptables, BridgeNfIp6tables
2025-09-23 20:53:13 +02:00
Rob Murray
de5e64b3bd Add option WithSetNsHandles for testutil SetupTestOSContextEx
Allow tests to run in parallel with separate network namespaces,
without modifying the global-state namespace/netlink handles in
the "ns" package ... only useful for tests that don't depend on
package "ns".

Use the new option in iptabler/nftabler tests.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-09-23 17:35:58 +01:00
Sebastiaan van Stijn
0fb46d08ad api: docs: remove deprecated BridgeNfIptables, BridgeNfIp6tables
The `BridgeNfIptables` and `BridgeNfIp6tables` were removed in API v1.50
in commit 6505d3877c, and only returned in
lower API versions.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-23 18:17:25 +02:00
Rob Murray
362d4d9538 testutil:SetupTestOSContext - don't leak namespaces, netlink handles
SetupTestOSContextEx calls 'ns.Init' (which, outside tests, is protected
by a sync.Once), and it's called again by the returned OSContext.Cleanup
method. That overwrites the ns package's namespace and netlink handles
(initNs and initNl) without closing them.

Because SetupTestOSContextEx changes that shared state, it should not
be used in parallel tests. So, rather than trying to close the handles
in ns.Init if already open - un-export Init so it's always called via
its sync.Once, and add a reset function for tests to use. Have
SetupTestOSContextEx claim a mutex to avoid crashy surprises or
hard to catch issues where the ns package isn't using the expected
namespace if it is used in parallel tests.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-09-23 16:16:00 +01:00
Sebastiaan van Stijn
b2320da428 Merge pull request #51019 from thaJeztah/client_commit_no_pause
client: ContainerCommitOptions: change "Pause" to "NoPause"
2025-09-23 12:50:50 +02:00
Sebastiaan van Stijn
5a6f13824a Merge pull request #51025 from thaJeztah/backend_push_pull_options
daemon/server/imagebackend: add PullOptions, PushOptions structs
2025-09-23 12:10:16 +02:00
Sebastiaan van Stijn
a32a53ae01 daemon/containerd: pass custom metaHeaders to resolver
Similar to how [distribution.newRepository] in the legacy distribution code
passes the (custom) http-headers. User-Agent is always set, and can't be
overridden, so we apply it after setting the custom headers.

[distribution.newRepository]: 9ce272f804/daemon/internal/distribution/registry.go (L74-L97)

Before this patch:

    docker run --rm -d --name debugger -p 127.0.0.1:5001:8080 mendhak/http-https-echo
    DOCKER_CUSTOM_HEADERS=X-Meta-Hello=thaJeztah docker pull localhost:5001/myimage:latest
    docker logs debugger
    ...
    "headers": {
        "host": "localhost:5001",
        "user-agent": "docker/dev go/go1.24.7 git-commit/8e89fe7e8cbb3048f640846590175cbae4719b25 kernel/6.10.14-linuxkit os/linux arch/arm64 containerd-client/2.1.4+unknown storage-driver/overlayfs UpstreamClient(Docker-Client/28.3.2 \\(linux\\))",
        "accept": "application/json, */*",
        "accept-encoding": "zstd;q=1.0, gzip;q=0.8, deflate;q=0.5",
        "baggage": "trigger=api"
    },

With this patch:

    docker run --rm -d --name debugger -p 127.0.0.1:5001:8080 mendhak/http-https-echo
    DOCKER_CUSTOM_HEADERS=X-Meta-Hello=thaJeztah docker pull localhost:5001/myimage:latest
    docker logs debugger
    ...
    "headers": {
        "host": "localhost:5001",
        "user-agent": "docker/dev go/go1.24.7 git-commit/8e89fe7e8cbb3048f640846590175cbae4719b25 kernel/6.10.14-linuxkit os/linux arch/arm64 containerd-client/2.1.4+unknown storage-driver/overlayfs UpstreamClient(Docker-Client/28.3.2 \\(linux\\))",
        "accept": "application/json, */*",
        "accept-encoding": "zstd;q=1.0, gzip;q=0.8, deflate;q=0.5",
        "baggage": "trigger=api",
        "x-meta-hello": "thaJeztah"
    },

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-23 11:42:10 +02:00
Sebastiaan van Stijn
0498c54577 Merge pull request #51023 from thaJeztah/integration_rename_client
integration/service: rename var to prevent shadowing
2025-09-23 10:50:56 +02:00
Sebastiaan van Stijn
2223b7f582 daemon/server/imagebackend: add PushOptions struct
The PushImage method for the ImageService used positional arguments for its
options, which made it more difficult to introduce new options. This patch
introduces a `PushOptions` struct to specify the options. As part of these
changes, the `platform` option was already adjusted to accept a slice of
platforms, which currently is not supported, but may be in the near future.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-23 09:57:22 +02:00
Sebastiaan van Stijn
9d53093db6 daemon/server/imagebackend: add PullOptions struct
The PullImage method for the ImageService used positional arguments for its
options, which made it more difficult to introduce new options. This patch
introduces a `PullOptions` struct to specify the options. As part of these
changes, the `platform` option was already adjusted to accept a slice of
platforms, which currently is not supported, but may be in the near future.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-23 09:43:03 +02:00
Austin Vazquez
9ce272f804 Merge pull request #51022 from thaJeztah/bump_xx
Dockerfile: update xx to v1.7.0
2025-09-22 12:02:49 -07:00
Sebastiaan van Stijn
69d5112c72 Merge pull request #50529 from mdaffad/50159-migrate-test-api-network-defaults-and-filter
test: migrate test api network get defaults and filter
2025-09-22 18:46:02 +02:00
Sebastiaan van Stijn
3985a66ef9 Merge pull request #51018 from thaJeztah/EOL_23
project: mark 23.0 branch as unmaintained (EOL)
2025-09-22 18:26:11 +02:00
Sebastiaan van Stijn
98a9e85536 Merge pull request #51020 from thaJeztah/clean_ping_version
client: Client.negotiateAPIVersionPing: trim v-prefix before handling
2025-09-22 18:25:38 +02:00
Sebastiaan van Stijn
cbafff64e4 project: mark 23.0 branch as unmaintained (EOL)
Mirantis Container Runtime 23.0 reached EOL on May 19, and the 23.0
branch is no longer maintained.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-22 15:36:42 +02:00
Sebastiaan van Stijn
5d22d9bec9 integration/service: rename var to prevent shadowing
Use "apiClient" for the client (most places use either `apiClient`
or `c`) to prevent shadowing the `client` import.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-22 14:34:39 +02:00
Sebastiaan van Stijn
471f24bafc daemon/server/backend: CreateImageConfig: change "Pause" to "NoPause"
Commit [moby@17d870b] (API v1.13, docker v1.1.0) changed the default to pause
containers during commit, keeping the behavior opt-in for older API versions.
This version-gate was removed in [moby@1b1147e] because API versions lower
than v1.23 were no longer supported.

However, the `CreateImageConfig` struct still used `Pause`, and required opting-
in to enable pausing. This patch changes the struct to reflect the default.
after this change, we should also consider changing the API make disabling
pause a more explicit option, and to change the "pause" argument to a
"no-pause".

[moby@17d870b]: 17d870bed5
[moby@1b1147e]: 1b1147e46b

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-22 13:59:56 +02:00
Sebastiaan van Stijn
bad3dfe9cb client: ContainerCommitOptions: change "Pause" to "NoPause"
Commit [moby@17d870b] (API v1.13, docker v1.1.0) changed the default to pause
containers during commit, keeping the behavior opt-in for older API versions.
This version-gate was removed in [moby@1b1147e] because API versions lower
than v1.23 were no longer supported.

However, the client still required opting-in to pausing containers, which
is handled by setting the `Pause` field to true by default. This patch changes
the client option to reflect the default; after this change, we should also
consider changing the API make disabling pause a more explicit option, and
to change the "pause" argument to a "no-pause".

[moby@17d870b]: 17d870bed5
[moby@1b1147e]: 1b1147e46b

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-22 13:59:02 +02:00
Sebastiaan van Stijn
19ee177635 Merge pull request #50530 from thaJeztah/explicit_state
explicitly access Container.State instead of through embedded struct
2025-09-22 13:58:09 +02:00
Sebastiaan van Stijn
1135ab0283 Dockerfile: update xx to v1.7.0
full diff: https://github.com/tonistiigi/xx/compare/v1.6.1...v1.7.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-22 13:06:51 +02:00
Sebastiaan van Stijn
f5847040cc client: Client.negotiateAPIVersionPing: trim v-prefix before handling
Trim any v-prefix passed to this function to make sure we detect empty
API versions.

In most cases, the ping-response will originate from the API server, but
the exported `Client.NegotiateAPIVersionPing` allows a ping-response to
be passed manually.

While updating, also update the signature to only accept the version, as
only the `PingResponse.APIVersion` is used by this function.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-22 11:31:16 +02:00
Sebastiaan van Stijn
af3f971431 client: TestNegotiateAPIVersionAutomatic: gofumpt
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-22 11:30:52 +02:00
Sebastiaan van Stijn
a8cb35f01a client: TestPingHeadFallback: check method, path, and fix example response
Validate that the client is connecting with the expected endpoint path and
method(s). Also fix the Api-Version response to align with the actual format
returned, which doesn't include a "v" prefix;

    curl -sI --unix-socket /var/run/docker.sock 'http://localhost/_ping' | grep 'Api-Version'
    Api-Version: 1.51

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-22 11:30:52 +02:00
Sebastiaan van Stijn
2613bb0c25 Merge pull request #51011 from thaJeztah/client_rm_httpclient
client: remove unused Client.HTTPClient() method
2025-09-22 11:28:48 +02:00
Muhammad Daffa Dinaya
87d1da50f0 test: migrate test api network get defaults and filter
Signed-off-by: Muhammad Daffa Dinaya <muhammaddaffadinaya@gmail.com>
2025-09-20 05:58:35 +00:00
Sebastiaan van Stijn
d9cdfd2887 client: remove unused Client.HTTPClient() method
This method was introduced in [moby@5a84124] related to the (now removed)
support for "compose on kubernetes" in the CLI. This functionality extended
the CLI with endpoints that are not part of the engine API, but re-using
the HTTP-client with the same (TLS) config as the CLI itself.

While such scenarios may be something to consider in future (i.e. more easily
extend the API with custom endpoints), this method is not currently used,
but defined as part of the CLI's interface. This patch removes the method
for now, so that we can design from a clean slate in case we need this
extensibility, instead of keeping methods that were added ad-hoc around.

[moby@5a84124]: 5a84124739

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-19 17:07:39 +02:00
Sebastiaan van Stijn
d4d93bf558 daemon/container: remove State.ExitCode() method
This method did not provide any special handling for accessing the
field, and did not handle locking. Let's remove it for now to
not pretend we're doing anything more safe than directly accessing
the field.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-19 15:33:36 +01:00
Sebastiaan van Stijn
ee4b7a8374 daemon/container: remove NewState() constructor
This constructor did not do anything other than creating an empty struct
for an exported type. While we should look at initializing with a proper
state, we currently do not, so let's not pretend we do some magic here,
and leave it for a future exercise to create a proper constructor if we
need one.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-19 15:33:36 +01:00
Sebastiaan van Stijn
d06f0d008d explicitly access Container.State.Health.Health
The State.Health struct has a mutex, but in various places
we access the embedded Health struct directly.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-19 15:33:36 +01:00
Rob Murray
2f87bb4410 Merge pull request #51009 from olljanat/legacy-remote-ipam-support
ipams: Re-enable legacy remote plugins support
2025-09-19 15:26:05 +01:00
Sebastiaan van Stijn
0df791cb72 explicitly access Container.State instead of through embedded struct
The Container.State struct holds the container's state, and most of
its fields are expected to change dynamically. Some o these state-changes
are explicit, for example, setting the container to be "stopped". Other
state changes can be more explicit, for example due to the containers'
process exiting or being "OOM" killed by the kernel.

The distinction between explicit ("desired") state changes and "state"
("actual state") is sometimes vague; for some properties, we clearly
separated them, for example if a user requested the container to be
stopped or restarted, we store state in the Container object itself;

    HasBeenManuallyStopped   bool // used for unless-stopped restart policy
    HasBeenManuallyRestarted bool `json:"-"` // used to distinguish restart caused by restart policy from the manual one

Other properties are more ambiguous. such as "HasBeenStartedBefore" and
"RestartCount", which are stored on the Container (and persisted to
disk), but may be more related to "actual" state, and likely should
not be persisted;

    RestartCount             int
    HasBeenStartedBefore     bool

Given that (per the above) concurrency must be taken into account, most
changes to the `container.State` struct should be protected; here's where
things get blurry. While the `State` type provides various accessor methods,
only some of them take concurrency into account; for example, [State.IsRunning]
and [State.GetPID] acquire a lock, whereas [State.ExitCodeValue] does not.
Even the (commonly used) [State.StateString] has no locking at all.

The way to handle this is error-prone; [container.State] contains a mutex,
and it's exported. Given that its embedded in the [container.Container]
struct, it's also exposed as an exported mutex for the container. The
assumption here is that by "merging" the two, the caller to acquire a lock
when either the container _or_ its state must be mutated. However, because
some methods on `container.State` handle their own locking, consumers must
be deeply familiar with the internals; if both changes to the `Container`
AND `Container.State` must be made. This gets amplified more as some
(exported!) methods, such as [container.SetRunning] mutate multiple fields,
but don't acquire a lock (so expect the caller to hold one), but their
(also exported) counterpart (e.g. [State.IsRunning]) do.

It should be clear from the above, that this needs some architectural
changes; a clearer separation between "desired" and "actual" state (opening
the potential to update the container's config without manually touching
its `State`), possibly a method to obtain a read-only copy of the current
state (for those querying state), and reviewing which fields belong where
(and should be persisted to disk, or only remain in memory).

This PR preserves the status quo; it makes no structural changes, other
than exposing where we access the container's state. Where previously the
State fields and methods were referred to as "part of the container"
(e.g. `ctr.IsRunning()` or `ctr.Running`), we now explicitly reference
the embedded `State` (`ctr.State.IsRunning`, `ctr.State.Running`).

The exception (for now) is the mutex, which is still referenced through
the embedded struct (`ctr.Lock()` instead of `ctr.State.Lock()`), as this
is (mostly) by design to protect the container, and what's in it (including
its `State`).

[State.IsRunning]: c4afa77157/daemon/container/state.go (L205-L209)
[State.GetPID]: c4afa77157/daemon/container/state.go (L211-L216)
[State.ExitCodeValue]: c4afa77157/daemon/container/state.go (L218-L228)
[State.StateString]: c4afa77157/daemon/container/state.go (L102-L131)
[container.State]: c4afa77157/daemon/container/state.go (L15-L23)
[container.Container]: c4afa77157/daemon/container/container.go (L67-L75)
[container.SetRunning]: c4afa77157/daemon/container/state.go (L230-L277)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-19 16:02:14 +02:00
Olli Janatuinen
aa492314a1 ipams: Re-enable legacy remote plugins support
Signed-off-by: Olli Janatuinen <olli.janatuinen@gmail.com>
2025-09-19 03:01:25 -07:00
Sebastiaan van Stijn
0967d6ea6b Merge pull request #51005 from thaJeztah/cleanup_version_gates
client: fix some version-related handling
2025-09-19 11:57:48 +02:00
Rob Murray
7783e6c6bb Merge pull request #51000 from postmasters/master
daemon/config: More tests for DNS addresses
2025-09-19 10:49:21 +01:00
Sebastiaan van Stijn
5ffc98fae1 Merge pull request #50996 from thaJeztah/server_cleanups
daemon/server: minor refactor and cleanup
2025-09-19 10:18:09 +02:00
Sebastiaan van Stijn
9f71143e55 Merge pull request #51006 from thaJeztah/client_remove_ContainerCount
client: remove deprecated ImageListOptions.ContainerCount
2025-09-19 10:17:25 +02:00
Sebastiaan van Stijn
41a6ad5def client: remove deprecated ImageListOptions.ContainerCount
This field was deprecated in [moby@cfcbfab] when this struct still lived
in the API. The field is no longer used, and we don't have to carry it
forward as part of the new client module.

[moby@cfcbfab]: cfcbfabb0f

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-18 22:56:24 +02:00
Nam Nguyen
02c4bb6a0c daemon/config: More tests for DNS addresses
Since moving from `net.IP` to `netip.Addr`, we can support more proper
nameserver values. This commit adds some tests related to IPv6 scoping.

Signed-off-by: Nam Nguyen <namnguyen@google.com>
2025-09-18 13:06:41 -07:00
Sebastiaan van Stijn
f7ed1b84d2 client: ImageList: don't discard reference filter on API < 1.25
the "reference" filter was introduced in [moby@820b809] (docker 1.13.0-rc1)
to replace the "filter" query argument. That commit initially included a
version-gate anticipating the API version to be used for v17.12, but as
this was yet unknown, the version-gate was removed in [moby@0f9d22c].
A later PR re-introduced a version-gate in [moby@4a19009], reflecting the
API version in which the deprecation was (finally) completed.

For the client, [moby@c6e3145] added a fallback was added for older daemons
(docker 1.12.0 and older, using API < v1.25) that did not support the new
filter.

Looking at the above, any version of docker 1.13.0 or above handles the
"reference" filter, but (depending on the docker version) may also handle
the old filter on API < 1.28 or API < 1.41. Removing this option will only
impact daemon versions older than 1.13.0, which are long obsolete.

Given that current clients forcibly remove the "reference" filter and replace
it with the old "filter" when using API v1.24, we keep support on the daemon
side, but update the version to v1.24, and only if no reference filter is
set.

[moby@820b809]: 820b809e70
[moby@c6e3145]: c6e31454ba
[moby@0f9d22c]: 0f9d22cd66
[moby@4a19009]: 4a1900915a

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-18 18:15:42 +02:00
Sebastiaan van Stijn
d60b4ea278 client: fix version-gate for readonly-recursive mounts validation on service
commit [moby@5d6b566] migrated this validation from the CLI to the client,
but for some reason picked the wrong API version inside ServiceCreate.

The CLI code was added to an existing validation, which only handled
validation when creating a service, but not when updating, which meant
that adding this option to an existing service would not invalidate it.

This patch:

- moves the version-gate to the validation code
- merges validateServiceSpecForAPIVersion into validateServiceSpec, to
  keep the validation combined, and to make sure validation happens both
  on create and update.

[moby@5d6b566]: 5d6b56699d

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-18 18:02:34 +02:00
Sebastiaan van Stijn
0673d43663 client: remove "version" header for service create, update
The version header is no longer used since [moby@a9d2091] (v20.10.0-beta1)
which was not gated by API version, as handling of the header was broken
(using the client version, instead of the API version used for the request).

Given that any current version of the daemon, regardless of API version will
ignore the header, this code was only in place to allow connecting to a
daemon older than (v20.10.0-beta1), which would be long EOL now.

[moby@a9d2091]: a9d20916c3

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-18 18:02:12 +02:00
Sebastiaan van Stijn
9fc12daf80 client: remove version-gate for "--force" on "volume remove"
The `force` option on volume remove was added in [moby@6c5c34d] (docker
1.13.0-rc1, API v1.25), but did not gate the feature to API version, so
effectively introduced it to all existing API versions. After this,
[moby@e98e4a7] enabled experimental features by default, and added API
version gates, but only did so on the client side, so the daemon / API
server would continue to accept the `force` option on any API version.

Let's remove this code, given that:

- API v1.24 is the oldest API version we still handle, and only as fallback.
- This code silently discards the user's option (no warning / error)
- Every current version of the daemon handles the option, regardless
  of API version (only a 9+ year old daemon wouldn't handle it).

[moby@6c5c34d]: 6c5c34d50d
[moby@e98e4a7]: e98e4a7111

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-18 18:01:49 +02:00
Sebastiaan van Stijn
5a69e91639 Merge pull request #51002 from thaJeztah/client_better_mock
client: WithMockClient: match version behavior of actual client
2025-09-18 14:50:54 +02:00
Sebastiaan van Stijn
c2d4723eb9 Merge pull request #50998 from thaJeztah/rm_network_CheckDuplicate
api/types/network: CreateRequest: remove deprecated CheckDuplicate field
2025-09-18 14:50:10 +02:00
Sebastiaan van Stijn
839c2709af client: WithMockClient: match version behavior of actual client
The WithMockClient option was explicitly resetting the client's API
version (see [1]), which differs from the regular client, which is
initialized with the current API version used by the client (see [2]).

This patch:

- reduces the `WithMockClient` to only set the custom HTTP client, leaving
  other fields un-touched.
- adds a test utility and updates tests to handle the API-version prefix
- removes redundant uses of `WithVersion()` in tests; for most test-cases
  it was used to make sure a current API version is used that supports the
  feature being tested, but there was no test to verify the behavior for
  lower API versions, so we may as well test against "latest".

[1]: 5a582729d8/client/client_mock_test.go (L22-L36)
[2]: 5a582729d8/client/client.go (L167-L190)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-18 11:37:56 +02:00
Sebastiaan van Stijn
64419958cc Merge pull request #50997 from thaJeztah/split_exec_interface
client: separate exec methods to ExecAPIClient interface
2025-09-18 11:36:48 +02:00
Sebastiaan van Stijn
ee7538ca09 Merge pull request #51001 from thaJeztah/fix_create_panic
client: Client.ContainerCreate: fix panic when passing a nil config
2025-09-18 11:34:57 +02:00
Sebastiaan van Stijn
c4b01a5859 Merge pull request #51003 from thaJeztah/client_rename_utility
client: rename validateAPIVersion to validateServiceSpecForAPIVersion
2025-09-18 11:34:28 +02:00
Sebastiaan van Stijn
8f8a2db52c client: rename validateAPIVersion to validateServiceSpecForAPIVersion
This function is used to validate a service-spec for a specific API
version; renaming it to be less ambiguous.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-18 01:07:38 +02:00
Sebastiaan van Stijn
0468dac252 client: Client.ContainerCreate: fix panic when passing a nil config
The config is a required argument (to create a container, at least
an image is needed), but the function was missing a check for this,
which would result in a panic if the client was using API v1.44 or
up due to the changes from ee9f0ed895
attempting to [reset the deprecated `MacAddress` field][1].

In practice, this would unlikely be hit, and we didn't hit this in
unit-tests, due to a bug in `WithMockClient`, which initializes the
client with an [empty API version][2], which is different from the
actual client, which [initializes the client with the MaxAPIVersion][3]

This patch updates the function to return an error if a nil config is
passed.

[1]: 5a582729d8/client/container_create.go (L72-L75)
[2]: 5a582729d8/client/client_mock_test.go (L22-L36)
[3]: 5a582729d8/client/client.go (L167-L190)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-17 22:51:24 +02:00
Sebastiaan van Stijn
5a582729d8 Merge pull request #50995 from thaJeztah/rm_build_ostype
client: ImageBuildResponse: remove OSType field
2025-09-17 15:15:14 +02:00
Sebastiaan van Stijn
6d0551e13a api/types/network: CreateRequest: remove deprecated CheckDuplicate field
CheckDuplicate is removed in API v1.44, and no longer used by
daemons supporting that API version (v25.0.0-beta.1 and up)
regardless of the API version used, but it must be set to true
when sent to older daemons (see [moby@78479b1]).

This patch moves adding the field to the client through an ad-hoc struct
so that we don't have to carry the field in the API module.

We can remove this once daemon versions v24.0 and lower are no longer
expected to be used (when Mirantis Container Runtime v23 is EOL).
https://github.com/moby/moby/blob/v2.0.0-beta.0/project/BRANCHES-AND-TAGS.md.

This field was removed from API v1.44 and no longer used by daemons supporting
that API version (v25.0.0-beta.1 and up) regardless of the API version used,
but for older version of the daemon required this option to be set.

[moby@78479b1]: 78479b1915

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-17 14:53:07 +02:00
Sebastiaan van Stijn
d0ac3c4eeb Merge pull request #50994 from thaJeztah/rm_test_utils
integration-cli: remove startContainerGetOutput, runCommandWithOutput
2025-09-17 13:35:09 +02:00
Sebastiaan van Stijn
033a52fbd5 Merge pull request #50931 from vvoland/gha-label-modules
gha: Add automatic PR labeling for modules
2025-09-17 13:26:57 +02:00
Sebastiaan van Stijn
50ea842e17 client: separate exec methods to ExecAPIClient interface
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-17 12:53:45 +02:00
Sebastiaan van Stijn
94309db0aa daemon/server: Server.makeHTTPHandler: pass Route as argument
Pass the Route as a whole, instead of some of its properties; this
allows the method to act on additional information provided by the
route.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-17 12:44:30 +02:00
Sebastiaan van Stijn
81506ad8b1 daemon/server/router: NewRoute: don't use un-keyed struct literal
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-17 12:44:30 +02:00
Sebastiaan van Stijn
82e5d3064a client: ImageBuildResponse: remove OSType field
This field was used in the CLI to produce a warning added in [moby@4a8b3ca]
to print a warning when building Linux images from a Windows client.
Window's filesystem does not have an "executable" bit, which mean that,
for example, copying a shell script to an image during build would lose
the executable bit. So for Windows clients, the executable bit would be
set on all files, unconditionally.

Originally this was detected in the client, which had direct access to
the API response headers, but when refactoring the client to use a common
library in [moby@535c4c9], this was refactored into a `ImageBuildResponse`
wrapper, deconstructing the API response into an `io.Reader` and a string
field containing only the `OSType` header.

The warning was removed in [cli@af65ee4], so we don't have to carry this
field in the new client module going forward.

With the field removed, we can consider the client to return the full
HTTP response again, but leaving that for a follow-up, as we may want
to rewrite these streaming functions altogether.

[moby@4a8b3ca]: 4a8b3cad60
[moby@535c4c9]: 535c4c9a59
[cli@af65ee4]: af65ee4584

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-17 12:41:17 +02:00
Sebastiaan van Stijn
4df03a25e7 Merge pull request #50991 from thaJeztah/move_exec_inspect
api/types/container: move ExecInspect type to client
2025-09-17 12:39:48 +02:00
Sebastiaan van Stijn
962857d3d2 Merge pull request #50992 from thaJeztah/remove_backend_execinspect
daemon/server/backend: remove ExecInspect, ExecProcessConfig alias
2025-09-17 12:38:50 +02:00
Sebastiaan van Stijn
5028ff1f40 integration-cli: remove startContainerGetOutput, runCommandWithOutput
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-17 12:06:35 +02:00
Sebastiaan van Stijn
2b4f5592d2 Merge pull request #50989 from thaJeztah/remove_KernelMemory
remove support for deprecated kernel memory limit
2025-09-17 12:06:18 +02:00
Rob Murray
07453abab3 Merge pull request #50929 from robmry/mac_ip_vlan_gateway_config
macvlan, ipvlan-l2: only configure a default route when a gateway address is supplied
2025-09-16 18:09:30 +01:00
Sebastiaan van Stijn
44357bb101 Merge pull request #50987 from thaJeztah/version_constraints
move endpoint API version constraints to API server
2025-09-16 18:59:18 +02:00
Rob Murray
b0226d5074 Merge pull request #48971 from robmry/ipv6_disabled_on_interface
Release IPv6 address if IPv6 is disabled on an interface
2025-09-16 17:53:06 +01:00
Sebastiaan van Stijn
2a867f0c4d daemon/server/backend: remove ExecInspect, ExecProcessConfig alias
Type type was defined before the API had a definition fro the exec-inspect
response. When a type definition was added in [moby@2a34207], the definition
was moved from the backend to the API, and the backend type implemented as
an alias.

Technically, we could keep a _concrete_ type for the backend, and handle
conversion to the corresponding API type in the router, but currently,
this would likely only add extra complexity.

We could still opt for doing so when the backend requires additional fields
or changes that should not be reflected in the API response.

[moby@2a34207]: 2a342079c6

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-16 18:00:24 +02:00
Sebastiaan van Stijn
ff21989215 api/types/container: move ExecInspect type to client
This type was introduced in [moby@3f9f231], at which type no API response
types were defined, and the [`containerRouter.getExecByID`] would return
the daemon's internal [`exec.Config`] type from [`backend.ContainerExecInspect`].

Tracing back history about the discrepancy between the type used by the client
and the actual response type; commit [moby@2a34207] added the missing type in
the API, which was documented as part of the API swagger definition since the
start ([moby@0243936]), and updated in [moby@74cb739], so we can't use the
reduced struct as response type.

[moby@3f9f231]: 3f9f23114f
[moby@2a34207]: 2a342079c6
[`containerRouter.getExecByID`]: 3f9f23114f/api/server/router/container/exec.go (L18-L25)
[`backend.ContainerExecInspect`]: 3f9f23114f/api/server/router/container/backend.go (L18)
[`exec.Config`]: 3f9f23114f/daemon/exec/exec.go (L13-L31)
[moby@0243936]: 0243936d92
[moby@74cb739]: 74cb739766

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-16 16:46:12 +02:00
Sebastiaan van Stijn
da5ca1b746 Merge pull request #50978 from thaJeztah/mv_exec_options
client: move ExecStartOptions, ExecAttachOptions, ExecOptions to client
2025-09-16 15:58:30 +02:00
Sebastiaan van Stijn
f2309885ff Merge pull request #50961 from robmry/windows_hns_network_name
Windows containers: report HNS network name in inspect
2025-09-16 14:39:37 +02:00
Sebastiaan van Stijn
b79b35edfc Merge pull request #50982 from thaJeztah/info_backcompat
API: /info: remove `SecurityOptions` re-formatting for API < 1.25
2025-09-16 13:28:26 +02:00
Sebastiaan van Stijn
c1be6ef5de api/docs: remove KernelMemory option from old API versions
This option is no longer supported by runc, and is deprecated in the kernel.
We removed support for this feature from all API versions, so it's better
to also amend the docs for older API versions.

[kernel v5.4]: https://github.com/torvalds/linux/commit/0158115f702b0ba208ab0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-16 13:26:13 +02:00
Paweł Gronowski
db859edf26 Merge pull request #50988 from vvoland/gha-missing-needs
gha: add missing dependency to Windows workflows
2025-09-16 13:18:03 +02:00
Sebastiaan van Stijn
c5991341eb remove support for deprecated kernel memory limit
kernel-memory limits are not supported in cgroups v2, and were obsoleted in
[kernel v5.4], producing a `ENOTSUP` in kernel v5.16. Support for this option
was removed in runc and other runtimes, as various LTS kernels contained a
broken implementation, resulting in unpredictable behavior.

We deprecated this option in [moby@b8ca7de], producing a warning when used,
and actively ignore the option since [moby@0798f5f].

Given that setting this option had no effect in most situations, we should
just remove this option instead of continuing to handle it with the expectation
that a runtime may still support it.

Note that we still support RHEL 8 (kernel 4.18) and RHEL 9 (kernel 5.14). We
no longer build packages for Ubuntu 20.04 (kernel 5.4) and Debian Bullseye 11
(kernel 5.10), which still have an LTS / ESM programme, but for those it would
only impact situations where a runtime is used that still supports it, and
an old API version was used.

[kernel v5.4]: https://github.com/torvalds/linux/commit/0158115f702b0ba208ab0
[moby@b8ca7de]: b8ca7de823
[moby@0798f5f]: 0798f5f5cf

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-16 13:08:36 +02:00
Sebastiaan van Stijn
5028544788 Merge pull request #50986 from thaJeztah/trace_logging
daemon/server: fix requests not logged with --log-level=trace
2025-09-16 12:47:11 +02:00
Sebastiaan van Stijn
20d8342a4b move endpoint API version constraints to API server
This introduces a `WithMinimumAPIVersion` RouteWrapper to configure the
minimum API version  required for a route. It produces a 400 (Invalid Request)
error when accessing the endpoint on API versions lower than the given version.

Note that technically, it should produce a 404 ("not found") error,
as the endpoint should be considered "non-existing" on such API versions,
but 404 status-codes are used in business logic for various endpoints.

This patch allows removal of corresponding API-version checks from the client,
and other implementation of clients for the API. While the produced error message
is slightly more "technical", these situations should be rare and only happen
when the API version of the client is explicitly overridden, or a client was
implemented with a fixed API version (potentially missing version checks).

Before this patch, these errors were produced by the client:

    DOCKER_API_VERSION=v1.24 docker container prune -f
    docker container prune requires API version 1.25, but the Docker daemon API version is 1.24

With this patch applied, the error is returned by the daemon:

    DOCKER_API_VERSION=v1.24 docker container prune -f
    Error response from daemon: POST /containers/prune requires minimum API version 1.25

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-16 12:20:44 +02:00
Paweł Gronowski
766c8313cb Merge pull request #50984 from thaJeztah/rm_docker_1.9_compat
client: remove support for API < v1.22 (docker < 1.10)  filter format
2025-09-16 12:17:05 +02:00
Paweł Gronowski
b70c1a439d gha: add missing dependency to Windows workflows
The Windows test workflow jobs were missing the dependency on the
`validate-dco` job so they ran regardless whether the DCO check passed
or not.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-09-16 11:50:09 +02:00
Sebastiaan van Stijn
18b289f9df daemon/server: fix requests not logged with --log-level=trace
Before this patch, debug and trace-level logs were enabled, but the debugging
middleware was not, the request-body was not logged when enabling trace-level
logs:

    INFO[2025-09-16T07:55:07.500241927Z] Daemon has completed initialization
    INFO[2025-09-16T07:55:07.500267802Z] API listen on /var/run/docker.sock
    TRAC[2025-09-16T07:55:08.502387094Z] garbage collected                             d="437.583µs"
    DEBU[2025-09-16T07:55:13.215510096Z] stat snapshot                                 key="sha256:6aba5e0d32d91e3e923854dcb30588dc4112bfa1dae82b89535ad31d322a7b19" snapshotter=overlayfs
    DEBU[2025-09-16T07:55:13.216532430Z] prepare snapshot                              key=80813e376c0610bcd3fc1cbe7b6b1f3427a22eca06e4d34f6d5fb9c4d4589485-init-key parent="sha256:6aba5e0d32d91e3e923854dcb30588dc4112bfa1dae82b89535ad31d322a7b19" snapshotter=overlayfs
    TRAC[2025-09-16T07:55:13.219691055Z] event published                               ns=moby topic=/snapshot/prepare type=containerd.events.SnapshotPrepare
    DEBU[2025-09-16T07:55:13.226507180Z] commit snapshot                               key=80813e376c0610bcd3fc1cbe7b6b1f3427a22eca06e4d34f6d5fb9c4d4589485-init-key name=80813e376c0610bcd3fc1cbe7b6b1f3427a22eca06e4d34f6d5fb9c4d4589485-init snapshotter=overlayfs
    TRAC[2025-09-16T07:55:13.227871055Z] event published                               ns=moby topic=/snapshot/commit type=containerd.events.SnapshotCommit
    DEBU[2025-09-16T07:55:13.228132471Z] prepare snapshot                              key=80813e376c0610bcd3fc1cbe7b6b1f3427a22eca06e4d34f6d5fb9c4d4589485 parent=80813e376c0610bcd3fc1cbe7b6b1f3427a22eca06e4d34f6d5fb9c4d4589485-init snapshotter=overlayfs
    TRAC[2025-09-16T07:55:13.229071055Z] event published                               ns=moby topic=/snapshot/prepare type=containerd.events.SnapshotPrepare
    DEBU[2025-09-16T07:55:13.229489180Z] get snapshot mounts                           key=80813e376c0610bcd3fc1cbe7b6b1f3427a22eca06e4d34f6d5fb9c4d4589485 snapshotter=overlayfs
    DEBU[2025-09-16T07:55:13.229824721Z] container mounted via snapshotter             container=80813e376c0610bcd3fc1cbe7b6b1f3427a22eca06e4d34f6d5fb9c4d4589485 root=/var/lib/docker/rootfs/overlayfs/80813e376c0610bcd3fc1cbe7b6b1f3427a22eca06e4d34f6d5fb9c4d4589485 snapshotter=overlayfs
    DEBU[2025-09-16T07:55:13.229849096Z] container mounted via layerStore              container=80813e376c0610bcd3fc1cbe7b6b1f3427a22eca06e4d34f6d5fb9c4d4589485 root=/var/lib/docker/rootfs/overlayfs/80813e376c0610bcd3fc1cbe7b6b1f3427a22eca06e4d34f6d5fb9c4d4589485 storage-driver=overlayfs

With this patch applied, the debugging middleware is enabled both with
debug- and trace-level logging enabled:

    INFO[2025-09-16T07:56:31.024794341Z] Daemon has completed initialization
    INFO[2025-09-16T07:56:31.024856591Z] API listen on /var/run/docker.sock
    TRAC[2025-09-16T07:56:32.026944049Z] garbage collected                             d="640.167µs"
    DEBU[2025-09-16T07:56:36.729870218Z] handling HEAD request                         method=HEAD module=api request-url=/_ping vars="map[]"
    DEBU[2025-09-16T07:56:36.731114885Z] handling POST request                         form-data="{\"AttachStderr\":true,\"AttachStdin\":false,\"AttachStdout\":true,\"Cmd\":null,\"Domainname\":\"\",\"Entrypoint\":null,\"Env\":null,\"HostConfig\":{\"AutoRemove\":false,\"Binds\":null,\"BlkioDeviceReadBps\":[],\"BlkioDeviceReadIOps\":[],\"BlkioDeviceWriteBps\":[],\"BlkioDeviceWriteIOps\":[],\"BlkioWeight\":0,\"BlkioWeightDevice\":[],\"CapAdd\":null,\"CapDrop\":null,\"Cgroup\":\"\",\"CgroupParent\":\"\",\"CgroupnsMode\":\"\",\"ConsoleSize\":[23,104],\"ContainerIDFile\":\"\",\"CpuCount\":0,\"CpuPercent\":0,\"CpuPeriod\":0,\"CpuQuota\":0,\"CpuRealtimePeriod\":0,\"CpuRealtimeRuntime\":0,\"CpuShares\":0,\"CpusetCpus\":\"\",\"CpusetMems\":\"\",\"DeviceCgroupRules\":null,\"DeviceRequests\":null,\"Devices\":[],\"Dns\":[],\"DnsOptions\":[],\"DnsSearch\":[],\"ExtraHosts\":null,\"GroupAdd\":null,\"IOMaximumBandwidth\":0,\"IOMaximumIOps\":0,\"IpcMode\":\"\",\"Isolation\":\"\",\"Links\":null,\"LogConfig\":{\"Config\":{},\"Type\":\"\"},\"MaskedPaths\":null,\"Memory\":0,\"MemoryReservation\":0,\"MemorySwap\":0,\"MemorySwappiness\":-1,\"NanoCpus\":0,\"NetworkMode\":\"default\",\"OomKillDisable\":false,\"OomScoreAdj\":0,\"PidMode\":\"\",\"PidsLimit\":0,\"PortBindings\":{},\"Privileged\":false,\"PublishAllPorts\":false,\"ReadonlyPaths\":null,\"ReadonlyRootfs\":false,\"RestartPolicy\":{\"MaximumRetryCount\":0,\"Name\":\"no\"},\"SecurityOpt\":null,\"ShmSize\":0,\"UTSMode\":\"\",\"Ulimits\":[],\"UsernsMode\":\"\",\"VolumeDriver\":\"\",\"VolumesFrom\":null},\"Hostname\":\"\",\"Image\":\"busybox\",\"Labels\":{},\"NetworkingConfig\":{\"EndpointsConfig\":{\"default\":{\"Aliases\":null,\"DNSNames\":null,\"DriverOpts\":null,\"EndpointID\":\"\",\"Gateway\":\"\",\"GlobalIPv6Address\":\"\",\"GlobalIPv6PrefixLen\":0,\"GwPriority\":0,\"IPAMConfig\":null,\"IPAddress\":\"\",\"IPPrefixLen\":0,\"IPv6Gateway\":\"\",\"Links\":null,\"MacAddress\":\"\",\"NetworkID\":\"\"}}},\"OnBuild\":null,\"OpenStdin\":false,\"StdinOnce\":false,\"Tty\":false,\"User\":\"\",\"Volumes\":{},\"WorkingDir\":\"\"}" method=POST module=api request-url=/v1.51/containers/create vars="map[version:1.51]"
    DEBU[2025-09-16T07:56:36.751584218Z] stat snapshot                                 key="sha256:6aba5e0d32d91e3e923854dcb30588dc4112bfa1dae82b89535ad31d322a7b19" snapshotter=overlayfs
    DEBU[2025-09-16T07:56:36.752634302Z] prepare snapshot                              key=786e5174c57aa5057b4fd0a3c01013fe98d6fa3e5aaf9f1f89224175be74ba41-init-key parent="sha256:6aba5e0d32d91e3e923854dcb30588dc4112bfa1dae82b89535ad31d322a7b19" snapshotter=overlayfs
    TRAC[2025-09-16T07:56:36.755453593Z] event published                               ns=moby topic=/snapshot/prepare type=containerd.events.SnapshotPrepare
    DEBU[2025-09-16T07:56:36.827076427Z] commit snapshot                               key=786e5174c57aa5057b4fd0a3c01013fe98d6fa3e5aaf9f1f89224175be74ba41-init-key name=786e5174c57aa5057b4fd0a3c01013fe98d6fa3e5aaf9f1f89224175be74ba41-init snapshotter=overlayfs
    TRAC[2025-09-16T07:56:36.828276635Z] event published                               ns=moby topic=/snapshot/commit type=containerd.events.SnapshotCommit
    DEBU[2025-09-16T07:56:36.828467885Z] prepare snapshot                              key=786e5174c57aa5057b4fd0a3c01013fe98d6fa3e5aaf9f1f89224175be74ba41 parent=786e5174c57aa5057b4fd0a3c01013fe98d6fa3e5aaf9f1f89224175be74ba41-init snapshotter=overlayfs
    TRAC[2025-09-16T07:56:36.829163010Z] event published                               ns=moby topic=/snapshot/prepare type=containerd.events.SnapshotPrepare
    DEBU[2025-09-16T07:56:36.829448927Z] get snapshot mounts                           key=786e5174c57aa5057b4fd0a3c01013fe98d6fa3e5aaf9f1f89224175be74ba41 snapshotter=overlayfs
    DEBU[2025-09-16T07:56:36.829850302Z] container mounted via snapshotter             container=786e5174c57aa5057b4fd0a3c01013fe98d6fa3e5aaf9f1f89224175be74ba41 root=/var/lib/docker/rootfs/overlayfs/786e5174c57aa5057b4fd0a3c01013fe98d6fa3e5aaf9f1f89224175be74ba41 snapshotter=overlayfs
    DEBU[2025-09-16T07:56:36.829872593Z] container mounted via layerStore              container=786e5174c57aa5057b4fd0a3c01013fe98d6fa3e5aaf9f1f89224175be74ba41 root=/var/lib/docker/rootfs/overlayfs/786e5174c57aa5057b4fd0a3c01013fe98d6fa3e5aaf9f1f89224175be74ba41 storage-driver=overlayfs

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-16 10:01:10 +02:00
Sebastiaan van Stijn
839e46f97c client: remove support for API < v1.22 filter format
The format for filters changed in 93d1dd8036
(docker v1.10 / API v1.22). As part of that implementation, the daemon
would parse the new format, and fall back to parsing the old format if
this failed. This fallback was not based on API version, so any version
of the API released since would continue to accept both the legacy and
curent format.

For the client, the change in format caused a regression when connecting
to an older daemon; a `ToParamWithVersion` utility was introduced in
[docker/engine-api@81388f0] to produce the old format when the client was
connected to a docker v1.9 or older daemon, using an old API version.

Given that any version of docker 1.10 or above would support both formats,
regardless of the API version used, and API v1.22 is no longer supported,
it should be safe to assume we can drop the version-specific format in the
client. Even if the client would be using API v1.22 (or older), the format
would only be necessary for an actual docker v1.9 daemon, which would be
very unlikely, and a daemon that's 9 Years old.

[docker/engine-api@81388f0]: 81388f00dd

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-15 21:27:58 +02:00
Cory Snider
1b9ef486c7 Merge pull request #50946 from corhere/ipam-allocation-info
daemon: report IPAM status for Swarm networks
2025-09-15 13:00:32 -04:00
Sebastiaan van Stijn
a83d91f427 API: /info: remove SecurityOptions re-formatting for API < 1.25
On docker 1.12 (API v1.24) and older, the `SecurityOptions` field of the
`/info` response would only list names of the security options that are
enabled in the daemon. API v1.25 added additional information to this
information. Initially, this included a change to return the information
in structured format (b237189e6c), which
was a backward-incompatible change, so an alternative format was introduced
in 514ca09426 to used a string-slice, but
prefixing options with `name=`, followed by the name of the security-options
and any config options related to it as `key[=<value>]` pairs.

On current API versions:

    curl -s --unix-socket /var/run/docker.sock 'http://localhost/v1.51/info' | jq .SecurityOptions
    [
      "name=seccomp,profile=builtin",
      "name=cgroupns"
    ]

On API version v1.24:

    curl -s --unix-socket /var/run/docker.sock 'http://localhost/v1.24/info' | jq .SecurityOptions
    [
      "seccomp",
      "cgroupns"
    ]

The Docker CLI unconditionally handles either format when presenting the
information; for backward-compatibility, it contains fallback code to handle
cases where no `name=` prefix is present, but this logic is not based on
API version.

Given that any current version of the CLI is handling either format, and
versions of the CLI that did not have this handling are at least 9 Years
old (and long EOL), removing the old format is unlikely to be causing
issues and we can remove this special handling, and return the information
in the current format.

If we consider this information to be relevant for clients, we should
ultimately consider making it available in a more structured format as
was the original intent of b237189e6c.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-15 17:43:22 +02:00
Paweł Gronowski
689decba9a Merge pull request #50981 from thaJeztah/rm_magic_vals
API: /info: remove magic `<unknown>` values for API < 1.39
2025-09-15 17:42:15 +02:00
Sebastiaan van Stijn
79450fa3ec Merge pull request #50980 from thaJeztah/sync_swagger_docs
api/docs: sync swagger and update changelog
2025-09-15 17:42:07 +02:00
Sebastiaan van Stijn
082b4e8d77 client: move ExecOptions to client
- move api/types/container.ExecOptions to the client
- rename api/types/container.ExecOptions to ExecCreateRequest

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-15 17:37:47 +02:00
Sebastiaan van Stijn
6a642300f0 client: move ExecStartOptions, ExecAttachOptions to client
- move api/types/container.ExecStartOptions to the client
- move api/types/container.ExecAttachOptions to the client
- rename api/types/container.ExecStartOptions to ExecStartRequest

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-15 17:37:43 +02:00
Paweł Gronowski
cb62838fe7 Merge pull request #50979 from thaJeztah/mod_tidy
client: tidy go.mod
2025-09-15 17:36:31 +02:00
Sebastiaan van Stijn
30a43b877c Merge pull request #50977 from thaJeztah/rm_cors_option
daemon/config: remove deprecated CommonConfig.CorsHeaders
2025-09-15 14:58:39 +02:00
Sebastiaan van Stijn
c8c13fe058 API: /info: remove magic <unknown> values for API < 1.39
daemon versions before v18.09 (API v1.39) returned a magic `<unknown>` value
for the `KernelVersion` and `OperatingSystem` if these values were not set.
Commit e6e8ab50fa removed this magic values,
but kept a fallback for old versions of the CLI that expected this value to
be pre-formatted this way. Given that this change was over 7 Years ago, and
never was a strict contract of the API, we can remove this fallback. Current
versions of the CLI properly handle presentation, so this would only impact
EOL versions of the CLI.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-15 14:32:34 +02:00
Sebastiaan van Stijn
c600f62c25 api/docs: sync swagger and update changelog
- Update changelog to include mention of the new fields added
  in 3f86797d3f.
- Update changelog to mention removal of the deprecated fields
  in b092c8ca64
- Sync v1.52 swagger docs with the current version.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-15 13:27:40 +02:00
Sebastiaan van Stijn
6084882b98 client: tidy go.mod
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-15 12:02:21 +02:00
Rob Murray
2bb0443ae9 Release IPv6 address if unused due to sysctl setting
When running:
  docker network create --ipv6 b46
  docker run --rm -ti \
    --network name=b46,driver-opt=com.docker.network.endpoint.sysctls=net.ipv6.conf.IFNAME.disable_ipv6=1 \
     busybox

IPv6 is enabled in the container and the network, so an IPv6 address
will be allocated for the endpoint.

But, when the sysctl is applied, the IPv6 address will be removed
from the interface ... so, no unsolicited neighbour advertisement
should be (or can be) sent and, the endpoint should not be treated
as dual-stack when selecting a gateway endpoint and, if it is
selected as the gateway endpoint, setting up an IPv6 route via the
network will fail.

So, if the IPv6 address disappears after sysctls have been applied,
release the address and remove it from the endpoint's config.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-09-15 10:39:08 +01:00
Rob Murray
252659278e Configure addresses before adding them to DNS or /etc/hosts
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-09-15 10:39:08 +01:00
Rob Murray
18b8e369ae Split OS-specific code out of Sandbox.populateNetworkResources
And move the Endpoint.populateNetworkResources code into the
all-platforms part of the Sandbox method.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-09-15 10:39:08 +01:00
Rob Murray
a8b9eff902 Don't set up DNS in Network.createEndpoint
DNS is set up when the endpoint is joined to a network.

It was added in commit 4850c5f (Avoid duplicate entries in
/etc/hosts) then simplified in bcca214 (libnetwork: open-code
updating svc records) and seems to be related to setting up a
name on a swarm node that isn't running the container with the
endpoint.

But, all callers of Network.createEndpoint follow up with an
Endpoint.Join, which also sets up the DNS entry. Those callers are:
  Network.createLoadBalancerSandbox
  Network.CreateEndpoint
    - called by Daemon.connectToNetwork
    - called by Sandbox.setupDefaultGateway
    - called by builder-net/executor.go: iface.init

None of them bail out before the Join for a Swarm case.

So, it looks like enough has changed that the createEndpoint code is
no longer needed (it predates the internal DNS server) ... remove it.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-09-15 10:39:08 +01:00
Rob Murray
ddf10ee1cd Delay Endpoint config until the osSbox exists
When the SetKey hook is used (by a build container) it's called after
Endpoint.sbJoin, which will have called Sandbox.populateNetworkResources
to set up address, routes, sysctls and so on - but it's not able to do
any config until the osSbox exists. So, Sandbox.populateNetworkResources
is called again by SetKey to finish that config.

But, that means the rest of Endpoint.sbJoin has already happened before
the osSbox existed - it will have configured DNS, /etc/hosts, gateways
and so on before anything was set up for the OS.

So, if the osSbox configuration isn't applied as expected (for example,
a sysctl disables IPv6 on the endpoint), that sbJoin configuration is
incorrect.

To avoid unnecessary config+cleanup in thoses cases - delay the config
currently done by sbJoin until the osSbox exists.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-09-15 10:39:08 +01:00
Sebastiaan van Stijn
b043980e6f daemon/config: remove deprecated CommonConfig.CorsHeaders
This option was deprecated in Docker 27.0 through 7ea9acc97f,
and removed in 28.0 through ae96ce866f.
The field was kept to provide a user-friendly error when used; this
patch removes the field altogether.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-15 11:11:20 +02:00
Sebastiaan van Stijn
9c14afd97c Merge pull request #50959 from thaJeztah/rm_execoptions_detach
api/types/container: remove deprecated ExecOptions.Detach
2025-09-15 09:50:27 +02:00
Sebastiaan van Stijn
84ddfa140c Merge pull request #50958 from thaJeztah/cleanup_deprecated
daemon: remove some deprecated functions
2025-09-15 09:49:43 +02:00
Rob Murray
4c7deaf832 Windows containers: restore network name after reboot
When Windows reboots, it removes HNS networks. They're restored
from Docker's store (unlike after a daemon restart, where Docker
networks are restored from HNS networks).

When that happens, preserve the driver-opt that reports the HNS
network name when that happens.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-09-12 21:05:16 +01:00
Rob Murray
9129094b98 Windows containers: report HNS network name in inspect
After creating a new network, inspect shows that there's no value
for option "com.docker.network.windowsshim.networkname". After
restarting the daemon, it shows up with the docker network name
(not the HNS network name, which defaults to the docker network's
id).

Creating the network with "-o com.docker.network.windowsshim.networkname"
sets the HNS network name, and it shows up in inspect. Until the
daemon is restarted, then it shows the docker network name.

So - set the option value to the HNS network name on creation (the id
if no name is given), and on restore after restart use the name
reported by HNS.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-09-12 16:03:36 +01:00
Rob Murray
aa78f19066 ipvlan-l2: do not allocate a gateway address from IPAM
When ipvlan in "l2" mode is given no '--gateway' option, an
address is allocated from IPAM and a default route is set up
via that gateway. But, the gateway address is not assigned to
anything in the Docker ipvlan network - it must be external,
and IPAM shouldn't try to guess it.

So ...

- always disable IPAM gateway address allocation for ipvlan-l2
  - tell libnet to assume the endpoint has a gateway instead
- update the Join code to allow for no configured gateway
- always disable 'docker_gwbridge' connection for ipvlan
  networks, so it's not hooked up when there is no gateway
  address.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-09-12 14:29:15 +01:00
Rob Murray
468e3521b0 macvlan: do not allocate a gateway address from IPAM
When macvlan is given no '--gateway' option, an address is
allocated from IPAM and a default route is set up via that
gateway. But, the gateway address is not assigned to anything
in the Docker macvlan network - it must be external, and
IPAM shouldn't try to guess it.

When IPv6 auto-configuration is enabled in the network the
macvlan is connected to, the macvlan driver races against it
to set up the gateway. When autoconfig wins, container creation
fails because the default route already exists.

So ...

- disable IPAM gateway address allocation for macvlan
- update the Join code to allow for no configured gateway
- always disable 'docker_gwbridge' connection for macvlan
  networks, so it's not hooked up when there is no gateway
  address.

Libnet assumes an endpoint with no statically configured default
gateway or route does not provide external connectivity. So, it
disables external DNS access, and will not select the endpoint
as gateway for containers. So, where an IPAM allocated gateway
address would have been assigned before, tell libnet to assume
there will be an auto-configured gateway.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-09-12 14:29:15 +01:00
Rob Murray
af6d59ea48 Merge pull request #50945 from robmry/cleanup_network_settings_on_join_err
Tidy up when endpoint join fails
2025-09-12 13:05:10 +01:00
Sebastiaan van Stijn
caae209d25 api/types/container: remove deprecated ExecOptions.Detach
This field was deprecated in 0c182d4d57,
which should be included in a 28.x release, but we don't need to carry
it in the new module.

We should also considering duplicating the `ExecOptions` type as a client
option, and renaming it to `ExecCreateRequest`, so that we can decouple
client options from the shape of the request.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-12 10:18:24 +02:00
Sebastiaan van Stijn
19edf44896 daemon/config: remove deprecated Config.
This function was deprecated in 83f8f4efd7,
and the package is internal to the daemon, so we can remove it.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-12 09:59:12 +02:00
Sebastiaan van Stijn
fabe66322f builder/remotecontext: remove deprecated "Rel()" utility
This function was deprecated in 54a556a5ef,
and the package is now internal to the daemon, so we can remove it.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-12 09:59:09 +02:00
Sebastiaan van Stijn
a1d05215f0 Merge pull request #50957 from corhere/fixup-after-dropping-deprecated-network-structs
daemon: fix build after revendoring api module
2025-09-12 01:50:18 +02:00
Cory Snider
cf243b64aa daemon: fix build after revendoring api module
Complete the removal of the deprecated network structs by dropping the
remaining references in daemon code.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-09-11 17:47:27 -04:00
Sebastiaan van Stijn
1e6e2ceb22 Merge pull request #50846 from akerouanton/drop-deprecated-network-structs
api/t/ctr: drop NetworkSettingsBase, DefaultNetworkSettings
2025-09-11 22:00:06 +02:00
Cory Snider
c2c2b80e90 daemon: report IPAM status for Swarm networks
As the Engine API requests may be directed at a non-leader Swarm
manager, the information needs to be tunneled through the Swarm API.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-09-11 15:25:14 -04:00
Sebastiaan van Stijn
1c006f247d Merge pull request #50832 from thaJeztah/events_remove_deprecated
api/types/events: Message: remove deprecated Status, ID, and From fields
2025-09-11 21:22:57 +02:00
Sebastiaan van Stijn
183f1517a9 Merge pull request #50915 from thaJeztah/omit_empty_config
api: image inspect: remove temporary backfill for Config fields
2025-09-11 21:21:30 +02:00
Albin Kerouanton
b092c8ca64 api/t/container: drop NetworkSettingsBase
Except Bridge, all fields of NetworkSettingsBase were deprecated in
v1.44, and are actually never set at all.

The Bridge field was deprecated in v1.51 but it's only set when the
container is connected to the default bridge, and when the daemon is
started with the --bridge option set.

So, remove all those fields and do not backfill them for older API
versions.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-09-11 17:57:42 +02:00
Albin Kerouanton
fc1ff44bc2 api/t/container: drop DefaultNetworkSettings
All the fields in DefaultNetworkSettings were deprecated in Engine v1.9
and scheduled for removal in v17.12. However, they're still return in
all supported API versions.

As we still need to keep backward compatibility for older API versions,
this change leverages the newly added 'compat' package to return these
fields despite being removed from the Go struct.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-09-11 17:57:42 +02:00
Sebastiaan van Stijn
a11005b40a Merge pull request #50954 from akerouanton/fix-compat-html-encoding
daemon/i/compat: disable HTML encoding
2025-09-11 17:24:54 +02:00
Albin Kerouanton
d5d3716705 daemon/i/compat: disable HTML encoding
The compat package marshals the base value into JSON to convert it into
a map[string]any, then applies the compat options, and finally
re-encodes the map into JSON.

`json.Marshal` is used for both marshalling operations. However, this
function encodes special HTML characters by default. The API responses
aren't meant to be embedded into HTML, so this behavior is not desired.

Replace `json.Marshal` with a `json.Encoder` with HTML escaping
disabled. Extra care is taken to drop the trailing LF added by
`(*json.Encoder).Encode()` (see [1]).

[1]: https://pkg.go.dev/encoding/json#Encoder.Encode

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-09-11 15:43:36 +02:00
Rob Murray
8efe6b0183 Add TestJoinError
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-09-11 14:19:21 +01:00
Rob Murray
73413ea693 bridge_linux_test.go: gofumpt
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-09-11 14:18:18 +01:00
Rob Murray
52c9cfd016 Use sbLeave to roll back on error from sbJoin
The old deferred error handling cleared ep.sandboxID, but only
in a copy of the Endpoint loaded from the store, not stored or
returned - so the modification was immediately lost.

It also tried to remove the endpoint from the Sandbox's 'endpoints',
but the remove function compared pointers rather than ids, so
nothing was removed. Removing it would have broken rollback anyway.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-09-11 13:02:41 +01:00
Rob Murray
53390f85dd Put clearNetworkResources() inline in its only caller
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-09-11 13:02:41 +01:00
Rob Murray
916fa31ab5 Acquire Sandbox.joinLeaveMu for Endpoint force-Delete
If an endpoint is still attached to a Sandbox when
Endpoint.Delete is called with force=true, sbLeave is
called. It may change the Sandbox's gateway, which may
conflict with a concurrent Join.

So, acquire the Sandbox's joinLeaveMu to do that, and
clarify the purpose of that mutex in struct Sandbox
comments.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-09-11 13:02:41 +01:00
Rob Murray
a9db1e9a26 Endpoint.sbLeave: don't load ep from store
Because it loaded the Endpoint object from store and operated
on that copy rather than its own receiver, sbJoin couldn't
successfully roll back on error if the Endpoint was not included
in the Sandbox's list of endpoints, or its current state had
not been written to store after the error occurred.

So, for example, releaseOSSboxResources() would not be called
to delete interfaces created in the container's netns.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-09-11 13:02:41 +01:00
Rob Murray
b192d06ec7 Remove network info from container when endpoint join fails
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-09-11 13:02:41 +01:00
Sebastiaan van Stijn
1b74b3e1ce api/types/events: Message: remove deprecated Status, ID, and From fields
These fields were deprecated in [moby@72f188] (docker v1.10, API v1.22),
with the deprecation message updated to be in the correct format in
[moby@247f47] (docker v23.0).

[moby@72f188]: 72f1881df1
[moby@247f47]: 247f4796d2

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-11 10:01:17 +02:00
Sebastiaan van Stijn
5815eb82ee daemon/events: omit deprecated event fields on API >= v1.52
Don't include the deprecated `status`, `id`, and `from` fields in event
responses.

These fields were deprecated in [moby@72f188] (docker v1.10, API v1.22),
but the daemon still included them in the response.

Unfortunately, the Docker CLI (and compose indirectly), continued using
these fields up until v25.0.0, and panic if the fields are omitted, or
left empty (due to a bug), see: https://github.com/moby/moby/pull/50832#issuecomment-3276600925
so we need to continue producing these fields on API < v1.52.

[moby@72f188]: 72f1881df1

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-11 10:01:17 +02:00
Sebastiaan van Stijn
c4eb791dba daemon/events: remove tests for deprecated API fields
These fields were deprecated in [moby@72f188] (docker v1.10, API v1.22),
and we shouldn't test for them.

[moby@72f188]: 72f1881df1

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-11 10:01:17 +02:00
Sebastiaan van Stijn
3278393cf2 Merge pull request #50949 from thaJeztah/api_update_docs
api/docs: fix events example response
2025-09-11 10:00:37 +02:00
Sebastiaan van Stijn
e4c9d289c6 Merge pull request #50852 from thaJeztah/add_compat_wrapper
daemon/internal: add "compat" package for legacy responses
2025-09-11 09:29:57 +02:00
Sebastiaan van Stijn
33a05ac344 daemon/internal: add "compat" package for legacy responses
Add a package to help augmenting API responses with additional fields,
replacing fields, or to remove fields from the response to allow for
legacy API responses to be produced without having to keep deprecated
fields in the API type definitions.

Co-authored-by: Albin Kerouanton <albinker@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-11 00:13:05 +02:00
Cory Snider
c46332737c Merge pull request #50917 from corhere/ipam-allocation-info-localscope
api, daemon: report IPAM status for local-scope networks
2025-09-10 13:05:33 -04:00
Cory Snider
3f86797d3f api,daemon: report IPAM status for network
On API v1.52 and newer, the GET /networks/{id} endpoint returns
statistics about the IPAM state for the subnets assigned to the network.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-09-10 11:06:05 -04:00
Cory Snider
ee8abb845d d/libnetwork: move uint128 to its own package
The uint128 type is very convenient for manipulating 128 bit-wide
quantities, as tends to come up in several contexts when working with
IPv6. Move it into a libnetwork/internal/ package so it can be reused
elsewhere within libnetwork.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-09-10 11:00:35 -04:00
Cory Snider
65ffac3dbf internal/iterutil: add Chain, Chain2 iterators
Add utilities to concatenate multiple iterators of the same type into a
single iterator.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-09-10 11:00:34 -04:00
Paweł Gronowski
2e12287747 Merge pull request #50950 from vvoland/replace-vendor
go.mod: replace client
2025-09-10 16:30:34 +02:00
Paweł Gronowski
ee24728b1e go.mod: replace client
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-09-10 15:40:31 +02:00
Sebastiaan van Stijn
139b6464b5 api/docs: fix events example response
Don't include the deprecated `id`, `status`, and `from` fields
in the response; they're no longer part of the API since v1.22
([moby@72f188]).

[moby@72f188]: 72f1881df1

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-10 14:37:53 +02:00
Sebastiaan van Stijn
50c073c7ed Merge pull request #50928 from akerouanton/re-add-replace-rule
go.mod: re-add replace github.com/moby/moby/api
2025-09-10 14:37:30 +02:00
Paweł Gronowski
7567f9754c Merge pull request #50937 from vvoland/gha-vm
gha: extract vm test to a separate workflow
2025-09-09 18:45:02 +02:00
Paweł Gronowski
8849871630 Merge pull request #50930 from vvoland/client-imageinspect-removeapiopts
client: remove ImageInspectWithAPIOpts function
2025-09-09 18:25:30 +02:00
Paweł Gronowski
f8925bac6f daemon: Do not default to c8d image store on Windows
Before this commit migration to c8d would apply when
`TEST_INTEGRATION_USE_GRAPHDRIVER` is empty/unset (which is the default
scenario).

This caused fresh Windows installations to default to containerd image
store and panic:

```
PS C:\Users\Administrator\Desktop> .\dockerd.exe --debug
time="2025-09-01T12:45:42.182741200Z" level=info msg="Starting up"
time="2025-09-01T12:45:42.225128900Z" level=debug msg="Listener created for HTTP on npipe (//./pipe/docker_engine)"
time="2025-09-01T12:45:42.231740900Z" level=info msg="OTEL tracing is not configured, using no-op tracer provider"
time="2025-09-01T12:45:42.263475300Z" level=info msg="Windows default isolation mode: process"
time="2025-09-01T12:45:42.263475300Z" level=debug msg="Stackdump - waiting signal at Global\\stackdump-7780"
time="2025-09-01T12:45:42.273230800Z" level=debug msg="Using default logging driver json-file"
time="2025-09-01T12:45:42.273230800Z" level=debug msg="No quota support for local volumes in C:\\ProgramData\\docker\\volumes: Filesystem does not support, or has not enabled quotas"
time="2025-09-01T12:45:42.301881100Z" level=info msg="Loading containers: start."
time="2025-09-01T12:45:42.302302800Z" level=info msg="[graphdriver] trying configured driver: windowsfilter"
time="2025-09-01T12:45:42.302302800Z" level=debug msg="WindowsGraphDriver InitFilter at C:\\ProgramData\\docker\\windowsfilter"
time="2025-09-01T12:45:42.303028000Z" level=debug msg="Initialized graph driver windowsfilter"
time="2025-09-01T12:45:42.323007600Z" level=info msg="Enabling containerd snapshotter because migration set with no containers and 0 images in graph driver" total=0
time="2025-09-01T12:45:42.323007600Z" level=info msg="Starting daemon with containerd snapshotter integration enabled"
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x88 pc=0x16522c4]

goroutine 1 [running]:
github.com/containerd/containerd/v2/client.(*Client).IntrospectionService(0x3153e60?)
        /go/src/github.com/docker/docker/vendor/github.com/containerd/containerd/v2/client/client.go:731 +0x24
github.com/moby/moby/v2/daemon.NewDaemon({0x3153e60, 0xc0001360f0}, 0xc0000fa008, 0xc00025c5a0, 0xc0002deee0)
        /go/src/github.com/docker/docker/daemon/daemon.go:1276 +0x35ad
github.com/moby/moby/v2/daemon/command.(*daemonCLI).start(0xc0000da320, {0x3153df0, 0x4704c60})
        /go/src/github.com/docker/docker/daemon/command/daemon.go:262 +0xa09
github.com/moby/moby/v2/daemon/command.runDaemon({0x3153df0, 0x4704c60}, 0xc0000da320)
        /go/src/github.com/docker/docker/daemon/command/docker_windows.go:28 +0x8a
github.com/moby/moby/v2/daemon/command.newDaemonCommand.func1(0xc000147508, {0xc000500f60?, 0x7?, 0x2cf8c90?})
        /go/src/github.com/docker/docker/daemon/command/docker.go:45 +0xd1
github.com/spf13/cobra.(*Command).execute(0xc000147508, {0xc00006a0f0, 0x1, 0x1})
        /go/src/github.com/docker/docker/vendor/github.com/spf13/cobra/command.go:1015 +0xaaa
github.com/spf13/cobra.(*Command).ExecuteC(0xc000147508)
        /go/src/github.com/docker/docker/vendor/github.com/spf13/cobra/command.go:1148 +0x46f
github.com/spf13/cobra.(*Command).Execute(...)
        /go/src/github.com/docker/docker/vendor/github.com/spf13/cobra/command.go:1071
github.com/spf13/cobra.(*Command).ExecuteContext(...)
        /go/src/github.com/docker/docker/vendor/github.com/spf13/cobra/command.go:1064
github.com/moby/moby/v2/daemon/command.daemonRunner.Run({0x3127160?}, {0x3153df0, 0x4704c60})
        /go/src/github.com/docker/docker/daemon/command/docker.go:111 +0x6e
main.main()
        /go/src/github.com/docker/docker/cmd/dockerd/main.go:38 +0x122
```

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-09-09 18:24:50 +02:00
Paweł Gronowski
bdd0a2a970 gha: extract vm test to a separate workflow
`vm` is quite lengthy which makes it impossible to restart other failed
(flaky) jobs from the `test` workflow before the `vm` finishes.

This patch moves it to a separate workflow to allow retrying other jobs
independently.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-09-09 17:34:25 +02:00
Sebastiaan van Stijn
fcd536fd26 Merge pull request #50936 from vvoland/remove-7zip4ps
Dockerfile.windows: remove deprecated 7Zip4Powershell
2025-09-09 17:21:02 +02:00
Paweł Gronowski
8c8324b37f Dockerfile.windows: remove deprecated 7Zip4Powershell
`tar` utility is included in Windows 10 (17063+) and Windows Server
2019+ so we can use it directly.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-09-09 15:44:07 +02:00
Albin Kerouanton
f835ff6987 Merge pull request #50289 from akerouanton/cleanup-windows-portmapper
libnet/portmapper: clean up windows port mapper
2025-09-08 22:52:45 +02:00
Paweł Gronowski
9d2e74d43d gha: Add automatic PR labeling for modules
Sets up the labeler workflow to automatically label PRs affecting the
`client` and `api` modules.

This allows to distinguish PRs targetting different modules.

TODO: Figure out how to handle PRs that would end up with both labels.
However, I think it's good to see what PRs would that affect.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-09-08 22:36:45 +02:00
Paweł Gronowski
705f26010e client/image_inspect: Unexport ImageInspectOptions
This should be an implementation detail and should not be exported.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-09-08 22:25:25 +02:00
Paweł Gronowski
67c8064bb3 client: remove ImageInspectWithAPIOpts function
This function was providing a way to set all API options directly,
however the api type was moved to client in 853aed1 so this option no
longer makes sense as it's exposing a part of the private struct at this
point.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-09-08 22:25:25 +02:00
Albin Kerouanton
5303799297 go.mod: re-add replace github.com/moby/moby/api
This was removed in 7696475 to prepare the release of
client/v0.1.0-beta.0 — re-add it.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-09-08 20:07:32 +02:00
Albin Kerouanton
604dfe5f47 Merge pull request #50906 from randomnoise/sctp-check
contrib/check-config: check SCTP protocol option
2025-09-08 14:24:59 +02:00
Sebastiaan van Stijn
1bf4bc8511 Merge pull request #50923 from thaJeztah/testutil_internal
testutil: move back to internal and merge internal/testutils
2025-09-08 12:46:51 +02:00
Albin Kerouanton
2f1015482f libnet/d/windows: ReleasePorts: use errors.Join
Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-09-08 11:40:09 +02:00
Albin Kerouanton
fc86411353 libnet/d/windows: inline releasePort
releasePort is a one-liner and is called only in one place. Inline it.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-09-08 11:37:08 +02:00
Albin Kerouanton
9efc1cc264 libnet/portmapper: rename, move PortMapper to portallocator
The only viable way to allocate a port is to bind and listen to it. So,
the windows PortMapper was really a PortAllocator in disguise.

Rename it to OSAllocator and move it to the portallocator package.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-09-08 11:32:21 +02:00
Sebastiaan van Stijn
4b230a4909 internal/testutils: merge with internal/testutil
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-08 10:08:35 +02:00
Sebastiaan van Stijn
d3e45f8743 testutil: move back to internal
This package was originally internal, but was moved out when BuildKit
used it for its integration tests. That's no longer the case, so we
can make it internal again.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-08 10:08:30 +02:00
Albin Kerouanton
af677b61a5 libnet/portmapper: clean up windows port mapper
The windows port mapper is needlessly complex while its job is pretty
straightforward: reserve a port through the port allocator, and start a
dummy proxy to allocate it from the OS.

The biggest source of complexity is the use of the `net.Addr` interface
to pass the host IP, port and proto. `MapRange` now has a proto arg, and
returns the allocated port.

`MapRange` is also instantiating a `mapping` struct whose fields are
all unused, except for its `stopUserlandProxy`. Instead, store
`stopProxy` callbacks directly into the `PortMapper`.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-09-08 10:05:29 +02:00
Albin Kerouanton
90f31c6c27 libnet/portmapper: remove dead field bridgeName
This field is not referenced by anything. Drop it.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-09-08 09:55:09 +02:00
Albin Kerouanton
f6e5b3afc5 libnet/portmapper: drop unused NewWithPortAllocator
This function is only called by New, and it takes the singleton
PortAllocator exposed by the portallocator package.

Remove this function and instantiate the PortMapper directly from New
constructor.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-09-08 09:55:05 +02:00
Albin Kerouanton
9e7de1b679 libnet/portmapper: remove unused field proxyPath
Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-09-08 09:55:02 +02:00
Albin Kerouanton
f6c59f9779 libnet/portmapper: merge mapper.go & mapper_windows.go
The portmapper struct provided by libnet/portmapper is only available
on Windows. Merge both files to reflect that.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-09-08 09:52:33 +02:00
Albin Kerouanton
b48442db4c libnet/portmapper: remove dead DeleteForwardingTableEntry
Prior to commit 4f09af626, DeleteForwardingTableEntry had a Linux
implementation. That's not the case anymore, and it's a no-op on
Windows. Remove it.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-09-08 09:52:14 +02:00
Albin Kerouanton
32710d3e5e libnet/portmapper: remove dead AppendForwardingTableEntry
Prior to commit 4f09af626, AppendForwardingTableEntry had a Linux
implementation. That's not the case anymore, and it's a no-op on
Windows. Remove it.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-09-08 09:11:33 +02:00
Akihiro Suda
22e8c7f3cf Merge pull request #50921 from thaJeztah/stats_errdefs
daemon: GetContainerStats: use errdefs for error-type handling
2025-09-08 11:58:00 +09:00
Akihiro Suda
102bb39566 Merge pull request #50920 from thaJeztah/errdefs_cleanup
errdefs: remove deprecated IsXXX utilities
2025-09-08 11:56:03 +09:00
Sebastiaan van Stijn
eb2e296711 daemon: GetContainerStats: use errdefs for error-type handling
Use the errdefs utilities to make sure we correctly detect the type
of error if a containerd errdefs type is returned.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-06 02:20:31 +02:00
Sebastiaan van Stijn
97eceb266a errdefs: remove deprecated IsXXX utilities
These were deprecated in f1bb44aeee, and
the IsContext is no longer used. They are not carried forward in the
new module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-06 02:08:04 +02:00
Sebastiaan van Stijn
312c247990 Merge pull request #50914 from corhere/testutil-footguns
testutil/daemon: fix some footguns for running integration tests interactively
2025-09-06 02:03:43 +02:00
Austin Vazquez
9760b1f300 Merge pull request #50918 from dmcgowan/prepare-v2.0.0-beta
Prepare release notes for v2.0.0-beta.0
2025-09-05 16:49:30 -07:00
Austin Vazquez
0bd92cde21 Merge pull request #50919 from thaJeztah/generate_authors
update AUTHORS
2025-09-05 16:10:40 -07:00
Sebastiaan van Stijn
2d73fed24e update AUTHORS
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-05 23:44:35 +02:00
Derek McGowan
37de02378c Prepare release notes for v2.0.0-beta.0
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-09-05 14:11:06 -07:00
Derek McGowan
de4ae66d08 Update client vendor to use tag
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-09-05 14:10:14 -07:00
Austin Vazquez
ed775f1b2c Merge pull request #50916 from thaJeztah/bump_client
go.mod: update client to v0.1.0-beta.0
2025-09-05 14:05:56 -07:00
Sebastiaan van Stijn
b5dde0234c add back replace
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-05 22:47:28 +02:00
Sebastiaan van Stijn
1499623a9d go.mod: update client to v0.1.0-beta.0
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-05 22:46:26 +02:00
Sebastiaan van Stijn
0525ae2aed api: image inspect: remove temporary backfill for Config fields
Commit 4dc961d0e9 (API v1.50) fixed the type
used for Config to point to the correct type, which is the Config struct
from the [Docker image spec] (which embeds the [OCI Image Specification]
type); however, those types use an omitempty, which wasn't documented as
part of the API changes, so f85394dd5d added
a temporary backfill for empty fields.

This removes that backfill for API v1.52 so that empty image config fields
are now omitted.

[OCI Image Specification]: https://github.com/opencontainers/image-spec/blob/v1.1.1/specs-go/v1/config.go#L23-L62
[Docker image spec]: https://github.com/moby/docker-image-spec/blob/v1.3.1/specs-go/v1/image.go#L19-L32

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-05 22:15:54 +02:00
Cory Snider
d98a8c59ab testutil/daemon: fail gracefully if DEST is unset
If neither of the DOCKER_INTEGRATION_DAEMON_DEST or DEST environment
variables are set, integration tests panic with a nil-dereference panic
in os.(*File).Name(...). This is a very unhelpful behaviour for someone
trying to run integration tests interactively. Fix up the logic to avoid
dereferencing nil os.File pointers and instead fail the test immediately
with an actionable error message.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-09-05 16:09:14 -04:00
Cory Snider
8995619b9d testutil/daemon: fix DOCKER_USERLANDPROXY env var
An inverted condition resulted in integration tests disabling the
userland proxy if the DOCKER_USERLANDPROXY environment variable is set
to a value that strconv.ParseBool cannot parse, leading to the confusing
behaviour of DOCKER_USERLANDPROXY=0 enabling the userland proxy and
DOCKER_USERLANDPROXY=foo disabling it. Fix up the logic so that
DOCKER_USERLANDPROXY=0 disables the userland proxy and
DOCKER_USERLANDPROXY=foo is an error.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-09-05 16:09:14 -04:00
Sebastiaan van Stijn
5ad5e5d0c5 Merge pull request #50913 from dmcgowan/prepare-client-0.1.0-beta
Prepare release notes for client/v0.1.0-beta.0
2025-09-05 21:59:48 +02:00
Derek McGowan
b5035def03 Prepare release notes for client/v0.1.0-beta.0
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-09-05 11:10:49 -07:00
Derek McGowan
76964752d3 Update client api version to v1.52.0-beta
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-09-05 11:10:49 -07:00
Sebastiaan van Stijn
7777b86d53 Merge pull request #50910 from thaJeztah/api_docs_image_config
api/docs: remove temporary "full" example for image config
2025-09-05 19:59:19 +02:00
Sebastiaan van Stijn
ec26e71055 Merge pull request #50911 from thaJeztah/api_swagger_sync
api/docs: sync v1.52 docs with latest
2025-09-05 19:58:57 +02:00
Sebastiaan van Stijn
59c2f2d5bc Merge pull request #50907 from thaJeztah/move_build_options
api/types/build: move build options to client and backend
2025-09-05 19:46:25 +02:00
Sebastiaan van Stijn
a1e3a109ee api/docs: sync v1.52 docs with latest
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-05 19:31:00 +02:00
Sebastiaan van Stijn
0fe1af95f3 api/docs: remove temporary "full" example for image config (v1.50, v1.51)
This example was added in 5e0e34fafd so that
the deprecated fields could be omitted from the example. Those fields were
removed from the swagger in 4dc961d0e9, but
the temporary example was not removed.

This patch removes the example, in favor of the per-field examples, which
were already in place.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-05 19:22:45 +02:00
Sebastiaan van Stijn
7bfbb6e8ca api/swagger: remove temporary "full" example for image config
This example was added in 5e0e34fafd so that
the deprecated fields could be omitted from the example. Those fields were
removed from the swagger in 4dc961d0e9, but
the temporary example was not removed.

This patch removes the example, in favor of the per-field examples, which
were already in place.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-05 19:22:42 +02:00
Sebastiaan van Stijn
4e23f5fd62 Merge pull request #50855 from corhere/network-summary-swagger
api/types/network: generate network-inspect struct definitions from Swagger spec
2025-09-05 19:20:43 +02:00
Austin Vazquez
75fd07c365 Merge pull request #50904 from dmcgowan/prepare-api-1.52-beta
Prepare release notes for api/v1.52.0-beta.0
2025-09-05 10:12:19 -07:00
Sebastiaan van Stijn
6b752e0d8b Merge pull request #50909 from thaJeztah/move_LoadResponse
api/types/image: move LoadResponse to client
2025-09-05 18:27:58 +02:00
Sebastiaan van Stijn
2d1af4e4e4 api/types/build: move build options to client and backend
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-05 15:57:05 +02:00
Sebastiaan van Stijn
5232d82c1b daemon/server/backend: move build options to buildbackend
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-05 15:56:56 +02:00
Sebastiaan van Stijn
8b8a3cb14c api/types/image: move LoadResponse to client
It's not the response coming from the API, but a wrapper for a response
reader. We should ultimately remove it.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-05 15:15:42 +02:00
Sebastiaan van Stijn
a064febe14 Merge pull request #50905 from thaJeztah/move_checkpoint_options
api/types/checkpoint: move checkpoint options to client
2025-09-05 13:01:52 +02:00
Akihiro Suda
ae95990cfe Merge pull request #50901 from thaJeztah/bump_cobra
vendor github.com/spf13/pflag v1.0.10, github.com/spf13/cobra v1.10.1
2025-09-05 17:52:14 +09:00
Sebastiaan van Stijn
432c9e81d1 Merge pull request #50772 from austinvazquez/move-build-cache-prune-options-from-api-to-client
api/types/build: move build cache prune options from api to client
2025-09-05 10:33:23 +02:00
Akihiro Suda
b87b041ef8 Merge pull request #50900 from thaJeztah/skip_vm_validate_only
gha: skip "vm" checks if `ci/validate-only` label is set
2025-09-05 17:26:01 +09:00
Sebastiaan van Stijn
a8afc2c6fb api/types/checkpoint: move checkpoint options to client
Move the option-types to the client and in some cases create a
copy for the backend. These types are used to construct query-
args, and not marshaled to JSON, and can be replaced with functional
options in the client.

The CreateOptions type was used both as options-struct for the client,
and as struct to marshal/unmarshal the request. For this type, a copy
is created in the Client and a new `checkpoint.CreateRequest` is added
in the API.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-05 10:20:06 +02:00
Serhan Tutar
f1da80e8d3 contrib/check-config: check SCTP protocol option
Signed-off-by: Serhan Tutar <randomnoise@users.noreply.github.com>
2025-09-05 10:59:36 +03:00
Sebastiaan van Stijn
a45639af26 Merge pull request #50897 from thaJeztah/move_container_options
api/types/container: move container options to client
2025-09-05 09:29:56 +02:00
Derek McGowan
d904f3b625 Prepare api/1.52.0-beta releases
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-09-04 22:54:01 -07:00
Derek McGowan
4e30076e4d Add mailmap entry for Austin
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-09-04 22:53:40 -07:00
Cory Snider
e656f39952 api/t/network: generate more structs from Swagger
Replace hand-rolled struct definitions for api/types/network with
types generated from the Swagger definitions:
  - ConfigReference
  - EndpointResource
  - NetworkingConfig
  - PeerInfo
  - ServiceInfo
  - Task

Add Swagger definitions for ServiceInfo and Task.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-09-04 19:46:44 -04:00
Cory Snider
ea1c2530da api/t/network: generate Inspect, Summary structs
Replace the hand-rolled Network, Summary and Inspect struct types in
api/types/network with types generated from the Swagger definition.

Disable the generation of all unwanted marshalers and unmarshalers.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-09-04 19:46:43 -04:00
Austin Vazquez
26e335b647 api/types/build: move CachePruneOptions to client mod
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-09-04 16:33:57 -05:00
Sebastiaan van Stijn
798abe8965 vendor: github.com/spf13/cobra v1.10.1
full diff: https://github.com/spf13/cobra/compare/v1.9.1...v1.10.1

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-04 23:27:39 +02:00
Sebastiaan van Stijn
02a50be1f9 vendor: github.com/spf13/pflag v1.0.10
full diff: https://github.com/spf13/pflag/compare/v1.0.6...v1.0.10

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-04 23:27:02 +02:00
Sebastiaan van Stijn
3eceb2d0e9 Merge pull request #50899 from thaJeztah/sync_swagger_docs
api/docs: update v1.52 docs with current swagger
2025-09-04 22:58:19 +02:00
Sebastiaan van Stijn
aaa9dd4e26 gha: skip "vm" checks if ci/validate-only label is set
commit f0c069ffc9 added support for a
`ci/validate-only` label to skip tests and only run the validation checks.
Commit 09ecd74cf3 was merged later, but was
authored before that feature was merged, so did not account for the label,
so the "vm" checks would always run.

This applies the additional conditions to skip the "vm" checks if the
`ci/validate-only` label is set.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-04 22:21:19 +02:00
Sebastiaan van Stijn
ccf1363680 api/docs: update v1.52 docs with current swagger
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-04 21:52:11 +02:00
Cory Snider
c208f90796 api/templates: vendor structfield template
Taken verbatim from
eee6eaf67f/generator/templates/structfield.gotmpl
so the alterations from the upstream template can be easily diffed.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-09-04 15:38:14 -04:00
Sebastiaan van Stijn
6da8589ebe Merge pull request #50878 from corhere/network-inspect-concrete-type
api/types/network: separate Summary from Inspect
2025-09-04 21:36:00 +02:00
Austin Vazquez
749ec81706 Merge pull request #50799 from thaJeztah/touchup_delete
image delete: inline some variables, and touch-up TODOs
2025-09-04 12:27:30 -07:00
Sebastiaan van Stijn
10f683eeef Merge pull request #50893 from austinvazquez/make-image-inspect-driver-data-optional
api/types/image: make `InspectResponse.GraphDriver` optional
2025-09-04 21:08:26 +02:00
Sebastiaan van Stijn
d019451022 Merge pull request #50850 from corhere/addrset-popcnt
d/libn/internal/addrset: add popcount methods
2025-09-04 21:04:22 +02:00
Sebastiaan van Stijn
0bfc33c70b Merge pull request #50856 from corhere/swagger-gen-script-cleanup
hack: use heredocs in generate-swagger-api.sh
2025-09-04 20:59:06 +02:00
Sebastiaan van Stijn
aead9964f3 Merge pull request #50586 from olljanat/endpoint-name-label
libnetwork: provide endpoint name for IPAM drivers
2025-09-04 20:20:25 +02:00
Sebastiaan van Stijn
57ce548341 client: move container options together with their users
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-04 20:09:58 +02:00
Sebastiaan van Stijn
4d20b6fe56 api/types/container: move container options to client
Move the option-types to the client and in some cases create a
copy for the backend. These types are used to construct query-
args, and not marshaled to JSON, and can be replaced with functional
options in the client.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-04 20:09:55 +02:00
Austin Vazquez
c441b2ef19 api/types/image: make InspectResponse.GraphDriver optional
This change makes the `GraphDriver` field in `image.InspectResponse` optional. This field will only be returned when using moby engine graph drivers as a backend storage implementation. It will be omitted when using the containerd image backend.

Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-09-04 13:04:10 -05:00
Cory Snider
1a86389419 api/types/network: separate Summary from Inspect
While the network Summary and Inspect types have been aliases in Go's
type system, in practice there is a difference: the Containers and
Services fields are only populated when inspecting a network. Split out
the common fields into a base network.Network struct which is embedded
in the network.Summary and network.Inspect types.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-09-04 13:51:28 -04:00
Cory Snider
291e129631 Merge pull request #50860 from corhere/network-filter-iface
daemon: filter networks before converting to API types
2025-09-04 13:48:07 -04:00
Cory Snider
f8bd170b2a daemon: validate args in network.New*Filter
Filter-term validation does not belong in the API module. Clients should
not be making any assumptions about which terms the daemon understands.
Users should not need to upgrade their clients to use filter terms
introduced in a newer daemon. Move the network filter validation from
the api module into the daemon.

Split network.NewFilter into network.NewListFilter and
network.NewPruneFilter constructors which validate the filter terms,
enforcing the invariant that any network.Filter is a well-formed filter
for networks.

The network route handlers have been leveraging a hidden 'idOrName'
filter term that is not listed in the set of accepted filters and
therefore not accepted in API client requests. And it's a good thing
that it was never part of the API: it is completely broken and not fit
for purpose! When a filter contains an idOrName term, the term values
are ignored and instead the filter tests whether either the 'id' or
'name' terms match the Name of the network. Unless the filter contains
both 'id' and 'name' terms, the match will evaluate to true for all
networks! None of the daemon-internal users of 'idOrName' set either
of those terms, therefore it has the same effect as if the filter did
not contain the 'idOrName' term in the first place.

Filtering networks by id-or-name is a quirky thing that the daemon needs
to do to uphold its end of the Engine API contract, not something that
would be of use to clients. Fixing up the idOrName filter would
necessitate adding it to the list of accepted terms so the filter passes
validaton, which would have the side effect of also making the filter
available to API clients. Instead, add an exported field to the Filter
struct so that daemon code can opt into the internal-only behaviour of
having the 'id' term match on either the network Name or ID.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-09-04 12:49:31 -04:00
Cory Snider
ea1dfbda9e daemon: prune networks using network.Filter
Construct a network.Filter from the filters.Args only once per API
request so we don't waste cycles re-validating an already validated
filter. Since (*Daemon).NetworksPrune is implemented in terms of
(Cluster).GetNetworks, that method now accepts a network.Filter instead
of a filter.Args. Change the signature of (*Daemon).GetNetworks for
consistency as both of the GetNetworks methods are used by network API
route handlers.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-09-04 12:49:31 -04:00
Cory Snider
f0d10ae733 d/network: filter networks individually
Internally a network is represented by either a libnetwork.Network or a
swarmapi.Network. The daemon functions backing the API server map
these values to the Engine API network.Inspect type on demand. Since
they have to convert, the functions to get a list of networks have to
loop over the slice of Networks and append them to a slice of
network.Inspect values.

The function used to filter the list of networks by a user-supplied
predicate takes a []network.Inspect and returns a shorter slice.
Therefore the daemon functions backing the API server have to loop
through the list twice: once to convert, and again inside the
FilterNetworks function to delete networks from the slice which do not
match the filter predicate. Each time an item is deleted from a slice,
all items at higher indices need to be copied to lower indices in the
backing array to close the hole.

Replace FilterNetworks with a function that accepts a single
interface-valued network and returns a boolean. Amend libnetwork.Network
and write a thin adapter for swarmapi.Network so both implement the
aforementioned interface. The daemon functions can thus filter networks
before projecting the values into API structs, and can completely skip
over non-matching networks, which cuts down on a nontrivial amount of
copying.

Split the validation of the filter predicate from filter evaluation to
both make it more ergonomic to use inside loops, and to make invalid
states (a filter with an ill-formed predicate) unrepresentable.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-09-04 12:49:31 -04:00
Austin Vazquez
a4a90c2248 api: fix deprecation of "keep-storage" /build/prune query parameter
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-09-04 11:28:10 -05:00
Austin Vazquez
5f8fd1f195 Merge pull request #50587 from thaJeztah/remove_version_consts
api: remove unused DefaultVersion, MinSupportedAPIVersion consts
2025-09-04 09:27:25 -07:00
Sebastiaan van Stijn
e46a991dc5 api: remove unused DefaultVersion, MinSupportedAPIVersion consts
These consts are no longer used, and separate consts were added in both
the client and daemon packages;

- client: 41da5700a4
- daemon: a632b8495b

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-04 07:30:35 -05:00
Sebastiaan van Stijn
8e946ee3d0 Merge pull request #50825 from austinvazquez/move-decode-security-opts-from-types-to-pkg
api/types/system: move `SecurityOpt` and `DecodeSecurityOptions` to client mod
2025-09-04 10:30:44 +02:00
Sebastiaan van Stijn
364281e6cb Merge pull request #50883 from thaJeztah/libc8d_cleanups
libcontainerd/remote: assorted cleanups
2025-09-04 00:41:50 +02:00
Austin Vazquez
0dd22f6471 Merge pull request #50881 from thaJeztah/daemon_fix_typo
daemon: Daemon.ContainerExecStart: fix typo in log field
2025-09-03 13:57:52 -07:00
Paweł Gronowski
ac2d830587 Merge pull request #50889 from vvoland/update-go
update to go1.24.7
2025-09-03 22:18:06 +02:00
Paweł Gronowski
30406d42e3 update to go1.24.7
This includes 1 security fix:

- net/http: CrossOriginProtection bypass patterns are over-broad

    When passing patterns to CrossOriginProtection.AddInsecureBypassPattern,
    requests that would have redirected to those patterns (e.g. without a trailing
    slash) were also exempted, which might be unexpected.

    Thanks to Marco Gazerro for reporting this issue.

    This is CVE-2025-47910 and Go issue https://go.dev/issue/75054.

View the release notes for more information:
https://go.dev/doc/devel/release#go1.24.7

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-09-03 20:31:17 +02:00
Paweł Gronowski
1c220f2f3f Merge pull request #50885 from crazy-max/buildkit-0.24.0
vendor: update buildkit to v0.24.0
2025-09-03 20:26:50 +02:00
Austin Vazquez
e2e9f36c5f api/types/system: move SecurityOpt type and DecodeSecurityOptions to client
This change moves the `system.SecurityOpt` type and `system.DecodeSecurityOptions` function to the client and adds a set of unit tests to capture current implementation. This change also create a set of daemon backend copies for usage.

Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-09-03 12:49:06 -05:00
Kevin Alvarez
d47b0db4f9 vendor: update buildkit to v0.24.0
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-09-03 18:41:21 +02:00
Paweł Gronowski
2f15be1679 Merge pull request #50886 from austinvazquez/fix-vendoring-for-client-mod
fix: client vendor with config struct changes
2025-09-03 18:13:12 +02:00
Austin Vazquez
ca97d071b7 fix: client vendor with config struct changes
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-09-03 10:32:58 -05:00
Rob Murray
04e09bbfe6 Merge pull request #50845 from robmry/iterate_over_nftables_rules
nftables: iterate over rules
2025-09-03 16:29:48 +01:00
Albin Kerouanton
4021bd7947 Merge pull request #50864 from akerouanton/bridge-driver-config
libnet/d/bridge: Register: pass a Configuration struct
2025-09-03 16:20:38 +02:00
Austin Vazquez
50d281f074 Merge pull request #50847 from vvoland/client-config-opt
client: Migrate tests to use functional opts and extract `clientConfig`
2025-09-03 06:41:11 -07:00
Sebastiaan van Stijn
3c34c9d031 Merge pull request #50880 from akerouanton/fix-empty-pbs-slices-warning
daemon/srv/r/ctr: handlePortBindingsBC: fix warning
2025-09-03 14:50:32 +02:00
Sebastiaan van Stijn
4293b81f14 Merge pull request #50879 from thaJeztah/rm_contrib_udev
contrib: remove udev rules for hiding loopback devices
2025-09-03 12:46:54 +02:00
Sebastiaan van Stijn
37d6a1909b libcontainerd/remote: wrapError: don't convert c8d errdefs error
The moby codebase is now able to handle containerd errdefs errors directly
so there's no need to wrap a c8d "NotFound" error. We still need to look
if we can remove this function altogether; it's unclear what conditions
could result in the string-matching being needed.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-03 12:31:57 +02:00
Sebastiaan van Stijn
36303969b9 libcontainerd/remote: container.NewTask: move vars to where used
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-03 12:31:53 +02:00
Albin Kerouanton
f37094ad4f libnet/d/bridge: CreateEndpoint: use d.config directly
newDriver, which creates a new instance of the bridge driver, is the
only place where the driver config field is set. So there's no need to
gate access to it with a mutex.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-09-03 12:10:16 +02:00
Albin Kerouanton
ae24edfc0d libnet/d/bridge: merge configure into newDriver
configure must be called every time newDriver is called... so merge them
together.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-09-03 12:10:16 +02:00
Albin Kerouanton
2436458227 libnet/d/bridge: Register: pass a Configuration struct
Libnetwork passes a map[string]any to the bridge driver's Register
function. This forces the daemon to convert its configuration into a
map, and the driver to convert that map back into a struct.

This is unnecessary complexity, and makes it harder to track down where
and how bridge driver configuration fields are set.

Refactor libnetwork to let the daemon register the bridge.Configuration
directly through a new option `OptionBridgeConfig`.

The bridge driver now takes a `Configuration` param that needs no
special treatment.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-09-03 12:10:10 +02:00
Albin Kerouanton
386a3a6bba libnet/config: mv config_{unsupported,windows}.go
Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-09-03 12:08:24 +02:00
Albin Kerouanton
18f2e61d08 libnet/config: rm config_freebsd.go
Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-09-03 12:08:24 +02:00
Paweł Gronowski
1733d00ef1 Merge pull request #48955 from thaJeztah/improve_TestConcurrentPush
integration-cli: TestConcurrentPush: refactor to improve failure logs
2025-09-03 11:54:18 +02:00
Sebastiaan van Stijn
e099f1e409 daemon: Daemon.ContainerExecStart: fix typo in log field
Changing it to `execID`, which is what's used in most/all other places.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-03 11:34:21 +02:00
Albin Kerouanton
6e512cc292 libnet/d/ipvlan: Register: remove unused config param
Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-09-03 11:23:07 +02:00
Albin Kerouanton
459f4f431d libnet/d/macvlan: Register: remove unused config param
Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-09-03 11:23:07 +02:00
Albin Kerouanton
43014a891b libnet/d/overlay: Register: remove unused config param
The overlaydrivers takes a config parameter, but actually never uses
it — drop it.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-09-03 11:23:07 +02:00
Albin Kerouanton
18efa5513d libnet: makeDriverConfig: drop support for label-based config
makeDriverConfig is written in such a way that it seems to support
label-based driver configuration. That is, you could hypothetically use
labels starting with `com.docker.network.driver.<driver-name>.` to
define the configuration of a driver.

These labels come from the Controller's `cfg.Labels` which are set by
the daemon through libnet's OptionLabels which takes the list of labels
set on the daemon through dockerd's --label flag, or the equivalent
daemon.json field.

However, the daemon forbids setting labels that start with
`com.docker.*`. For instance:

    label com.docker.network.driver.bridge.EnableProxy=false is not allowed: the namespaces com.docker.*, io.docker.*, and org.dockerproject.* are reserved for internal use

Hence, this is dead code — remove it.

Also, makeDriverConfig is checking if the Controller's cfg field is
nil... But the Controller struct is instantiated in a single place (i.e.
NewController) and it always set that field. Drop that nil check too.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-09-03 11:23:07 +02:00
Albin Kerouanton
1470048e00 libnet: remove drivers_freebsd.go
As it stands, libnetwork pkg can't be compiled on FreeBSD, so no need to
keep this file around.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-09-03 11:23:07 +02:00
Albin Kerouanton
4ea085187a libnet/d/bridge: export Configuration
Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-09-03 11:23:07 +02:00
Albin Kerouanton
7b75f355e5 daemon/srv/r/ctr: handlePortBindingsBC: fix warning
Commit 0ca7ac325 was merged before a review comment was addressed.

Update the warning message returned by handlePortBindingsBC to handle
the case where multiple empty port bindings slices are sent to the API.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-09-03 11:16:51 +02:00
Sebastiaan van Stijn
fbad7b568d libcontainerd/remote: task.Exec: log warning on cleanup failure
Not exactly sure what errors we can expect here if the process failed
to start, but logging as a warning instead of discarding won't do harm.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-03 11:00:11 +02:00
Sebastiaan van Stijn
e67b3b0b90 libcontainerd/remote: task.Exec: rename processID -> execID
This argument is set from ExecConfig.ID, which we refer to as "execID"
in most places; rename the argument to match that terminology.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-03 10:58:33 +02:00
Sebastiaan van Stijn
003e17ff5a libcontainerd/remote: task.Exec: preserve parent context during cleanup
Use `context.WithoutCancel()` to preserve the parent context during cleanup
instead of creating a new context. This still prevents context-cancellation
from terminating the cleanup, but makes sure that tracing and logging are
wired up; https://github.com/containerd/containerd/blob/v2.1.4/client/process.go#L232-L263

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-03 10:58:17 +02:00
Sebastiaan van Stijn
167b0e9ea6 libcontainerd/remote: task.Exec: make defer error-handling more explicit
Use a named output variable to more clearly indicate what error is being
checked, and scope `err` variables used in this function.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-03 10:15:37 +02:00
Sebastiaan van Stijn
55c929c97f libcontainerd/remote: rename var that shadowed import
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-03 09:58:48 +02:00
Sebastiaan van Stijn
abfe332072 Merge pull request #50874 from akerouanton/bc-empty-pbs-slices
daemon: backfill empty PBs slices for backward compat
2025-09-02 23:49:34 +02:00
Sebastiaan van Stijn
023ae2e218 contrib: remove udev rules for hiding loopback devices
This reverts commit dbb47f63ab, which
added these rules to hide loopback devices from udisks. These rules
were for devicemapper, which we no longer support, and use hard-coded
paths, making them not practical for other purposes.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-02 23:30:07 +02:00
Sebastiaan van Stijn
44a5c7556e Merge pull request #50866 from akerouanton/remove-dummy-manager-netdrivers
libnet/drivers: rm dummy '*manager' drivers
2025-09-02 23:22:56 +02:00
Rob Murray
2edfe3768f Merge pull request #50877 from robmry/bump-minimum-go-version
Bump go.mod minimum-go-version to 1.24
2025-09-02 21:59:24 +01:00
Albin Kerouanton
0ca7ac3258 daemon: backfill empty PBs slices for backward compat
So far, on ContainerStart, the daemon was silently backfilling empty
PortBindings slices with a PortBinding with unspecified HostIP and
HostPort. This was done by github.com/docker/go-connections/nat.SortPortMap.

This backfilling doesn't make much sense, and we're trying to remove
that package. So, move the backfilling to the API server, keep it for
older API versions, deprecate it for API 1.52, and drop it for API 1.53
and above.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-09-02 22:45:04 +02:00
Albin Kerouanton
4d2a293ff3 libnet/drvapi: make NetworkAllocate optional
This method is only used by the cnmallocator to allocate Swarm-scoped
network resources. Its only concrete implementation is in the ovmanager.
Other network drivers are implementing it too to adhere to the
driverapi.Driver interface, but they all return a 'not implemented'
error.

Extract this method into a separate interface, and add a dedicated
RegisterNetworkAllocator to the driver registry. Update the cnmallocator
to load 'network allocators' instead of 'drivers'.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-09-02 21:55:03 +02:00
Albin Kerouanton
cbd04b6f08 libnet/cnmallocator: use a list of local netdrivers
The cnmallocator package has a map of supported network drivers which
are registered using a pkg-local driver registry. This registry is then
used to load drivers, and if they have a 'local' DataScope, they aren't
used for anything. Drivers with a 'global' DataScope are called to
allocate cluster-wide network resources.

Instantiating builtin network drivers may have unintended side-effects
(e.g. the bridge driver registers a callback that should run when
firewalld is reloaded), so libnetwork has dummy '*manager' drivers that
do nothing but carry the same Capability than the original driver they
masquerade.

Put 'local drivers' (e.g. those with DataScope 'local') into a separate
list that just contains drivers' name, and don't register them into the
cnmallocator's driver registry.

Remove all the dummy '*manager' drivers as they're not needed anymore.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-09-02 21:53:50 +02:00
Rob Murray
478d1fc8ba Bump go.mod minimum-go-version to 1.24
Match the minor version of Go used in the dev container
(and therefore in CI).

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-09-02 18:59:19 +01:00
Sebastiaan van Stijn
269960a4c6 integration-cli: TestConcurrentPush: refactor to improve failure logs
This tests, when failing, only produced a non-informative "exit status 1",
which limits investigating why it failed.

This patch:

- Rewrites the parallel pushes to use an error-group, and asserts each
  push to get the failure output of the command.
- Simplifies the Dockerfile that's used for building the test-image,
  removing steps that were not needed for the test.
- Adds a cleanup step to make sure the images are deleted after the
  test, or if the test fails (although the test-suite should already
  handle this).

Before this, a failure looked like:

    make BIND_DIR=. TEST_FILTER='TestConcurrentPush' test-integration-cli
    === FAIL: arm64.integration-cli TestDockerRegistrySuite/TestConcurrentPush (5.49s)
        docker_cli_push_test.go:159: assertion failed: error is not nil: exit status 1: concurrent push failed with error: exit status 1
        check_test.go:476: [dfa779e71fdf8] daemon is not started
        --- FAIL: TestDockerRegistrySuite/TestConcurrentPush (5.49s)

With this patch applied:

    make BIND_DIR=. TEST_FILTER='TestConcurrentPush' test-integration-cli
    === FAIL: arm64.integration-cli TestDockerRegistrySuite/TestConcurrentPush (2.47s)
        docker_cli_push_test.go:156: assertion failed:
            Command:  /usr/local/cli-integration/docker push 127.0.0.1:5000/dockercli/busybox:push2nosuch
            ExitCode: 1
            Error:    exit status 1
            Stdout:   The push refers to repository 127.0.0.1:5000/dockercli/busybox

            Stderr:   tag does not exist: 127.0.0.1:5000/dockercli/busybox:push2nosuch

            Failures:
            ExitCode was 1 expected 0
            Expected no error
        docker_cli_push_test.go:160: assertion failed: error is not nil: exit status 1
        check_test.go:476: [db77ef03a8fd8] daemon is not started
        --- FAIL: TestDockerRegistrySuite/TestConcurrentPush (2.47s)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-02 09:51:14 -05:00
Austin Vazquez
4534924212 Merge pull request #50867 from vvoland/c8d-fix-history-nonative
c8d/history: Fix non-native platforms
2025-09-02 05:39:50 -07:00
Paweł Gronowski
8031b077bc gha/arm64: Setup qemu
Make it possible to build non-native images like the other
test-integration workflows

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-09-02 12:12:28 +02:00
Paweł Gronowski
64b8770d90 Merge pull request #50861 from akerouanton/firewalld-debug-logs
hack/dind-systemd: enable, collect firewalld debug logs
2025-09-02 11:32:11 +02:00
Paweł Gronowski
ce338dec81 integration/internal: Print Buildkit logs
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-09-02 11:14:57 +02:00
Paweł Gronowski
27fca93b65 c8d/history: Fix non-native platforms
When building a non-native platform, it's not unpacked by default.
History tries to read the disk usage of all the layer and it doesn't
handle missing snapshots gracefully.

This patch fixes this.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-09-02 11:12:00 +02:00
Paweł Gronowski
ad830a47af integration/internal: Handle Buildkit in GetImageIDFromBody
BuildKit emits some additional events during build and they are not
`build.Result` so don't fail if we encounter one.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-09-02 11:11:46 +02:00
Rob Murray
d2bb9bda29 Merge pull request #50870 from vvoland/windows-fix-layer-perm
graphdriver/windows: Potential fix for access denied
2025-09-02 09:17:57 +01:00
Sebastiaan van Stijn
0b772bd5da Merge pull request #50858 from tonistiigi/update-buildkit-v0.24.0-rc2
vendor: update buildkit to v0.24.0-rc2
2025-09-01 18:15:23 +02:00
Paweł Gronowski
f66f555ad4 graphdriver/windows: Potential fix for access denied
Use `winio.RunWithPrivileges` to get the privileges.
It's better because it also locks the Go runtime thread so if the Go
scheduler decides to run this code on a different thread, it will still
have the expected privileges.

A naive attempt at fixing an error experienced by Docker Desktop user
when using Windows containers:

```
failed to register layer: re-exec error: exit status 1: output: hcsshim::ProcessUtilityVMImage \\?\C:\ProgramData\Docker\windowsfilter\<hash1>\UtilityVM: Access is denied.
failed to register layer: re-exec error: exit status 1: output: hcsshim::ProcessBaseLayer \\?\C:\ProgramData\Docker\windowsfilter\<hash2>: Access is denied.
failed to register layer: re-exec error: exit status 1: output: hcsshim::ProcessBaseLayer \\?\C:\ProgramData\Docker\windowsfilter\<hash3>: Access is denied.
```

Unfortunately I can't reproduce the issue on a Windows VM, but this
definitely won't hurt.

At least, I verified that the daemon still works on Windows.

Inspired by: https://github.com/containerd/containerd/issues/8206

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-09-01 16:16:28 +02:00
Albin Kerouanton
ea73c88d12 libnet/cnmallocator: rm drivers_darwin.go
Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-09-01 15:41:21 +02:00
Albin Kerouanton
18b21a32a1 libnet/cnmallocator: rm drivers_unsupported.go
Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-09-01 15:39:17 +02:00
CrazyMax
60fa39d559 hack: temporarily use custom buildkit ref for testing
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2025-09-01 14:51:39 +02:00
Albin Kerouanton
5682f65cca hack/dind-systemd: collect firewalld logs
Add a systemd service 'collect-firewalld-logs.service' that copies
firewalld log file into bundles/ on container shutdown. This won't
provide much value for developers who run `make shell`, but it'll be
useful on CI to include firewalld logs in the exported artifacts.

The CI is already configured to pick every *.log file from bundles/, so
no further change is needed on that side.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-09-01 11:45:58 +02:00
Albin Kerouanton
03df89b84a hack/dind-systemd: enable firewalld debug logs
Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-09-01 11:44:48 +02:00
Tonis Tiigi
77ce202515 vendor: update buildkit to v0.24.0-rc2
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2025-08-29 15:21:34 -07:00
Cory Snider
3c83038936 hack: use heredocs in generate-swagger-api.sh
Refactor hack/generate-swagger-api.sh to be more friendly to automatic
merges by sorting names to generate alphabetically and by listing each
name to generate on its own line without backslash line continuations.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-08-29 17:32:17 -04:00
Cory Snider
854ec0a1ad d/libn/internal/addrset: add popcount methods
Add methods to count the number of addresses in the set which have a
particular prefix. The returned counts are 128 bits wide to accommodate
sets containing more than 2**64 addresses.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-08-29 15:17:28 -04:00
Sebastiaan van Stijn
578ce11a56 Merge pull request #50842 from corhere/locked-manager-action-ctx
daemon/cluster: improve use of lockedManagerAction
2025-08-29 20:34:35 +02:00
Austin Vazquez
229edd0c1c Merge pull request #50826 from austinvazquez/remove-legacy-marshal-json-function
api/types/registry: move `ServiceConfig` legacy field marshaling support into daemon backend
2025-08-29 09:56:45 -07:00
Paweł Gronowski
2937ee5eb1 Merge pull request #50848 from akerouanton/deprecate-ctr-network-fields
api/t/ctr: deprecate NetworkSettingsBase, DefaultNetworkSettings
2025-08-29 16:45:50 +02:00
Akihiro Suda
b98046fa3e Merge pull request #49819 from AkihiroSuda/cgroup1
CI: add oraclelinux-8 for running tests with cgroup v1
2025-08-29 22:45:32 +09:00
Albin Kerouanton
b7c597ec35 api/t/ctr: deprecate DefaultNetworkSettings
This struct is only used to report the networking state for the default
bridge network when the container is connected to it.

It was deprecated in v1.09 (API v1.21), and scheduled for removal in
v1.11. Unfortunately, the deprecation warning was wrongly formatted in
the Go code. However, deprecation warnings are already present in
swagger.yaml, so don't touch it.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-08-29 15:40:45 +02:00
Austin Vazquez
c9fdad2552 daemon: marshal legacy registry.ServiceConfig extra fields for compatability
This change moves the logic that is used to marshal the legacy extra fields for `registry.ServiceConfig` type to the daemon backend.

Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-08-29 08:23:34 -05:00
Albin Kerouanton
d0de293513 testutil/daemon: remove unused FindContainerIP
Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-08-29 15:21:50 +02:00
Albin Kerouanton
80bb864fd6 api/t/ctr: deprecate NetworkSettingsBase
Most fields in NetworkSettingsBase are deprecated, so deprecate the
whole struct. The few fields which aren't deprecated will move to the
NetworkSettings struct in v29.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-08-29 15:21:34 +02:00
Albin Kerouanton
16dc39136c api/t/ctr: deprecate NetworkSettingsBase.Bridge
This field provides little value as it's only set when the daemon is
started with --bridge flag specified, and the inspected container is
connected to the default bridge network.

Unfortunately, there's no equivalent field in NetworkSettings.Networks.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-08-29 15:18:44 +02:00
Paweł Gronowski
20b679b4a6 client: Extract clientConfig for opt applying
Change functional options for the client so that they operate on an
intermediate struct instead of the public `Client` instance directly.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-08-29 15:17:31 +02:00
Paweł Gronowski
9ddf9d87e7 client: Remove newMockClient
All of its usage was replaced by WithMockClient

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-08-29 15:17:31 +02:00
Paweł Gronowski
7cd089edd9 client/volume_test: Use functional option to create mock client
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-08-29 15:17:23 +02:00
Paweł Gronowski
72e11d78d7 client/task_test: Use functional option to create mock client
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-08-29 15:17:23 +02:00
Paweł Gronowski
a1e304f76c client/system_test: Use functional option to create mock client
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-08-29 15:17:23 +02:00
Paweł Gronowski
407af72993 client/swarm_test: Use functional option to create mock client
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-08-29 15:17:23 +02:00
Paweł Gronowski
124bba478a client/service_test: Use functional option to create mock client
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-08-29 15:17:23 +02:00
Paweł Gronowski
98434a5ea4 client/secret_test: Use functional option to create mock client
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-08-29 15:17:23 +02:00
Paweł Gronowski
c99f2eaf34 client/request_test: Use functional option to create mock client
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-08-29 15:17:23 +02:00
Paweł Gronowski
8581a15c25 client/plugin_test: Use functional option to create mock client
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-08-29 15:17:23 +02:00
Paweł Gronowski
0b577c703a client/ping_test: Use functional option to create mock client
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-08-29 15:17:23 +02:00
Paweł Gronowski
d401228b43 client/options_test: Use functional option to create mock client
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-08-29 15:17:23 +02:00
Paweł Gronowski
643e94ebf5 client/node_test: Use functional option to create mock client
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-08-29 15:17:22 +02:00
Paweł Gronowski
5a82c3397e client/network_test: Use functional option to create mock client
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-08-29 15:17:22 +02:00
Paweł Gronowski
be76beee8f client/image_test: Use functional option to create mock client
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-08-29 15:17:22 +02:00
Paweł Gronowski
005a289703 client/distribution_test: Use functional option to create mock client
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-08-29 15:17:22 +02:00
Paweł Gronowski
bc1d436aa9 client/container_test: Use functional option to create mock client
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-08-29 15:17:22 +02:00
Paweł Gronowski
c70aac772e client/config_test: Use functional option to create mock client
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-08-29 15:17:22 +02:00
Paweł Gronowski
6452807fb4 client/client_test: Use functional option to create mock client
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-08-29 15:17:22 +02:00
Paweł Gronowski
a3d073e160 client/checkpoint_test: Use functional option to create mock client
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-08-29 15:17:22 +02:00
Paweł Gronowski
17396e5d94 client: Add WithMockClient opt
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-08-29 15:07:59 +02:00
Akihiro Suda
09ecd74cf3 CI: add oraclelinux-8 for running tests with cgroup v1
Lima is used for running a VM of `template://oraclelinux-8`.

My initial attempt was to use almalinux-8, but some port forwarding tests
do not seem to work on almalinux-8.

https://lima-vm.io/docs/examples/gha/

Fix issue 49576

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2025-08-29 19:04:07 +09:00
Akihiro Suda
1570ca934d Dockerfile: install fuse-overlayfs
Used for rootless on kernel < 5.11

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2025-08-29 19:02:24 +09:00
Akihiro Suda
e15c51a03d Makefile: propagate DOCKER_IGNORE_BR_NETFILTER_ERROR
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2025-08-29 19:02:21 +09:00
Rob Murray
ed78637b9a nftables: iterate over rules
When generating the rules for an nftables chain, rather than collecting
rules into a slice and iterating over that, use an iterator.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-08-29 10:49:14 +01:00
Rob Murray
f164a561ad Merge pull request #50844 from akerouanton/vendor-sctp
vendor: github.com/ishidawataru/sctp v0.0.0-20250829011129-4b890084db30
2025-08-29 09:30:22 +01:00
Rob Murray
4929dce0d1 Merge pull request #50501 from robmry/nftables_interface
Rework the interface to libnet/internal/nftables
2025-08-29 07:49:45 +01:00
Albin Kerouanton
9dc0c094e6 cmd/docker-proxy: set O_NONBLOCK unconditionally
Prior to commit b5bf89c31, all socket fds passed to the docker-proxy
were getting the O_NONBLOCK flag set. However, that commit added support
for SCTP socket-passing, and had to conditionally guard this behavior to
not use it on SCTP sockets due to ishidawataru/sctp not clearing the
flag.

A fix was made in ishidawataru/sctp (see [1]), so we can remove that
condition.

[1]: https://github.com/ishidawataru/sctp/commit/4b890084db30

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-08-29 07:50:48 +02:00
Albin Kerouanton
12897011fa vendor: github.com/ishidawataru/sctp v0.0.0-20250829011129-4b890084db30
full diff: 1989182a94..4b890084db

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-08-29 07:49:37 +02:00
Albin Kerouanton
42ecd9041a Merge pull request #50706 from akerouanton/move-back-fw-setup-into-bridge-driver
libnet/pmapi: let portmappers specify NAT/fwding rules
2025-08-29 07:37:56 +02:00
Rob Murray
785ae9a0f9 Rework the interface to libnet/internal/nftables
Add nftables.Modifier, to hold a queue of commands that can be applied
using Modifier.Apply. No updates are made to the underlying Table
until Apply is called, errors in the queue if commands are deferred
until Apply.

This has the advantages that:
- less error handling is needed in code that generates update commands
- it's transactional, without needing explicit transactions

Minor disadvantages are that it's slightly more difficult to debug updates,
as it's no longer possible to step through the call making an update to
the Table manipulation in a debugger - and errors in the command, and
errors like trying to update a nonexistent chain/set/vmap, deleting an
object that doesn't exist or creating a duplicate are not reported
until the updates are applied (but, the file/line where the rule was
added is reported).

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-08-28 19:27:19 +01:00
Albin Kerouanton
3bee048cbb Merge pull request #50841 from akerouanton/fix-TestUserChain
d/libnet: TestUserChain: fix error matching for nonexistent chains
2025-08-28 19:21:41 +02:00
Cory Snider
cf913f5b0a d/cluster: use lockedManagerAction in more places
A few of the cluster methods contained open-coded copies of
lockedManagerAction. Refactor them to use lockedManagerAction and hoist
the parameter and result processing outside the critical sections.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-08-28 12:20:56 -04:00
Sebastiaan van Stijn
620b93135e Merge pull request #50249 from aaithal/fluent-read-timeout
Add read timeout support for fluentd logger
2025-08-28 18:03:03 +02:00
Cory Snider
4b866fdcef d/cluster: add context param to lockedManagerAction
Every Swarm Cluster API method takes a context parameter. The
lockedManagerAction helper function does not take a context parameter
itself, yet it passes a context parameter into the closure. Add a
context parameter to lockedManagerAction and derive the closure's
context from it to afford deriving the Cluster API method calls'
contexts from some non-background parent context.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-08-28 11:47:52 -04:00
Albin Kerouanton
8839f53175 d/libnet: TestUserChain: fix error matching for nonexistent chains
Debian 13 ships iptables-nft v1.8.11 which returns a different error
than previous versions when doing `iptables -S` for a nonexistent chain.

Older versions:

    ip6tables v1.8.9 (nf_tables): chain `<chain>' in table `filter' is incompatible, use 'nft' tool.

Newer versions:

    ip6tables: No chain/target/match by that name.

Bisecting iptables-nft, this change was introduced by [1] which was
released in v1.8.10.

Pick the expected error message based on iptables-nft version.

[1]: https://git.netfilter.org/iptables/commit/?id=82ccfb488eeac5507471099b9b4e6d136cc06e3b

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-08-28 17:41:49 +02:00
Albin Kerouanton
49d20c065e Merge pull request #50745 from akerouanton/iptablesdoc-drop-numerical-flag
{ip,nf}tablesdoc: ensure format compatibility across Debian versions
2025-08-28 16:55:52 +02:00
Albin Kerouanton
fbde2bcb9a nftabler,nftablesdoc: stringify numerical dstnat prio
When nftablesdoc tests dump the state of nftables, the argument '-y' /
'--numeric-priority' isn't used, so all priorities should be
stringified. However, there's a bug in older versions of nftables that
prevents the stringification of the 'dstnat' priority — it's currently
dumped as '-100'.

New versions fix that, and thus running these tests on Debian 13 fails
because of this discrepancy with golden files.

So, look for 'type nat hook output priority -100' and stringify the
priority to ensure compatibility across versions of nft.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-08-28 14:38:21 +02:00
Albin Kerouanton
a4949b669e iptablesdoc: remove -n from iptables -L invocations
The output of `iptables -nvL` has changed in Debian 13 — the proto
column now shows protocol names instead of numbers, even when `-n` is
specified. This breaks the iptablesdoc golden files, which expect
protocols to be represented numerically.

This change comes from 34f085b1607364f4eaded1140060dcaf965a2649 in repo
git.netfilter.org/iptables (see [1]), which is a revert of
da8ecc62dd765b15df84c3aa6b83dcb7a81d4ffa (see [2]), and was made to
address a bug report (see [3]).

Unfortunately, this means there's a drift between iptables versions. So,
remove the `-n` flag altogether to ensure that the iptablesdoc tests
pass everywhere.

[1]: https://git.netfilter.org/iptables/commit/?id=da8ecc62dd765b15df84c3aa6b83dcb7a81d4ffa
[2]: https://git.netfilter.org/iptables/commit/?id=34f085b1607364f4eaded1140060dcaf965a2649
[3]: https://bugzilla.netfilter.org/show_bug.cgi?id=1729

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-08-28 14:38:20 +02:00
Sebastiaan van Stijn
e6c1660dda Merge pull request #50725 from dmcgowan/fix-containerd-prune-events
Fix image prune events for containerd backend
2025-08-28 13:54:41 +02:00
Sebastiaan van Stijn
ed61fba921 Merge pull request #50833 from thaJeztah/bump_go_events
vendor: github.com/docker/go-events 605354379745 (main)
2025-08-28 13:40:01 +02:00
Albin Kerouanton
fc045ad139 libnet/pmapi: remove firewaller arg from Map/UnmapPorts
Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-08-28 11:47:29 +02:00
Albin Kerouanton
9b1c4ad3b1 libnet/pm/routed: don't set up firewall rules directly
Instead of setting up firewall rules directly in the routed port mapper,
we now rely on the bridge driver to handle firewall reconfiguration.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-08-28 11:47:26 +02:00
Albin Kerouanton
9d9b05446c libnet/pm/nat: move back fw / proxy steps into the bridge driver
Since commit 4e246efcd, individual portmappers are responsible for
setting up firewall rules and proxying according to their needs.

This change moves the responsibility back to the bridge driver, removing
unnecessary code duplication across portmappers. For now, only the nat
portmapper takes advantage of this.

This partially reverts commit 4e246efcd.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-08-28 11:47:24 +02:00
Albin Kerouanton
429110ebef Merge pull request #50819 from akerouanton/firewalld-ci
hack/make/test-integration: disable firewalld integration
2025-08-28 10:44:07 +02:00
Albin Kerouanton
268e636b2b libnet/pmapi: let portmappers specify NAT/fwding rules
Add two new fields to portmapperapi.PortBinding: NAT and Forwarding.
These can be used by portmappers to specify how they want their callers
(e.g. bridge driver) to reconfigure the host firewall to NAT a host
port, or allow forwarding to the container port.

If portmappers don't want to opt-in to these, they can implement their
own firewall rules, and not fill these fields.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-08-28 09:30:17 +02:00
Olli Janatuinen
c6717f4387 libnetwork: provide endpoint name for IPAM drivers
Signed-off-by: Olli Janatuinen <olli.janatuinen@gmail.com>
2025-08-28 00:20:34 -07:00
Austin Vazquez
6f6d18865a Merge pull request #50775 from thaJeztah/bump_buildkit_v0.24
vendor: github.com/moby/buildkit v0.24.0-rc1
2025-08-27 16:49:35 -07:00
Sebastiaan van Stijn
5349095cd1 vendor: github.com/docker/go-events 605354379745 (main)
full diff: c867878c5e...6053543797

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-28 01:16:52 +02:00
Sebastiaan van Stijn
229a29649f vendor: github.com/moby/buildkit v0.24.0-rc1
full diff: https://github.com/moby/buildkit/compare/v0.23.2...v0.24.0-rc1

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-28 00:12:05 +02:00
Albin Kerouanton
d0d3de04ff Merge pull request #50801 from akerouanton/move-golden-files
d/libnet: move golden files into subdirs
2025-08-27 22:01:57 +02:00
Rob Murray
32c3bedab6 Merge pull request #50827 from robmry/unmap_endpoint_addresses
Unmap IPv4 addresses loaded from store
2025-08-27 19:46:27 +01:00
Austin Vazquez
38be9f1257 Merge pull request #50824 from thaJeztah/fix_shadow
ImageCache.restoreCachedImage: rename var that shadowed import
2025-08-27 10:54:48 -07:00
Rob Murray
071e6472db Unmap IPv4 addresses loaded from store
When a endpoint's net.IPNet is loaded from store and converted
to a netip.Addr, unmap it so that iptables rules don't contain
IPv4-mapped IPv6 addresses.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-08-27 18:16:15 +01:00
Austin Vazquez
b721c4f4a8 daemon: minor touchups for backend system info response marshal
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-08-27 11:01:14 -05:00
Austin Vazquez
8ac1bfa6c5 Merge pull request #50817 from austinvazquez/move-network-options-from-api-to-client
api/types/network: move network create/connect/disconnect options from api to client
2025-08-27 07:27:37 -07:00
Albin Kerouanton
60c6e57b82 hack/make/test-integration: disable firewalld integration
The daemon started by the test-integration script needs to run without
firewalld integration to make sure that daemons started by networking
tests will handle firewalld reload without any interference (i.e.
without another daemon racing against them to recreate the iptables
chains).

Most tests are already running their own daemons, but the few that don't
and need firewalld integration are updated to start their own.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-08-27 16:12:04 +02:00
Austin Vazquez
1b4fcb8da7 api/types/network: move CreateOptions type to client module
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-08-27 08:10:20 -05:00
Sebastiaan van Stijn
b0b7260c77 ImageCache.restoreCachedImage: rename var that shadowed import
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-27 14:35:16 +02:00
Austin Vazquez
1e249cc309 api/types/network: move connect/disconnect options types to client module
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-08-27 07:05:52 -05:00
Paweł Gronowski
ed8a6a89ca Merge pull request #50809 from thaJeztah/container_inspect_merge
api/types/container: merge InspectResponse and ContainerJSONBase
2025-08-27 12:26:19 +02:00
Rob Murray
657f55a0a6 Merge pull request #50815 from akerouanton/drop-ipamOptions-from-CreateOptionIpam
d/libnet: remove unused arg from CreateOptionIpam
2025-08-27 10:06:58 +01:00
Akihiro Suda
0e7e1d37ac Merge pull request #50807 from thaJeztah/simplify_dev_env
docs/contributing: minor fixes
2025-08-27 17:46:06 +09:00
Sebastiaan van Stijn
6288414110 Merge pull request #50776 from austinvazquez/move-image-options-from-api-to-client
api/types/image: move image options from api to client
2025-08-27 00:45:28 +02:00
Albin Kerouanton
3003c5fe45 d/libnet: fix CreateOptionIPAM capitalization
Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-08-27 00:18:46 +02:00
Austin Vazquez
f6bfce8f06 Merge pull request #50816 from austinvazquez/move-swarm-secrets-list-options-to-client
api/types/swarm: move `SecretListOptions` type to client
2025-08-26 13:56:34 -07:00
Austin Vazquez
853aed171b api/types/image: move image option types to client
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-08-26 15:38:44 -05:00
Austin Vazquez
33066cddb1 api/types/swarm: move SecretListOptions type to client
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-08-26 14:15:35 -05:00
Sebastiaan van Stijn
33cdcd62f5 daemon: Daemon.getInspectData: also set Config
Now that the types are merged, we can also set the config in this
function while the container state is locked.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-26 20:19:02 +02:00
Sebastiaan van Stijn
fae54e03af api/types/container: merge InspectResponse and ContainerJSONBase
Merge the two types instead of embedding the ContainerJSONBase.
This should have no impact on the API response, but users constructing
a response through struct literals will need to update their code.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-26 20:18:57 +02:00
Sebastiaan van Stijn
835afb123a Merge pull request #50813 from thaJeztah/fix_vendor
fix vendor
2025-08-26 20:18:36 +02:00
Albin Kerouanton
c9a0c93b04 d/libnet: remove unused arg from CreateOptionIpam
CreateOptionIpam takes an `ipamOptions` argument, but all callers are
passing nil. So, remove it.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-08-26 20:15:24 +02:00
Sebastiaan van Stijn
b85c91f1b8 fix vendor
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-26 20:07:03 +02:00
Sebastiaan van Stijn
7145e7666b Merge pull request #50794 from austinvazquez/move-swarm-option-types-to-client
api/types/swarm: move swarm option types to client
2025-08-26 18:44:02 +02:00
Sebastiaan van Stijn
e317661b0c Merge pull request #50785 from austinvazquez/move-auth-config-functions-from-types
api/types/registry: move auth config functions to pkg
2025-08-26 18:39:24 +02:00
Sebastiaan van Stijn
2677aa6437 Merge pull request #50810 from thaJeztah/inspect_no_shadow
daemon: Daemon.getInspectData: inline struct-literals
2025-08-26 18:01:13 +02:00
Sebastiaan van Stijn
1dace990d9 Merge pull request #50798 from thaJeztah/readers_digest
client: check for Digested reference instead of Canonical
2025-08-26 17:02:43 +02:00
Sebastiaan van Stijn
44972d7427 daemon: Daemon.getInspectData: inline struct-literals
Also rename the "container" argument, which shadowed an import.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-26 15:19:26 +02:00
Austin Vazquez
94d0b10503 api/types/swarm: move ServiceInspectOptions type to client
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-08-26 07:21:46 -05:00
Austin Vazquez
a2291e5eac api/types/swarm: move ServiceListOptions type to client
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-08-26 07:21:40 -05:00
Austin Vazquez
3b1e16594b api/types/swarm: move ServiceUpdateOptions type to client
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-08-26 07:21:33 -05:00
Austin Vazquez
bb4125e89f api/types/swarm: move ServiceCreateOptions type to client
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-08-26 07:21:33 -05:00
Austin Vazquez
4dcc7af116 api/types/swarm: move UpdateFlags type to client
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-08-26 07:21:23 -05:00
Austin Vazquez
ad0fa5a872 api/types/swarm: move TaskListOptions type to client
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-08-26 07:21:17 -05:00
Austin Vazquez
2718f953f0 api/types/swarm: move NodeRemoveOptions to client
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-08-26 07:21:17 -05:00
Austin Vazquez
7d2b87e95f api/types/swarm: move NodeListOptions to client mod
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-08-26 07:21:12 -05:00
Austin Vazquez
b1260cd493 api/types/swarm: move ConfigListOptions to client
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-08-26 07:21:05 -05:00
Austin Vazquez
bdce1608c8 api: move authconfig package from types/registry to pkg
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-08-26 07:17:45 -05:00
Sebastiaan van Stijn
ff0e644c88 daemon/cluster: use authconfig package for decoding
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-26 07:16:28 -05:00
Sebastiaan van Stijn
9f1d8be252 docs/contributing: minor fixes
- Remove mention of `BIND_DIR` as it's no longer needed
- Update some links to files that were moved

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-26 13:14:36 +02:00
Sebastiaan van Stijn
531be96bf9 Merge pull request #50800 from thaJeztah/rm_error_convert
daemon/containerd: remove convertError utility
2025-08-25 13:34:09 +02:00
Paweł Gronowski
f5df9eea84 Merge pull request #50796 from thaJeztah/sync_api_docs
api: docs: update v1.52 swagger with latest changes
2025-08-25 13:27:17 +02:00
Anirudh Aithal
dbe19a506e fluentd logger: add read timeout configuration.
Adds a new configuration to specify a read timeout for acks. Fluentd can
be configured to expect acks from the server. In such scenarios, this
configuration enables clients to timeout the read operation if the
server or the connection is unresponsive. The default behavior of
waiting forever remains unchanged.

Signed-off-by: Anirudh Aithal <aithal@amazon.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-25 12:46:10 +02:00
Anirudh Aithal
28ba0fcaae vendor: github.com/fluent/fluent-logger-golang v1.10.1
full diff: https://github.com/fluent/fluent-logger-golang/compare/v1.9.0...v1.10.1

Update fluent-logger-golang to its latest release. This brings in a
number of changes including the ability to configure a read timeout
and some thread safety improvements.

Signed-off-by: Anirudh Aithal <aithal@amazon.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-25 12:46:01 +02:00
Sebastiaan van Stijn
3bcaf1c4da vendor: github.com/tinylib/msgp v1.3.0
full diff: https://github.com/tinylib/msgp/compare/v1.1.8...v1.3.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-25 12:38:41 +02:00
Sebastiaan van Stijn
27b609b401 vendor: github.com/philhofer/fwd v1.2.0
full diff: https://github.com/philhofer/fwd/compare/v1.1.2...v1.2.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-25 12:37:53 +02:00
Albin Kerouanton
1d6c7663c4 d/libnet/i/nftables: move golden files into subdir
Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-08-25 10:48:46 +02:00
Albin Kerouanton
28afa75c39 d/libnet: TestIptabler: move golden files into subdir
Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-08-25 10:48:41 +02:00
Albin Kerouanton
ce4a331287 d/libnet: TestNftabler: move golden files into subdir
Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-08-25 10:48:21 +02:00
Sebastiaan van Stijn
c5e75cc485 daemon/containerd: remove convertError utility
The containerd errors and related containerd/errdefs should now
be interchangeable with moby/errdefs, so there's no longer a need
to convert these errors.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-23 21:45:10 +02:00
Sebastiaan van Stijn
6fbea5f5c1 image delete: inline some variables, and touch-up TODOs
- inline / scope some variables
- touch up various TODOs to help find back context

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-23 18:34:05 +02:00
Sebastiaan van Stijn
7f8ce05f6e client: check for Digested reference instead of Canonical
The [Canonical] interface defines images that are both [Named] and
[Digested], but in all places where it was used, we were only interested
whether the reference contained a digest.

This patch changes those checks to check for [Digested] references, as
that's what's relevant for these checks.

[Named]: https://pkg.go.dev/github.com/distribution/reference#Named
[Canonical]: https://pkg.go.dev/github.com/distribution/reference#Canonical
[Digested]: https://pkg.go.dev/github.com/distribution/reference#Digested

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-23 18:02:50 +02:00
Sebastiaan van Stijn
414e5f3b3d Merge pull request #50792 from thaJeztah/fix_email_deprecation
api/types/registry: update deprecation comment for AuthConfig.Email
2025-08-23 00:18:52 +02:00
Sebastiaan van Stijn
eed354379c api: docs: update v1.52 swagger with latest changes
follow-up to 48038347d7, which was
merged after the (not yet relased) v1.52 docs were created.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-23 00:05:19 +02:00
Sebastiaan van Stijn
41dd811926 Merge pull request #50795 from thaJeztah/bump_rootlesskit
update rootlesskit to v2.3.5
2025-08-22 23:27:49 +02:00
Sebastiaan van Stijn
b3a701a8a1 Merge pull request #50786 from austinvazquez/move-network-options-from-api-to-client
api/types/network: move network options from api to client
2025-08-22 23:19:31 +02:00
Sebastiaan van Stijn
0de3d2ec51 Dockerfile: update rootlesskit to v2.3.5
full diff: https://github.com/rootless-containers/rootlesskit/compare/v2.3.4...v2.3.5

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-22 21:32:31 +02:00
Sebastiaan van Stijn
70d096313f vendor: github.com/rootless-containers/rootlesskit/v2 v2.3.5
full diff: https://github.com/rootless-containers/rootlesskit/compare/v2.3.4...v2.3.5

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-22 21:31:10 +02:00
Sebastiaan van Stijn
aadb486522 Merge pull request #50727 from thaJeztah/frozen_trixie
Dockerfile: update debian frozen image to trixie-slim
2025-08-22 16:51:03 +02:00
Austin Vazquez
fe8516cf4b client: refactor InspectOptions to NetworkInspectOptions
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-08-22 09:38:53 -05:00
Austin Vazquez
5eaed0366c api/types/network: move InspectOptions to client mod
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-08-22 09:38:53 -05:00
Austin Vazquez
6084c6ae78 client: refactor ListOptions to NetworkListOptions
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-08-22 09:38:53 -05:00
Austin Vazquez
d6aa6ae9bd api/types/network: move ListOptions to client
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-08-22 09:38:47 -05:00
Sebastiaan van Stijn
d867f9f0f1 api/docs: update description for AuthConfig.Email field
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-22 14:19:13 +02:00
Sebastiaan van Stijn
6cfff7e880 api/types/registry: update deprecation comment for AuthConfig.Email
The Email field was originally used to create a new Docker Hub account
through the `docker login` command. The `docker login` command could be
used both to log in to an existing account (providing only username and
password), or to create a new account (providing desired username and
password, and an e-mail address to use for the new account).

This functionality was confusing, because it was implemented when Docker
Hub was the only registry, but the same functionality could not be used
for other registries. This functionality was removed in Docker 1.11 (API
version 1.23) through [moby@aee260d], which also removed the Email field
([engine-api@9a9e468]) as it was no longer used.

However, this caused issues when using a new CLI connecting with an old
daemon, as the field would no longer be serialized, and the deprecation
may not yet be picked up by custom registries, so [engine-api@167efc7]
added the field back, deprecated it, and added an "omitempty". There
was no official "deprecated" format yet at the time, so let's make sure
the deprecation follows the proper format to make sure it gets noticed.

[moby@aee260d]: aee260d4eb
[engine-api@9a9e468]: 9a9e468f50
[engine-api@167efc7]: 167efc72bb

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-22 14:18:19 +02:00
Paweł Gronowski
7d65b67668 Merge pull request #50783 from thaJeztah/bump_bbolt
vendor: go.etcd.io/bbolt v1.4.3
2025-08-22 14:06:04 +02:00
Paweł Gronowski
7c1ccb2c9a Merge pull request #50784 from thaJeztah/bump_x_sync
vendor: golang.org/x/sync v0.16.0
2025-08-22 14:05:48 +02:00
Sebastiaan van Stijn
51a2d6c80f Merge pull request #50787 from austinvazquez/move-registry-search-options-to-client
api/types/registry: move registry search options to client
2025-08-22 12:02:05 +02:00
Sebastiaan van Stijn
35a36ce058 Merge pull request #50789 from austinvazquez/move-volume-list-options-from-api-to-client
api/types/volume: move volume list options from api to client
2025-08-22 12:00:50 +02:00
Sebastiaan van Stijn
3dd85da3dc Merge pull request #50788 from austinvazquez/move-system-types-from-api-to-client
api/types/system: move `DiskUsageOptions` to client mod
2025-08-22 10:29:12 +02:00
Austin Vazquez
7aa50424e3 daemon: decouple daemon backend from client volume list options
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-08-21 21:58:52 -05:00
Austin Vazquez
9fc6a1e437 api/types/volume: refactor volume options to prune report
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-08-21 21:52:19 -05:00
Austin Vazquez
ee22a62dd5 client: refactor ListOptions to VolumeListOptions
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-08-21 21:47:59 -05:00
Austin Vazquez
c48585f104 api/types/volume: move ListOptions to client mod
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-08-21 21:46:19 -05:00
Austin Vazquez
56626a1222 api/types/system: move DiskUsageOptions to client mod
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-08-21 21:26:55 -05:00
Austin Vazquez
4665aa11ce client: refactor SearchOptions to ImageSearchOptions
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-08-21 21:17:54 -05:00
Austin Vazquez
40025bdf43 api/types/registry: move SearchOptions to client
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-08-21 21:15:21 -05:00
Sebastiaan van Stijn
e8d0aba254 vendor: golang.org/x/sync v0.16.0
full diff: https://github.com/golang/sync/compare/v0.14.0...v0.16.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-22 00:56:08 +02:00
Sebastiaan van Stijn
60125b888c contrib: update dockerfiles to debian 13 "trixie"
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-21 23:37:14 +02:00
Sebastiaan van Stijn
39d4dbea9c Dockerfile: update debian frozen image to trixie-slim
docker buildx imagetools inspect docker.io/library/debian:trixie-slim
    Name:      docker.io/library/debian:trixie-slim
    MediaType: application/vnd.oci.image.index.v1+json
    Digest:    sha256:c85a2732e97694ea77237c61304b3bb410e0e961dd6ee945997a06c788c545bb

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-21 23:35:26 +02:00
Sebastiaan van Stijn
15f92925f0 vendor: go.etcd.io/bbolt v1.4.3
Fix potential data corruption in (*Tx)WriteTo if underlying db file
is overwritten

full diff: https://github.com/etcd-io/bbolt/compare/v1.4.2...v1.4.3

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-21 23:05:05 +02:00
Austin Vazquez
ea126c0541 Merge pull request #50760 from vvoland/c8d-default-notsomuch
daemon: Fix forceful switch to containerd image store
2025-08-21 12:26:35 -07:00
Austin Vazquez
feee8fab15 Merge pull request #50774 from austinvazquez/move-events-list-options-from-api-to-client
api/types/events: move events list options from api to client
2025-08-21 11:26:32 -07:00
Paweł Gronowski
f0da9ae801 Merge pull request #50773 from austinvazquez/move-container-resize-options-from-api-to-client
api/types/container: move container resize options from api to client
2025-08-21 20:19:01 +02:00
Sebastiaan van Stijn
036c067c80 Merge pull request #50759 from thaJeztah/deprecate_old_stream_fields
client/pkg/jsonmessage: remove unused fields
2025-08-21 16:57:39 +02:00
Albin Kerouanton
18651d8819 Merge pull request #50691 from akerouanton/portallocator-socket-filter
libnet/pa: OSAllocator: retry allocations
2025-08-21 11:50:57 +02:00
Austin Vazquez
4774fb2c11 Merge pull request #50767 from thaJeztah/stats_cleanups
daemon: Daemon.ContainerStats: small cleanups
2025-08-20 15:25:42 -07:00
Cory Snider
f445d26d68 Merge pull request #50724 from corhere/libn/bitmap-onescount
daemon/libnetwork/bitmap: add OnesCount method
2025-08-20 17:45:18 -04:00
Sebastiaan van Stijn
c8c4996ebf Merge pull request #50764 from austinvazquez/move-disk-usage-types-to-daemon-backend
api/types: move disk usage structs to daemon backend
2025-08-20 18:33:54 +02:00
Austin Vazquez
eb9774cbf9 client: rename ListOptions type to EventsListOptions
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-08-20 08:31:04 -05:00
Austin Vazquez
d73dd4990c api/types/events: move ListOptions type to client
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-08-20 08:29:20 -05:00
Austin Vazquez
db72cc28c7 Rename test helper function input parameters to not shadow client package
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-08-20 08:27:42 -05:00
Austin Vazquez
f07d359043 client: rename ResizeOptions type to ContainerResizeOptions
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-08-20 07:41:57 -05:00
Austin Vazquez
882fd68b1b api/types/container: move ResizeOptions type to client
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-08-20 07:40:18 -05:00
Albin Kerouanton
14262696d7 libnet/pa: OSAllocator: retry allocations
Previous commit changed the OSAllocator to listen after binding a port,
such that we're 100% sure that the port is free. We can now make the
OSAllocator responsible for retrying port allocations when it tries to
find an ephemeral port, or a free port in a range.

Move the retry logic from the 'nat' portmapper to the OSAllocator.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-08-20 12:02:34 +02:00
Albin Kerouanton
201968cc03 libnet/pa: OSAllocator: listen after bind
Move the listen syscall to the `OSAllocator` such that when
`RequestPortsInRange` returns, callers are guaranteed that the allocated
port isn't used by another process.

Bind and listen syscalls were previously split because listening before
inserting DNAT rules could cause connections to be accepted by the
kernel, so packets would never be forwarded to the container.

But, pulling them apart has an undesirable drawback: if another process
is racing against the Engine, and starts listening on the same port,
the conflict wouldn't be detected until OSAllocator's callers issue a
'listen' syscall. This means that callers need to implement their own
retry logic.

To overcome both drawbacks, set a cBPF socket filter on the socket
before it's bound, and let callers call `DetachSocketFilter` to remove
it. Now, callers are guaranteed that the port is free to use, and no
connections will be accepted prematurely.

For TCP / SCTP clients, this means that they'll send the first handshake
packet (e.g. SYN), but the kernel won't reply (e.g. SYN-ACK), and they
will retry until DNAT rules are configured or the socket filter is
removed.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-08-20 12:02:04 +02:00
Paweł Gronowski
86ae7a56d2 daemon: Fix container restore with automatic driver selection
Fix a bug causing containers not being loaded when storage driver wasn't
chosen explicitly.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-08-20 11:20:51 +02:00
Paweł Gronowski
555e3939c9 daemon: Fix forceful switch to containerd image store
When no explicit driver was specified, the containerd store by default
was also applied to existing graphdriver setups.

Fix this and add a test.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-08-20 11:20:50 +02:00
Albin Kerouanton
0476bb6d55 Merge pull request #50747 from thaJeztah/TestUserChain_golden
daemon/libnetwork: TestUserChain: rename golden files
2025-08-20 11:04:45 +02:00
Sebastiaan van Stijn
47bdbf5a4b client/pkg/jsonmessage: remove unused fields
The JSONMessage struct contained fields that were previously used to produce the
`/events` response. However, commit 72f1881df1
introduced an events.Message type that replaced the use of JSONMessage for
that purpose, and clients no longer use the JSONMessage struct to unmarshal
those responses.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-19 17:55:01 +02:00
Sebastiaan van Stijn
fc19151a77 Merge pull request #48733 from thaJeztah/remove_TestEventsBackwardsCompatible
integration/system: remove TestEventsBackwardsCompatible, add TestEventsNonBlocking
2025-08-19 17:53:49 +02:00
Austin Vazquez
c4e82bab70 api/types/volume: move DiskUsage type internal to daemon backend
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-08-19 08:12:34 -05:00
Austin Vazquez
0d61b55add api/types/image: move DiskUsage type internal to daemon backend
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-08-19 08:08:34 -05:00
Austin Vazquez
566c44edfe api/types/container: move DiskUsage type internal to daemon backend
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-08-19 07:59:46 -05:00
Austin Vazquez
d588092be2 api/types/build: move internal to daemon backend
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-08-19 07:56:23 -05:00
Sebastiaan van Stijn
eac4c43aaa integration/system: remove TestEventsBackwardsCompatible
This test was added in 72f1881df1, which
introduced a dedicated `events.Message` struct for the events endpoints.
Before that change, events would produce a generic `JSONMessage`, and
the test is to verify that an `events.Message` could be successfully
unmarshalled to a `JSONMessage`.

The change above was part of docker 1.10 (API version 1.22), which we
no longer support, so we can remove this test.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-19 13:27:33 +02:00
Sebastiaan van Stijn
b0d9a90f45 integration/system: add TestEventsNonBlocking
This adds the "non-blocking" part of the TestEventsBackwardsCompatible
as a separate test, as it's not related to the backward-compatibility
part of that test.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-19 13:27:29 +02:00
Sebastiaan van Stijn
000f5e8d10 daemon: Daemon.ContainerStats: small cleanups
- Check config.Stream before checking container state
- Inline json-encode where used

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-19 13:21:54 +02:00
Albin Kerouanton
b8897d91db Merge pull request #50748 from thaJeztah/generated_markdown
integration/network/bridge: add "generated" header to markdown docs
2025-08-18 18:22:18 +02:00
Paweł Gronowski
eac4ea3e58 Merge pull request #50756 from thaJeztah/daemon_events_filter
daemon/server/router/system: getEvents: use event consts for filtering
2025-08-18 15:54:45 +02:00
Sebastiaan van Stijn
f4ae01a38a daemon/server/router/system: getEvents: use event consts for filtering
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-18 13:00:42 +02:00
Paweł Gronowski
cd844fd0b2 Merge pull request #50746 from akerouanton/fix-hack-test-unit
hack/test/unit: use empty default values
2025-08-18 10:12:45 +02:00
Sebastiaan van Stijn
6b52a16f14 integration/network/bridge: add "generated" header to markdown docs
We can't add it to the templates, because those are not generated,
so adding it in the code that uses the templates, and prepend the
header before handling the template.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-16 17:32:29 +02:00
Sebastiaan van Stijn
48557f72f9 daemon/libnetwork: TestUserChain: rename golden files
- Use a subdirectory for all files used in the test
- Add a .golden file-extension for easier discovery of generated files

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-16 15:18:22 +02:00
Albin Kerouanton
ff8364a39f hack/test/unit: use empty default values
Commit 8013d80c2 updated the hack/test/unit script to ensure that tests
are run against the right module when TESTDIRS is specified. But there's
an issue with this commit: the script has `set -u` (i.e. 'nounset'), and
some variables are set conditionally, but checked unconditionally, so it
fails.

Fix it by defining those vars to empty strings.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-08-16 09:12:56 +02:00
Sebastiaan van Stijn
a34c4d9bb9 Merge pull request #50723 from thaJeztah/api_bump_go_cmp
api: bump github.com/google/go-cmp v0.7.0
2025-08-14 23:05:28 +02:00
Sebastiaan van Stijn
2a5e1acc5e Merge pull request #50743 from thaJeztah/fix_vendor
fix vendor
2025-08-14 22:19:58 +02:00
Sebastiaan van Stijn
fbd3cdc007 fix vendor
follow-up to 48038347d7, which updated
these files but didn't re-vendor.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-14 22:04:31 +02:00
Sebastiaan van Stijn
b2b740a79b Merge pull request #50736 from thaJeztah/less_cgo
Dockerfile: disable CGO for building utilities, and remove trailing slashes for GOBIN
2025-08-14 21:36:46 +02:00
Derek McGowan
da2b1a2930 Fix image prune events for containerd backend
Ensure events for containerd backend are properly sent when deleted via
image prune. Fix prune output to only show deleted images rather than
the deletion of each blob.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-08-14 12:05:08 -07:00
Sebastiaan van Stijn
6a55515a49 Merge pull request #50719 from akerouanton/deprecate-legacy-links-env-vars
daemon: deprecate env vars set by legacy links
2025-08-14 20:31:55 +02:00
Sebastiaan van Stijn
b87b7c5c6e Merge pull request #50717 from elezar/match-on-device-driver-name
Match device driver on name and ignore capabilities
2025-08-14 20:20:19 +02:00
Sebastiaan van Stijn
47f869557a Merge pull request #50731 from vvoland/gha-validate-only
gha: Add conditional skip for jobs with 'ci/validate-only' label
2025-08-14 20:09:14 +02:00
Sebastiaan van Stijn
406c138960 Merge pull request #50721 from thaJeztah/fix_unit_script_carry
hack/test/unit: run in the right module when TESTDIRS is used (carry 50673)
2025-08-14 19:47:30 +02:00
Sebastiaan van Stijn
194aabf285 Merge pull request #50730 from tiago-teixeira5/fix-push-wo-auth
daemon/router/image: initialize default authConfig
2025-08-14 18:52:43 +02:00
Cory Snider
b68ff62ab7 daemon/libnetwork/bitmap: add OnesCount method
Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-08-14 12:17:45 -04:00
Austin Vazquez
823f61a9b5 Merge pull request #50722 from austinvazquez/deconstruct-api-types-time
Copy the api/types/time package to internal client/daemon packages
2025-08-14 08:03:03 -07:00
Sebastiaan van Stijn
be7a769b69 Dockerfile: disable CGO for building utilities
Debian trixie is slimmed down, causing failures, but we probably don't
need CGO at all for these, so just disable it;

    > [swagger 2/2] RUN --mount=type=cache,target=/root/.cache/go-build,id=swagger-build-linux/arm64     --mount=type=cache,target=/go/pkg/mod     --mount=type=tmpfs,target=/go/src/ <<EOT (set -e...):
    12.22 go: downloading github.com/magiconair/properties v1.8.7
    12.29 go: downloading github.com/pelletier/go-toml/v2 v2.1.1
    12.44 go: downloading github.com/mitchellh/reflectwalk v1.0.2
    13.76 go: downloading golang.org/x/mod v0.17.0
    95.08 # github.com/go-swagger/go-swagger/cmd/swagger
    95.08 /usr/local/go/pkg/tool/linux_arm64/link: running aarch64-linux-gnu-gcc failed: exit status 1
    95.08 /usr/bin/aarch64-linux-gnu-gcc -Wl,-z,now -Wl,-z,nocopyreloc -fuse-ld=gold -Wl,--build-id=0xfd69e82d4bb4563abaec0df02ad550f5a6254e10 -o $WORK/b001/exe/a.out -rdynamic /tmp/go-link-2728250351/go.o /tmp/go-link-2728250351/000000.o /tmp/go-link-2728250351/000001.o /tmp/go-link-2728250351/000002.o /tmp/go-link-2728250351/000003.o /tmp/go-link-2728250351/000004.o /tmp/go-link-2728250351/000005.o /tmp/go-link-2728250351/000006.o /tmp/go-link-2728250351/000007.o /tmp/go-link-2728250351/000008.o /tmp/go-link-2728250351/000009.o /tmp/go-link-2728250351/000010.o /tmp/go-link-2728250351/000011.o /tmp/go-link-2728250351/000012.o /tmp/go-link-2728250351/000013.o /tmp/go-link-2728250351/000014.o /tmp/go-link-2728250351/000015.o /tmp/go-link-2728250351/000016.o /tmp/go-link-2728250351/000017.o /tmp/go-link-2728250351/000018.o /tmp/go-link-2728250351/000019.o /tmp/go-link-2728250351/000020.o /tmp/go-link-2728250351/000021.o -O2 -g -lresolv -O2 -g -ldl -O2 -g -lpthread
    95.08 collect2: fatal error: cannot find 'ld'
    95.08 compilation terminated.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-14 15:42:17 +02:00
Sebastiaan van Stijn
8de606beb1 Dockerfile: remove trailing slashes for GOBIN
It should be specified without (but works when included).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-14 15:39:33 +02:00
Austin Vazquez
aa80ad2572 Copy the daemon/internal/timestamp package to internal client package
This change copies the daemon/internal/timestamp package (previously api/types/time) to an internal client package and updates the client usage for GetTimestamp functionality.

Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-08-14 07:57:41 -05:00
Austin Vazquez
812aa46d81 Move the api/types/time package to internal daemon package
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-08-14 07:56:59 -05:00
Tiago Teixeira
033ec8be44 daemon/router/image: initialize default authConfig
Signed-off-by: Tiago Teixeira <tiago.teixeira@ecorobotix.com>
2025-08-14 14:24:43 +02:00
Paweł Gronowski
f0c069ffc9 gha: Add conditional skip for jobs with 'ci/validate-only' label
This change adds conditional logic to skip build and test jobs when a
pull request is labeled with 'ci/validate-only'.

The `govulncheck` job in the CI workflow is intentionally excluded from
this conditional logic, ensuring security vulnerability checks always
run regardless of the label.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-08-14 14:21:38 +02:00
Paweł Gronowski
9bf1d7e2a6 Merge pull request #50728 from vvoland/gha-changelog-kind
.github/workflows: Add kind label validation to PR workflow
2025-08-14 13:37:37 +02:00
Albin Kerouanton
8013d80c24 hack/test/unit: run in the right module when TESTDIRS is used
Since 'api/' and 'client/' are separate Go modules, tests need to be run
separately in each module. Commit 900a0516d changed the hack/test/unit
script to account for that.

But since that commit, if that script is invoked with TESTDIRS set, it
will try every module instead of locating the one containing TESTDIRS.

When trying to run tests that are within one of the modules (`api`, `client`),
Go may find the test while listing (`go -C api list ./pkg/...`);

    go -C api list ./pkg/...
    github.com/moby/moby/api/pkg/progress
    github.com/moby/moby/api/pkg/stdcopy
    github.com/moby/moby/api/pkg/streamformatter

But when running tests from outside the module directory, it may use the
vendor directory, and find no tests to run;

    go test -count 1 -run TestValidateRestartPolicy github.com/moby/moby/api/types/container
    ?   	github.com/moby/moby/api/types/container	[no test files]

To fix this, there's two options; we can first change to the respective
module's directory so that `go test` is run from within the module's context;

    go -C api test -count 1 -run TestValidateRestartPolicy github.com/moby/moby/api/types/container
    ok  	github.com/moby/moby/api/types/container	0.003s

Or, to avoid having to change the directory, we can use `-mod=readonly` or
`-mod=mod`. From the Go documentation https://golang.org/ref/mod:

> - `-mod=mod` tells the go command to ignore the vendor directory and to
>   automatically update `go.mod`, for example, when an imported package
>   is not provided by any known module.
> - `-mod=readonly` tells the go command to ignore the vendor directory
>   and to report an error if `go.mod` needs to be updated.

With that option set, the tests are run;

    go test -mod=readonly -count 1 -run TestValidateRestartPolicy github.com/moby/moby/api/types/container
    ok  	github.com/moby/moby/api/types/container	0.003s

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-14 13:12:53 +02:00
Paweł Gronowski
97587945ef .github/workflows: Add kind label validation to PR workflow
The PR validation workflow now enforces that every PR with an 'impact/*'
label must also have a corresponding 'kind/*' label, in addition to the
existing 'area/*' label requirement.

This change helps ensure proper categorization of pull requests by
requiring contributors to specify both the impact area and the kind of
change being made.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-08-14 12:47:03 +02:00
Albin Kerouanton
d2e0895b9b daemon: deprecate env vars set by legacy links
The environment variables set by legacy links are not particularly
useful because you need to know the name of the linked container to use
them, or you need to scan all enviornment variables to find them.

Legacy links are deprecated / marked "legacy" since a long time, and we
want to replace them with non-legacy links. This will help make the
default bridge work like custom networks.

For now, stop setting these environment variables inside of linking
containers by default, but provide an escape hatch to allow users who
still rely on these to re-enable them.

The integration-cli tests `TestExecEnvLinksHost` and `TestLinksEnvs` are
removed as they need to run against a daemon with legacy links env vars
enabled, and a new integration test`TestLegacyLinksEnvVars` is added to
fill the gap. Similarly, the docker-py test `test_create_with_links` is
skipped.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-08-14 11:32:54 +02:00
Sebastiaan van Stijn
b13ea83488 api: bump github.com/google/go-cmp v0.7.0
We should generally keep dependency versions low, but let's
update this one to match the other modules, and to allow
taking advantage of some of the modern features of go-cmp.

full diff: https://github.com/google/go-cmp/compare/v0.5.9...v0.7.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-14 00:08:32 +02:00
Austin Vazquez
98286b9cd8 Merge pull request #50711 from thaJeztah/rename_port
api/types/container: rename Port to PortSummary
2025-08-13 12:50:23 -07:00
Cory Snider
56c48e8708 d/libn/bitmap: tidy up constants, branchy math
The only references to blockLen type-assert the uint32 constant to other
widths. Make it an untyped int to cut down on unnecessary boilerplate.

Rewrite the genNumBlocks utility function to use the well-known
algorithm for rounding-up integer division instead of branching. Inline
it into the only call site.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-08-13 14:45:13 -04:00
Sebastiaan van Stijn
82ba7fef17 api/types/container: rename Port to PortMapping
It better describes its purpose, and allows "Port" to be used for
other purposes (e.g. to replace "nat.Port").

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Co-authored-by: Austin Vazquez <austin.vazquez@docker.com>
2025-08-13 12:55:31 -05:00
Sebastiaan van Stijn
e5f2023861 Merge pull request #50712 from thaJeztah/filter_simplify
daemon: don't strong-type filters
2025-08-13 17:13:33 +02:00
Sebastiaan van Stijn
32f3579ecf Merge pull request #50709 from thaJeztah/client_ping_err_fixes
client: Client.Ping: improve error handling and fallback, and assorted fixes/cleanups
2025-08-13 17:12:51 +02:00
Evan Lezar
48038347d7 Match device driver on name and ignore capabilities
This change ignores requested capabilities when a driver is explicitly
requested. This simplifies the logic for selecting a driver and means
that users need not spefify redundant capabilities.

With the exception of the catch-all "gpu" capability the remaining
capabilities are only relevant for the "nvidia" driver.

Signed-off-by: Evan Lezar <elezar@nvidia.com>
2025-08-13 16:59:39 +02:00
Austin Vazquez
c70f205ed0 Merge pull request #50713 from thaJeztah/bump_bbolt
vendor: go.etcd.io/bbolt v1.4.2
2025-08-13 06:50:03 -07:00
Sebastiaan van Stijn
606519a171 Merge pull request #50708 from austinvazquez/restore-docker-driver-env-var
Restore DOCKER_DRIVER environment variable
2025-08-13 14:11:26 +02:00
Sebastiaan van Stijn
2aba802ae6 daemon: don't strong-type filters
The input is a string, and we're producing an error if those strings
are in the wrong format, so we may as well just use a map[string]bool

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-13 13:57:06 +02:00
Sebastiaan van Stijn
a2aa7be724 vendor: go.etcd.io/bbolt v1.4.2
- Fix the compilation issue on aix, android and solaris due to wrong use of maxMapSize
- Add protection on meta page when it's being written
- Correct the incorrect usage of debug method
- Add clarification on the option InitialMmapSize
- Fix the crash when writing huge values

full diff: https://github.com/etcd-io/bbolt/compare/v1.4.0...v1.4.2

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-13 13:45:05 +02:00
Sebastiaan van Stijn
1c34ff94bc client: consistently use defer for ensureReaderClosed
ensureReaderClosed was designed to be usable regardless if a response
was nil (error) or non-nil (success). Some code-paths were optimized to
avoid using a defer (which used to have an overhead), but the overhead
of defer is neglectable in current versions of Go, and some of these
optimizations made the logic more complicated (and err-prone).

This patch switches to use a defer for all places.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-13 01:17:32 +02:00
Sebastiaan van Stijn
f6b63e6013 client.sendRequest: clean-up logic for error-handling
Only use checkResponseErr if `client.doRequest` did not return an error;
any error returned by `client.doRequest` means there was an error connecting,
so there's no response to handle (including errors in the response).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-12 23:58:48 +02:00
Sebastiaan van Stijn
2a4f70309d client.doRequest: improve GoDoc to clarify behavior
Outline that any error returned is a connectivity error and a nil-error
requires the response to be handled (including errors returned in the
response).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-12 23:58:48 +02:00
Sebastiaan van Stijn
d69fde4c60 client: Client.Ping: improve error handling and fallback
The Ping function first tries to do a HEAD request, but the parsePingResponse
was written with the assumption that a Body could be present in the response
that may include errors returned by the API server.

HEAD responses don't include a body, so there's no response to handle, and
no errors to return by the API, other than a HTTP status code.

This patch:

- Rewrites `parsePingResponse` to a `newPingResponse`, removing the error-
  handling for the response-body. It's also simplified, because a non-nil
  response is guaranteed to have a non-nil Header (but it may not have
  any of the headers set that are used for the Ping).
- Rewrites the `Client.Ping` to only return a Ping-response from the HEAD
  request if no error was returned (i.e., we connected with the API) and
  a successful status-code, otherwise it will fallback to a GET request,
  which allows (for non "OK" (200) status-codes) returning errors from
  the daemon (for example, if the daemon is in an unhealthy state).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-12 23:58:40 +02:00
Austin Vazquez
b2e6fd31cf Restore DOCKER_DRIVER environment variable for storage driver configuration.
This change restores the environment variable configuration of daemon storage driver through the DOCKER_DRIVER environment variable.

Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-08-12 16:35:31 -05:00
Sebastiaan van Stijn
80294ddb60 client: make checkResponseErr a regular function
It was implemented as a method on Client, but the receiver was not used;
make it a regular function to prevent passing around the Client where
not needed.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-12 21:49:24 +02:00
Cory Snider
a27a2901b1 Merge pull request #50660 from corhere/libn/overlay-eventnotify-nilderef
libn/d/overlay: don't deref nil PeerRecord on error
2025-08-12 11:51:44 -04:00
Austin Vazquez
cd8e84a058 Merge pull request #50705 from thaJeztah/more_modernize
daemon: use slices.Clone, maps.Collect in some places
2025-08-12 05:05:05 -07:00
Sebastiaan van Stijn
f17f9230c9 Merge pull request #50686 from thaJeztah/libnet_less_copyto
daemon/libnetwork: refactor, modernize various `CopyTo` functions, remove redundant utilities
2025-08-12 12:45:54 +02:00
Sebastiaan van Stijn
423980614e daemon: use slices.Clone, maps.Collect in some places
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-12 12:08:12 +02:00
Sebastiaan van Stijn
6505e8d605 daemon/libnetwork/types: rename StaticRoute.GetCopy to Copy
Just for consistency; it was the last `GetCopy` remaining.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-12 11:48:24 +02:00
Sebastiaan van Stijn
1e11e64c9c daemon/libnetwork/types: remove TransportPort.Equal()
The `TransporPort` type is comparable; it doesn't have fields that
require special handling. It's defined as;

    // TransportPort represents a local Layer 4 endpoint
    type TransportPort struct {
        Proto Protocol
        Port  uint16
    }

where `Protocol` is an int (with a stringer interface);

    type Protocol uint8

So we can remove the `Equal` method, and simplify places where it's
compared.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-12 11:39:56 +02:00
Sebastiaan van Stijn
561e14ea3f daemon/libnetwork/types: remove TransportPort.GetCopy()
The `GetCopy()` function doesn't de-reference anything, as it's
all a straight copy. We can remove it as it's only making things
more complicated than needed.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-12 11:39:56 +02:00
Sebastiaan van Stijn
385297ee40 daemon/libnetwork/types: remove unused IsIPNetValid utility
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-12 11:39:55 +02:00
Sebastiaan van Stijn
7960f742a2 daemon/libnetwork: Endpoint.CopyTo: use maps/slices.Clone
Modernize using maps.Clone, slices.Clone. This method is needed to
satisfy the datastore.KVObject interface, so also assert it does.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-12 11:39:55 +02:00
Sebastiaan van Stijn
a82a68a445 daemon/libnetwork: replace endpointJoinInfo.CopyTo with Copy()
The endpointJoinInfo.CopyTo function expected the caller to construct an
EndpointInterface to copy to, but all callsites created an empty struct.
In addition, `CopyTo` would never return an error, so the error return
was redundant.

Replace it with a `Copy()` function, which makes it easier to
consume.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-12 11:39:55 +02:00
Sebastiaan van Stijn
2d5100749d daemon/libnetwork: replace EndpointInterface.CopyTo with Copy()
The EndpointInterface.CopyTo function expected the caller to construct an
EndpointInterface to copy to, but all callsites created an empty struct.
In addition, `CopyTo` would never return an error, so the error return
was redundant.

Replace it with a `Copy()` function, which makes it easier to
consume.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-12 11:39:48 +02:00
Sebastiaan van Stijn
80452e5d4a daemon/libnetwork/types: PortBinding.Equal: use non-pointer receiver
Change `PortBinding.Equal` to use a value receiver and parameter, this
allows us to use it directly with `slices.IndexFunc`, `DeleteFunc`,
without having to add a wrapper func.

The only exception currently is the `UnmapPorts` function (stub), which
takes portmapperapi.PortBinding as argument; the portmapperapi.PortBinding
type embeds `types.PortBinding`, and it's the only field that's compared
as part of `UnmapPorts`

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-12 11:38:09 +02:00
Sebastiaan van Stijn
7d5312ab56 daemon/libnetwork/types: rename PortBinding.GetCopy to Copy and non-pointer
- Rename `PortBinding.GetCopy()` to `PortBinding.Copy()`, which is more
  idiomatic, and aligns with other similar methods.
- Change it to a non-pointer receiver; `Copy` does not mutate state, and
  the type should still be reasonably small.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-12 11:38:09 +02:00
Sebastiaan van Stijn
e387dc977e daemon/libnetwork/types: cleanup GetIPNetCopy, GetIPNetCanonical
Rewrite both to use slices.Clone, and GetIPNetCanonical to not depend
on GetIPNetCopy. GetIPNetCopy only has a single consumer, so we should
consider moving it local to where it's used.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-12 11:38:09 +02:00
Sebastiaan van Stijn
68a94ecbb5 daemon/libnetwork/types: remove GetIPCopy; use slices.Clone
We can replace this utility with slices.Clone, which provides the
same functionality.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-12 11:38:09 +02:00
Sebastiaan van Stijn
115b801a3b daemon/libnetwork/types: remove GetMacCopy; use slices.Clone
We can replace this utility with slices.Clone, which provides the
same functionality.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-12 11:38:09 +02:00
Sebastiaan van Stijn
cfad3ed6b9 daemon/libnetwork: replace IpamInfo.CopyTo with IpamInfo.Copy()
The IpamInfo.CopyTo function expected the caller to construct an
IpamInfo to copy to, but all callsites created an empty struct.
In addition, `CopyTo` would never return an error, so the error
return was redundant.

Replace it with a `Copy()` function, which makes it easier to
consume.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-12 11:38:09 +02:00
Sebastiaan van Stijn
2f74f245b6 daemon/libnetwork: replace IpamConf.CopyTo with IpamConf.Copy()
The IpamConf.CopyTo function expected the caller to construct an
IpamConf to copy to, but all callsites created an empty struct.
In addition, `CopyTo` would never return an error, so the error
return was redundant.

Replace it with a `Copy()` function, which makes it easier to
consume.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-12 11:38:08 +02:00
Sebastiaan van Stijn
82ea65ea2f Merge pull request #50703 from thaJeztah/libnet_fix_delete
daemon/libnet/drv/bridge: stubPortMapper.UnmapPorts: fix slices.Delete
2025-08-12 11:34:59 +02:00
Sebastiaan van Stijn
796a4ce952 daemon/libnet/drv/bridge: stubPortMapper.UnmapPorts: fix slices.Delete
This stub was introduced in 4e246efcd1,
which currently is only in the master branch.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-12 09:27:29 +02:00
Sebastiaan van Stijn
16f2e81369 Merge pull request #50679 from hannesortmeier/50676-swagger-forceupdate-uint64
api: swagger: Tweak type of ForceUpdate to uint64
2025-08-11 23:18:45 +02:00
Austin Vazquez
0ca1bc036f Merge pull request #48009 from dmcgowan/containerd-migration
Update containerd to default storage and add support for migration
2025-08-11 13:33:14 -07:00
Sebastiaan van Stijn
162e6fae53 Merge pull request #50688 from thaJeztah/remove_errdefs_aliases
daemon/libnetwork/types: remove errdefs aliases
2025-08-11 19:01:55 +02:00
Paweł Gronowski
7f9c5069e6 Merge pull request #50690 from thaJeztah/ep_copy_step1
api/types/network: modernize EndpointIPAMConfig.Copy, EndpointSettings.Copy
2025-08-11 16:50:40 +00:00
Sebastiaan van Stijn
79ca608d15 Merge pull request #50685 from thaJeztah/windows_cleanup_err
daemon/libnet/drivers/windows: small cleanup in error-handling
2025-08-11 17:53:27 +02:00
Sebastiaan van Stijn
5f29ca9657 Merge pull request #50683 from thaJeztah/ContainerInspect_clean
daemon: Daemon.ContainerInspect: move vars closer to where used
2025-08-11 17:48:08 +02:00
Sebastiaan van Stijn
f694d98800 Merge pull request #50682 from thaJeztah/dockerfile_copyRunConfig_simplify
daemon/builder/dockerfile: copyRunConfig: use slices/maps.Clone
2025-08-11 17:47:40 +02:00
Derek McGowan
a4fbbc1570 Add context to restore and load containers
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-08-11 08:47:24 -07:00
Derek McGowan
85b79f83f4 Fix hardlink handling in containerd snapshot remap
When files are hardlinked, the inodes only need to be chowned once.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-08-11 08:47:23 -07:00
Derek McGowan
ead007f1f1 Use native snapshotter for integration tests and run
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-08-11 08:47:23 -07:00
Derek McGowan
99181f56ce Fix symlink evaluation to a directory that may not exist
During the arm64 tests, the rootfs directory does not seem to exist when
this test is run and will cause a failure when using snapshotter.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-08-11 08:47:23 -07:00
Derek McGowan
4816383c0b Add environment variable to define the threshold
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-08-11 08:47:22 -07:00
Hannes Ortmeier
185ae7ec2c docs: api: Tweak type of ForceUpdate to uin64
Signed-off-by: Hannes Ortmeier <ortmeier.hannes@gmail.com>
2025-08-11 17:29:04 +02:00
Hannes Ortmeier
c8173c5c1f api: swagger: Tweak type of ForceUpdate to uint64
Signed-off-by: Hannes Ortmeier <ortmeier.hannes@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-11 17:28:58 +02:00
Rob Murray
2d0bc97eb9 Merge pull request #50646 from robmry/nftables_no_enable_ip_forwarding
nftables: never enable IP forwarding on the host
2025-08-11 09:44:00 +01:00
Sebastiaan van Stijn
0a89d98bad daemon/libnetwork/types: remove errdefs aliases
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-10 20:18:02 +02:00
Sebastiaan van Stijn
892ebd2f17 daemon/libnet/drivers/windows: small cleanup in error-handling
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-10 16:43:36 +02:00
Sebastiaan van Stijn
11094e27b0 api/types/network: modernize EndpointIPAMConfig.Copy, EndpointSettings.Copy
- Use slices.Clone where suitable.
- Handle `nil` values so that callers don't have to check for `nil`.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-10 12:59:21 +02:00
Sebastiaan van Stijn
b48df69b02 daemon: Daemon.ContainerInspect: move vars closer to where used
- construct the `ports` copy before `networkSettings` so that it
  can be used as part of the struct-literal. This copy was added
  in 7917a36cc7 to prevent a race-
  condition.
- `mountPoints` is not used until the very end, but (likely) still
  needs to happen while we hold the lock, so move it before it's
  released.
- add a comment referencing the reason to unlock early before the
  size calculation, in case it become irrelevant in future.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-10 12:18:34 +02:00
Sebastiaan van Stijn
582ee7ea57 daemon/builder/dockerfile: copyRunConfig: use slices/maps.Clone
Simplify the code by replacing our DYI code to clone using
the slices and maps packages.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-09 14:58:06 +02:00
Sebastiaan van Stijn
feeaa167ea Merge pull request #50677 from thaJeztah/dep_bumps
vendor: update some (indirect) dependencies
2025-08-08 23:29:54 +02:00
Sebastiaan van Stijn
c6ea52196c Merge pull request #50546 from slonopotamus/windows-runtimes
Fix custom runtimes handling on Windows
2025-08-08 22:54:29 +02:00
Marat Radchenko
0ded8645b6 Fix custom runtimes handling on Windows
This commit partially reverts 7ccf750daa and 84965c0752

Closes #50542

Signed-off-by: Marat Radchenko <marat@slonopotamus.org>
2025-08-08 21:41:17 +02:00
Sebastiaan van Stijn
aa6838ae54 vendor: go.uber.org/zap v1.27.0
Removes dependency on benbjohnson/clock, github.com/pkg/errors,
and go.uber.org/atomic (in favor of stdlib).

full diff: https://github.com/uber-go/zap/compare/v1.21.0...v1.27.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-08 21:34:32 +02:00
Sebastiaan van Stijn
daf843b72f vendor: go.uber.org/multierr v1.11.0
- Drop external atomic dependency
- Support Go 1.20 Unwrap() []error

full diff: https://github.com/uber-go/multierr/compare/v1.9.0...v1.11.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-08 21:25:05 +02:00
Sebastiaan van Stijn
aa85a44139 vendor: github.com/google/btree v1.1.3
- fix: remove item may changed clone btree; (i+1) children has new cow, but do not copy

full diff: https://github.com/google/btree/compare/v1.1.2...v1.1.3

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-08 21:21:21 +02:00
Sebastiaan van Stijn
fe32e4a999 vendor: github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8
- groupcache: add go.mod, update for Go 1.24

full diff: 41bb18bfe9...2c02b8208c

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-08 21:13:47 +02:00
Sebastiaan van Stijn
76fc74317a vendor: github.com/golang/gddo v0.0.0-20190904175337-72a348e765d2
Repository has been archived, and we only use a single package, so we
could even consider forking. For now, let's at least update it to the
latest code, which added a go.mod.

full diff: 72a348e765...20d68f94ee

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-08 21:10:46 +02:00
Derek McGowan
632fb0c89a Update graphdriver check logic to account for disabling of snapshotter
Ensure migration is never attempted multiple times.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-08-08 12:07:42 -07:00
Derek McGowan
b41babafaa Fix windows test graphdriver setting
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-08-08 12:07:42 -07:00
Derek McGowan
8700bca2bf Update migration test to use graphdriver env
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-08-08 12:07:42 -07:00
Derek McGowan
00463b9216 Fix containerd image count
Ensure image count returned by containerd image service only includes
the count of unique images.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-08-08 12:07:41 -07:00
Derek McGowan
7f87cf9d8a Check for snapshotter plugin availability
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-08-08 12:07:41 -07:00
Derek McGowan
632de98f75 Enable containerd snapshotters by default
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-08-08 12:07:41 -07:00
Derek McGowan
9f5f4f5a42 Add containerd migration to daemon startup
Add layer migration on startup
Use image size threshold rather than image count
Add daemon integration test
Add test for migrating to containerd snapshotters
Add vfs migration
Add tar export for containerd migration
Add containerd migration test with save and load

Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-08-08 12:07:23 -07:00
Rob Murray
4b97831992 Merge pull request #50671 from mmorel-35/github.com/hashicorp/go-multierror
chore: use errors.Join instead of github.com/hashicorp/go-multierror
2025-08-08 19:40:36 +01:00
Rob Murray
2fff6b442e check-config.sh: report IP forwarding sysctl state
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-08-08 18:43:35 +01:00
Rob Murray
f71e86eed5 rootless: enable IP forwarding
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-08-08 18:43:35 +01:00
Rob Murray
f802d8a08e When cleaning iptables rules, warn on filter-FORWARD DROP
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-08-08 18:43:35 +01:00
Rob Murray
67ffa47090 nftables: don't enable IP forwarding
For nftables only, never enable IP forwarding on the host. Instead,
return an error on network creation if forwarding is not enabled,
required by a bridge network, and --ip-forward=true.

If IPv4 forwarding is not enabled when the daemon is started with
nftables enabled and other config at defaults, the daemon will
exit when it tries to create the default bridge.

Otherwise, network creation will fail with an error if IPv4/IPv6
forwarding is not enabled when a network is created with IPv4/IPv6.

It's the user's responsibility to configure and secure their host
when they run Docker with nftables.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-08-08 18:43:35 +01:00
Rob Murray
7dfeee8460 Drop FirewallCleanerSetter interface
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-08-08 18:43:35 +01:00
Rob Murray
200a75b34a Return concrete types from NewNftabler/NewIptabler
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-08-08 18:43:35 +01:00
Sebastiaan van Stijn
9d167847d0 Merge pull request #50654 from thaJeztah/fix_fakestorage
testutil/fakestorage: use local paths, fix port-mapping and optimize, and remove contrib/httpserver
2025-08-08 19:26:42 +02:00
Matthieu MOREL
050fbbccca chore: use errors.Join instead of github.com/hashicorp/go-multierror
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-08-08 19:19:21 +02:00
Sebastiaan van Stijn
90eef3f0c9 Merge pull request #50672 from mmorel-35/revive-use-any
chore: enable use-any rule from revive
2025-08-08 18:00:49 +02:00
Matthieu MOREL
96f8c6395e chore: enable use-any rule from revive
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-08-08 17:07:07 +02:00
Sebastiaan van Stijn
0b1b5bf13d Merge pull request #50667 from thaJeztah/no_more_closing
check for net.ErrClosed instead of "use of closed network connection"
2025-08-08 17:03:05 +02:00
Albin Kerouanton
5cb7e19528 Merge pull request #50669 from akerouanton/dont-reuseaddr-for-UDP
libnet/pa: don't set SO_REUSEADDR on UDP sockets
2025-08-08 15:31:09 +02:00
Sebastiaan van Stijn
846cf4b56b Merge pull request #50292 from thaJeztah/deprecate_strslice
Deprecate api/types/strslice.StrSlice and remove its use
2025-08-08 14:43:17 +02:00
Albin Kerouanton
c6be4ad999 libnet/pa: don't set SO_REUSEADDR on UDP sockets
The userland proxy uses unconnected UDP sockets to receive packets from
anywhere, so enabling SO_REUSEADDR means that multiple sockets can bind
the same port. This defeats the purpose of the portallocator, which is
supposed to ensure that the port is free and not already in use (either
by us, or by another process). So, do not enable SO_REUSEADDR for UDP
sockets.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-08-08 13:46:04 +02:00
Sebastiaan van Stijn
3862a0875c check for net.ErrClosed instead of "use of closed network connection"
The infamous "use of closed network connection" error was added in
[cl-5649076] as a non-exported error. This made it not possible to
write code to handle it as a sentinel error, other than through string-
matching.

Commit [moby@cc851db] (docker v0.6.4) added a [`IsClosedError`] utility
for this (as [net.errClosing@go1.1.2] did not yet export this error).
The `IsClosedError` was later moved to the `go-connections` module, but
various other places in our code used similar matching.

There was a feature-request [go-4373] to export it, which
got accepted and implemented in [CL 5649076], so starting with go1.16
we now have [net.ErrClosed@go1.16], so can remove the string matching.

[CL 5649076]: https://golang.org/cl/5649076
[moby@cc851db]: cc851dbb3f
[`IsClosedError`]: cc851dbb3f/utils/utils.go (L1032-L1040)
[net.errClosing@go1.1.2]: https://github.com/golang/go/blob/go1.1.2/src/pkg/net/net.go#L341
[go-4373]: https://github.com/golang/go/issues/4373
[net.ErrClosed@go1.16]: https://github.com/golang/go/blob/go1.16/src/net/net.go#L636-L645

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-08 09:58:06 +02:00
Sebastiaan van Stijn
5a30aa3670 Merge pull request #50665 from thaJeztah/update_badges
README: update, add badges
2025-08-08 08:54:42 +02:00
Sebastiaan van Stijn
3db66944ad Merge pull request #50657 from randomnoise/docs-rm-branch-name-image-tag-refs
docs/contributing: remove GIT_BRANCH image tag references
2025-08-08 08:46:47 +02:00
Sebastiaan van Stijn
0fbb6a244a Merge pull request #50650 from ctalledo/fix-for-50531
Stabilize TestSaveAndLoadPlatform integration test.
2025-08-08 08:46:10 +02:00
Sebastiaan van Stijn
e1be10f5ed Merge pull request #50647 from thaJeztah/rm_vendor.mod
remove references to "vendor.mod"
2025-08-08 03:12:14 +02:00
Sebastiaan van Stijn
59711b3245 Merge pull request #50653 from austinvazquez/bump-go-1.24.6
update to go1.24.6
2025-08-08 02:21:56 +02:00
Serhan Tutar
9cae3fb167 docs/contributing: remove GIT_BRANCH image tag references
When creating development containers currently, `Makefile` doesn't use
the GIT_BRANCH variable to tag `docker-dev` image. But in some
documentation files for contributing, references remain for image tags
with the `git branch` name.

This commit simply removes those references. Correct image tag names are
important for newcomers, especially for copy-pasteable commands.

Related PR: 42652

Signed-off-by: Serhan Tutar <randomnoise@users.noreply.github.com>
2025-08-08 02:01:41 +02:00
Cesar Talledo
04d95003fd Stabilize TestSaveAndLoadPlatform integration test.
Test was flaky because it was not waiting for an image load
operation to complete before proceeding to check if the load
succeeded. Fix this.

Signed-off-by: Cesar Talledo <cesar.talledo@docker.com>
2025-08-08 01:57:53 +02:00
Sebastiaan van Stijn
1f323d5035 client: README: add badges
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-08 01:16:53 +02:00
Sebastiaan van Stijn
662154a940 api: README: add badges
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-08 01:16:30 +02:00
Sebastiaan van Stijn
b4e353c02b README: add license and OpenSSF badge
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-08 01:14:33 +02:00
Sebastiaan van Stijn
df3aea43aa remove references to "vendor.mod"
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-08 00:24:37 +02:00
Austin Vazquez
33badcff70 Merge pull request #50126 from thaJeztah/bump_go_connections
vendor: github.com/docker/go-connections v0.6.0
2025-08-07 15:18:41 -07:00
Sebastiaan van Stijn
98790830eb Deprecate api/types/strslice.StrSlice and remove its use
The strslice.StrSlice type is a string-slice with a custom JSON Unmarshal
function to provide backward-compatibility with older API requests from
before docker 1.7 (see [moby@17d6f00] and [moby@ea4a067]), which used a
string instead of an array of strings for some fields (Cmd, Entrypoint).

We no longer support those API versions, and we no longer support pulling
v1 images that may contain such a config, so we can deprecate the type
and remove its use.

[moby@17d6f00]: 17d6f00ec2
[moby@ea4a067]: ea4a06740b

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-07 17:15:49 -05:00
Austin Vazquez
b25b421f97 update to go1.24.6
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-08-07 17:14:22 -05:00
Sebastiaan van Stijn
a328be30eb Merge pull request #50645 from thaJeztah/bump_c8d
Dockerfile: update containerd binary to v1.7.28
2025-08-07 23:49:00 +02:00
Sebastiaan van Stijn
677c2a19d9 vendor: github.com/docker/go-connections v0.6.0
- deprecate sockets.GetProxyEnv, sockets.DialerFromEnvironment
- add support for unix sockets on Windows
- remove legacy CBC cipher suites from client config
- align client and server defaults to be the same.
- remove support for encrypted TLS private keys.
- nat: optimize ParsePortSpec

full diff: https://github.com/docker/go-connections/compare/v0.5.0...v0.6.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-07 22:07:57 +02:00
Sebastiaan van Stijn
50789e2bab testutil/fakestorage: inline go code and remove contrib/httpserver
It's 12 lines of code total; we may as well write it as part of building;
it looks to be the only place this is used, so we can remove the contrib
directory, which should not be used by anyone.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-07 22:04:09 +02:00
Sebastiaan van Stijn
d49a354cb2 testutil/fakestorage: use local paths, fix port-mapping and optimize
- always build the go binary, instead of trying to find if it exists
  and then trying to copy it.
- write the Dockerfile ourselves, instead of trying to copy the one
  from contrib.
- update the Dockerfile to be built "FROM scratch"; we don't need
  busybox here.
- start the container with "PublishAllPorts: true", otherwise no
  ports would be mapped.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-07 22:04:09 +02:00
Sebastiaan van Stijn
8be1b2372a Dockerfile: update containerd binary to v1.7.28
- release notes: https://github.com/containerd/containerd/releases/tag/v1.7.28
- full diff: https://github.com/containerd/containerd/v1.7.27...v1.7.28

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-07 22:03:38 +02:00
Sebastiaan van Stijn
0ea918ad0a Merge pull request #50662 from vvoland/fix-frozen
Fix download-frozen-image-v2
2025-08-07 21:58:57 +02:00
Paweł Gronowski
b9b52d59b8 download-frozen-image-v2: Use curl -L
Passing the Auth to the redirected location was fixed in curl 7.58:
https://curl.se/changes.html#7_58_0 so we no longer need the extra
handling and can just use `-L` to let curl handle redirects.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-08-07 20:52:30 +02:00
Paweł Gronowski
359a881cea download-frozen-image-v2: handle 307 responses without decimal
Correctly parse HTTP response that doesn't contain an HTTP version with a decimal place:

```
< HTTP/2 307
```

The previous version would only match strings like `HTTP/2.0 307`.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-08-07 20:51:42 +02:00
Cory Snider
12c6345d3a libn/d/overlay: don't deref nil PeerRecord on error
If unmarshaling the peer record fails, there is no need to check if it's
a record for a local peer. Attempting to do so anyway will result in a
nil-dereference panic. Don't do that.

The Windows overlay driver has a typo: prevPeer is being checked twice
for whether it was a local-peer record. Check prevPeer once and newPeer
once each, as intended.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-08-07 13:25:37 -04:00
Rob Murray
e628fa0409 Merge pull request #50649 from olljanat/win-keep-ipam-config
windows: do not forgot IPAM configuration when re-creating networks
2025-08-07 12:41:50 +01:00
Olli Janatuinen
dcaf8893a0 windows: do not forgot IPAM configuration when re-creating networks
Signed-off-by: Olli Janatuinen <olli.janatuinen@gmail.com>
2025-08-06 16:49:20 +00:00
Sebastiaan van Stijn
28df781514 Merge pull request #50648 from thaJeztah/add_replace
add back replace and vendor, tidy
2025-08-06 18:02:15 +02:00
Sebastiaan van Stijn
0b2644b61f Merge pull request #50644 from thaJeztah/bump_runc
Dockerfile: update runc binary to v1.3.0
2025-08-06 17:52:32 +02:00
Sebastiaan van Stijn
0ad765c67d add back replace and vendor, tidy
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-06 16:30:57 +02:00
Sebastiaan van Stijn
3a4851d1f2 Merge pull request #50643 from thaJeztah/api_docs_sync
api/docs: sync v1.52 swagger with current version
2025-08-06 16:21:35 +02:00
Sebastiaan van Stijn
f5f984eec6 Dockerfile: update runc binary to v1.3.0
- release notes: https://github.com/opencontainers/runc/releases/tag/v1.3.0
- full diff: https://github.com/opencontainers/runc/compare/v1.2.6..v1.3.0

-----

This is the first release of the 1.3.z release branch of runc. It
contains a few minor fixes for issues found in 1.3.0-rc.2.

This is the first release of runc that will follow our new release and
support policy (see RELEASES.md for more details). This means that, as
of this release:

* As of this release, the runc 1.2.z release branch will now only
  receive security and "significant" bugfixes.
* Users are encouraged to plan migrating to runc 1.3.0 as soon as
  possible.
* Due to its particular situation, runc 1.1.z is officially no longer
  supported and will no longer receive any updates (not even for
  critical security issues). Users are urged (in the strongest possible
  terms) to upgrade to a supported version of runc.
* Barring any future changes to our release policy, users should expect
  a runc 1.4.0 release in late October 2025.

Fixed

* Removed pre-emptive "full access to cgroups" warning when calling
  `runc pause` or `runc unpause` as an unprivileged user without
  `--systemd-cgroups`. Now the warning is only emitted if an actual permission
  error was encountered.
* Several fixes to our CI, mainly related to AlmaLinux and CRIU.

Changed

* In runc 1.2, we changed our mount behaviour to correctly handle clearing
  flags. However, the error messages we returned did not provide as much
  information to users about what clearing flags were conflicting with locked
  mount flags. We now provide more diagnostic information if there is an error
  when in the fallback path to handle locked mount flags.
* Upgrade our CI to use golangci-lint v2.0.
* `runc version` information is now filled in using `//go:embed` rather than
  being set through `Makefile`. This allows `go install` or other non-`make`
  builds to contain the correct version information. Note that
  `make EXTRA_VERSION=...` still works.
* Remove `exclude` directives from our `go.mod` for broken `cilium/ebpf`
  versions. `v0.17.3` resolved the issue we had, and `exclude` directives are
  incompatible with `go install`.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-06 13:51:00 +02:00
Sebastiaan van Stijn
fadceb9253 Merge pull request #50338 from jirimoravcik/docs/improve-build-outputs-description
docs: api: improve the docs of the `outputs` parameter
2025-08-06 13:12:23 +02:00
Sebastiaan van Stijn
18940b6c9b Merge pull request #50640 from thaJeztah/update_tests
update some fixtures in tests
2025-08-06 13:01:12 +02:00
Sebastiaan van Stijn
234349d173 api/docs: sync v1.52 swagger with current version
This includes the changes from c13266d2c0
in the versioned swagger, as those changes were made after the
v1.52 versioned document was created.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-06 12:22:57 +02:00
Jiří Moravčík
833dc69ad9 docs: improve the description of the outputs parameter for /build endpoint
Signed-off-by: Jiří Moravčík <jiri.moravcik@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-06 12:18:00 +02:00
Akihiro Suda
2c1d9046b2 Merge pull request #50639 from thaJeztah/update_godocs
update various "doc" links in code
2025-08-06 13:32:43 +09:00
Akihiro Suda
491fe1fbcf Merge pull request #50642 from thaJeztah/mod_tidy
go.mod: tidy
2025-08-06 12:58:43 +09:00
Sebastiaan van Stijn
c145229828 update some fixtures in tests
updated TestModuleVersion fixture (looks like the test doesn't really care :D)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-05 20:54:36 +02:00
Sebastiaan van Stijn
90c3d29bfb go.mod: tidy
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-05 20:51:28 +02:00
Sebastiaan van Stijn
78ccee32b3 update various "doc" links in code
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-05 20:49:57 +02:00
Austin Vazquez
2ab75a2461 Merge pull request #50641 from austinvazquez/prepare-moby-client-v0.1.0-alpha.0
Bump api version in client and main module to v1.52.0-alpha.1
2025-08-05 11:34:02 -07:00
Austin Vazquez
d82f50557e Bump api version in client and main module to v1.52.0-alpha.1
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-08-05 13:19:45 -05:00
Sebastiaan van Stijn
37d0204d7f Merge pull request #50594 from thaJeztah/cleanup_v1_handling
builder-next: puller.Snapshot: cleanup handling of v1 images
2025-08-05 19:51:24 +02:00
Paweł Gronowski
8bd1ad8665 Merge pull request #50636 from thaJeztah/update_golangci_config
update golangci-lint settings
2025-08-05 17:40:34 +00:00
Sebastiaan van Stijn
141a97bdf9 Merge pull request #50555 from chunzhennn/49231-fix-memcg-swap-config-check
contrib/check-config: fix MEMCG_SWAP checking
2025-08-05 19:36:26 +02:00
Sebastiaan van Stijn
e7feeb10b9 Merge pull request #50602 from thaJeztah/cleanup_enabledisableservice
daemon/libnetwork: Sandbox.EnableService/DisableService slight cleanup
2025-08-05 19:35:10 +02:00
Paweł Gronowski
b99405e47b Merge pull request #48114 from thaJeztah/api_types_move_plugin_types
api/types: move plugin types to api/types/plugin
2025-08-05 17:33:48 +00:00
Sebastiaan van Stijn
4ed5ca3202 Merge pull request #50637 from dmcgowan/prepare-client-0.1.0-alpha.0
Prepare release notes for `client/v0.1.0-alpha.0`
2025-08-05 19:33:12 +02:00
Derek McGowan
a0a7d9a3d7 Add release notes for client/v0.1.0-alpha.0
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-08-05 09:16:34 -07:00
Derek McGowan
32ec26be6c Update client and main module api version to latest alpha tag
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-08-05 09:16:13 -07:00
Sebastiaan van Stijn
e30b8e3393 update golangci-lint settings
The github.com/docker/docker/reference package was moved to
github.com/moby/moby/v2/daemon/internal/refstore, so this
check no longer did anything (and no aliasing needed).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-05 17:32:31 +02:00
Austin Vazquez
44bca1adf3 Merge pull request #50625 from dmcgowan/prepare-api-v1.52.0
Prepare release notes for v1.52.0-alpha.0
2025-08-05 07:45:38 -07:00
Sebastiaan van Stijn
57256a9b62 fix error-capitalization
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-05 15:42:59 +02:00
Sebastiaan van Stijn
c13266d2c0 api/types: move plugin types to api/types/plugin
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-05 15:42:57 +02:00
Sebastiaan van Stijn
926ff237a9 Merge pull request #50632 from thaJeztah/move_error_response
api/types: move ErrorResponse to common/ErrorResponse
2025-08-05 15:41:49 +02:00
Sebastiaan van Stijn
c17d43ae67 api/types: move ErrorResponse to common/ErrorResponse
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-05 14:45:10 +02:00
Sebastiaan van Stijn
c77b27f2fc Merge pull request #50630 from thaJeztah/client_stdlib_errs
client: use stdlib errors
2025-08-05 14:43:06 +02:00
Sebastiaan van Stijn
485b11a6f7 Merge pull request #50599 from thaJeztah/cleanup_registry
daemon/pkg/registry: some cleanups to start separating "search"
2025-08-05 13:51:17 +02:00
Sebastiaan van Stijn
7fa01a73cd Merge pull request #50601 from thaJeztah/cleanup_buildSandboxOptions
daemon: make buildSandboxOptions, buildSandboxPlatformOptions more atomic
2025-08-05 13:49:10 +02:00
Sebastiaan van Stijn
15f78b752c daemon: make buildSandboxOptions, buildSandboxPlatformOptions more atomic
The buildSandboxPlatformOptions function was given a pointer to the
sboxOptions and modified it in-place.

Similarly, a pointer to the container was passed and `container.HostsPath`
and `container.ResolvConfPath` mutated. In cases where either of those
failed, we would return an error, but the container (and sboxOptions)
would already be modified.

This patch;

- updates the signature of buildSandboxPlatformOptions to return a fresh
  slice of sandbox options, which can be appended to the sboxOptions by
  the caller.
- uses intermediate variables for `hostsPath` and `resolvConfPath`, and
  only mutates the container if both were obtained successfully.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-05 11:59:46 +02:00
Sebastiaan van Stijn
77c2e3279d daemon/libnetwork: Sandbox.EnableService/DisableService slight cleanup
- remove/rename named error-return
- remove redundant defer
- use "continue" to reduce nesting
- use structured logs

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-05 11:56:00 +02:00
Paweł Gronowski
c6ca504388 Merge pull request #50626 from thaJeztah/add_v1.52_docs
api/docs: add v1.52 swagger
2025-08-05 09:22:06 +00:00
Sebastiaan van Stijn
7b8f841d1c Merge pull request #50628 from thaJeztah/bump_deps
go.mod: update containerd/v2 v2.1.4, dario.cat/mergo v1.0.2, docker/go-events, fernet/fernet-go
2025-08-05 09:32:14 +02:00
Sebastiaan van Stijn
bfce6556c4 client: use stdlib errors
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-05 09:11:21 +02:00
Sebastiaan van Stijn
e06826601c Merge pull request #50629 from thaJeztah/client_tidy
client: tidy go.mod
2025-08-05 08:22:48 +02:00
Sebastiaan van Stijn
3fe93532e4 client: tidy go.mod
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-04 20:40:57 +02:00
Sebastiaan van Stijn
3b14c5488f go.mod: github.com/containerd/containerd/v2 v2.1.4
full diff: https://github.com/containerd/containerd/compare/v2.1.3...v2.1.4

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-04 20:20:44 +02:00
Sebastiaan van Stijn
259eb259bc go.mod: dario.cat/mergo v1.0.2
drops gopkg.in/yaml.v3 as dependency

full diff: https://github.com/darccio/mergo/compare/v1.0.1...v1.0.2

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-04 20:20:36 +02:00
Sebastiaan van Stijn
d8b622b315 go.mod: github.com/docker/go-events v0.0.0-20250114142523-c867878c5e32
full diff: e31b211e4f...c867878c5e

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-04 20:14:12 +02:00
Sebastiaan van Stijn
8e63b55146 go.mod: github.com/fernet/fernet-go v0.0.0-20240119011108-303da6aec611
Update to the latest version, which is now a module;
full diff: 9f70042a33...303da6aec6

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-04 20:14:09 +02:00
Sebastiaan van Stijn
6b45c76a23 Merge pull request #50624 from thaJeztah/tidy
go.mod: tidy and update github.com/docker/docker v28.3.3
2025-08-04 20:06:40 +02:00
Sebastiaan van Stijn
87033e1857 Merge pull request #50612 from thaJeztah/stdcopy_clean
apk/pkg/stdcopy: remove use of `iota`, improve docs, and add example
2025-08-04 19:44:22 +02:00
Akihiro Suda
27c9ab1222 Merge pull request #50622 from vvoland/hack-mobyv2
hack: Fix references to old `docker/docker` module
2025-08-05 02:21:57 +09:00
Rob Murray
b789a8ca96 Merge pull request #50600 from thaJeztah/DNSConfig_netip
daemon/config: make DNSConfig.DNS a netip.Addr
2025-08-04 18:20:59 +01:00
Sebastiaan van Stijn
b672a78ca8 Merge pull request #50597 from thaJeztah/inline_containerExec
integration/container: TestCheckpoint: inline containerExec util
2025-08-04 19:14:15 +02:00
Sebastiaan van Stijn
559c3c7c6a Merge pull request #50620 from akerouanton/fix-firewalld-reload-deadlock
libnet/d/bridge: handleFirewalldReloadNw: fix deadlock
2025-08-04 19:13:20 +02:00
Sebastiaan van Stijn
044234f847 api/docs: add v1.52 swagger
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-04 18:13:23 +02:00
Derek McGowan
59e8fe8479 Prepare release notes for v1.52.0
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-08-04 08:39:16 -07:00
Paweł Gronowski
dfac16c297 hack: Update cosmetic occurences of the old package name
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-08-04 17:36:45 +02:00
Sebastiaan van Stijn
83267a0fda go.mod: github.com/docker/docker v28.3.3
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-04 17:27:10 +02:00
Sebastiaan van Stijn
5b3e1a6425 go.mod: tidy
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-04 17:23:32 +02:00
Austin Vazquez
01f2815c67 Merge pull request #50621 from randomnoise/docs-fix-subheading
docs: fix URI fragment by changing it to the existing subheading
2025-08-04 08:16:31 -07:00
Sebastiaan van Stijn
4a50295283 Merge pull request #50604 from thaJeztah/fix_testing_links
TESTING.md fix links to gotest.tools, and some touch-ups
2025-08-04 16:44:33 +02:00
Paweł Gronowski
0ae3cb000e validate/pkgimports: Fix package name
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-08-04 16:35:53 +02:00
Paweł Gronowski
22bd59010e hack: Fix dockerversion not being set correctly
Replace old package name with moby/v2

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-08-04 16:35:48 +02:00
Paweł Gronowski
79148460b0 hack/make.ps1: Replace old package name with moby/v2
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-08-04 16:35:47 +02:00
Paweł Gronowski
2dcd8b8def golangci: Replace old package name with moby/v2
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-08-04 16:35:44 +02:00
Austin Vazquez
e2ead4526d Merge pull request #50605 from thaJeztah/rm_image_spec_stubs
daemon/internal/image: remove image-spec markdown
2025-08-04 06:33:27 -07:00
Austin Vazquez
4761d97684 Merge pull request #50606 from thaJeztah/rm_contrib_syntax
contrib: remove syntax (Dockerfile syntax) files
2025-08-04 06:32:15 -07:00
Serhan Tutar
cad3a5775b docs: fix URI fragment by changing it to the existing subheading
Markdown subheading name was changed in `CONTRIBUTING.md` in the past,
so this commit fixes the link by changing it from `docker` to `moby`.

Signed-off-by: Serhan Tutar <randomnoise@users.noreply.github.com>
2025-08-04 13:46:24 +03:00
Albin Kerouanton
778d8e3a26 libnet/d/bridge: handleFirewalldReloadNw: fix deadlock
handleFirewalldReloadNw locks `d.mu` and then `d.configNetworks`.
However, the rest of the driver locks `d.configNetworks` first and then
`d.mu`.

This could result in deadlocks if `handleFirewalldReloadNw` is called
while the bridge driver is already holding `d.configNetworks` lock.

Other code paths were checked to ensure that they all follow the same
locking order.

This bug was introduced by commit a527e5a.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-08-04 12:04:47 +02:00
Albin Kerouanton
519adb26c3 libnet/d/bridge: driver: un-embed mutex
The bridge driver was embedding `sync.Mutex` which is unconventional and
makes it harder to analyze locks ordering.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-08-04 11:32:34 +02:00
Paweł Gronowski
71bd98436b Merge pull request #50607 from thaJeztah/contrib_rm_mac_install
contrib: remove `mac-install-bundle.sh` and `editorconfig`
2025-08-04 09:08:03 +00:00
Albin Kerouanton
81273c461d Merge pull request #50603 from thaJeztah/stricter_types
libnetwork/types: use stricter types for enums
2025-08-04 10:58:48 +02:00
Paweł Gronowski
bda0bab54f Merge pull request #50585 from robmry/nftables_check_config
check_config: add nftables modules to optional features
2025-08-04 08:29:46 +00:00
Akihiro Suda
7f45f08b48 Merge pull request #50598 from thaJeztah/detach_fetchManifest
router/distribution: fetchManifest; detach from distributionRouter
2025-08-04 15:13:30 +09:00
Akihiro Suda
fe2dbb36e6 Merge pull request #50610 from thaJeztah/dockerfile_swagger_version
Dockerfile: add GO_SWAGGER_VERSION build-arg
2025-08-04 15:12:14 +09:00
Akihiro Suda
e87a2d662e Merge pull request #50608 from thaJeztah/no_reflect
api/types/strslice: use slices.Equal
2025-08-04 13:38:06 +09:00
Akihiro Suda
d183ece79e Merge pull request #50609 from thaJeztah/api_any
api: update "interface{}" to "any"
2025-08-04 13:37:37 +09:00
Akihiro Suda
4946ec6fce Merge pull request #50611 from thaJeztah/client_update_godoc
client: touch-up godoc
2025-08-04 13:37:07 +09:00
Sebastiaan van Stijn
752a3b302c api/pkg/stdcopy: add example
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-02 22:39:00 +02:00
Sebastiaan van Stijn
26cf610e6e api/pkg/stdcopy: improve docs
- Outline the purpose of the Stdin and Systemerr streams and how
  they're used.
- Update docs for StdCopy function
- Touch-up error for unknown stream types

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-02 18:37:16 +02:00
Sebastiaan van Stijn
c010c84ade api/pkg/stdcopy: don't use iota for consts
iota can be convenient for internal use for cases where the value
doesn't matter. It can be a footgun when using it to define public
values; it's easy to accidentally change values (e.g. by re-ordering
or adding a value), which may go undetected within our code because
both producer and consumer would be updated.

This patch updates these consts to have a concrete value, because it's
part of the API contract and must not be changed.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-02 17:23:51 +02:00
Sebastiaan van Stijn
195a6bbb1e client: touch-up godoc
Not perfect yet, but addressing some godoc "doc" links that needed
to be updated, and touching up some references.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-02 17:12:05 +02:00
Sebastiaan van Stijn
e7c784c270 Dockerfile: add GO_SWAGGER_VERSION build-arg
Allow overriding the go-swagger version to install.

With this patch:

    docker build -q --call=outline --target=swagger .

    TARGET: swagger

    BUILD ARG            VALUE                    DESCRIPTION
    GO_VERSION           1.24.5
    BASE_DEBIAN_DISTRO   bookworm
    GOLANG_IMAGE         golang:1.24.5-bookworm
    XX_VERSION           1.6.1
    GO_SWAGGER_VERSION   v0.32.3                  specifies the version of the go-swagger binary to install.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-02 01:40:20 +02:00
Sebastiaan van Stijn
908895b9c3 api: update "interface{}" to "any"
Keep the linters happier.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-02 01:27:06 +02:00
Sebastiaan van Stijn
51bbc37f64 api/types/strslice: use slices.Equal
[Open Source Insights], which is linked from [pkg.go.dev] flagged
the API module to have [CAPABILITY_REFLECT], because it detected
"reflect" to be imported.

Let's use the slices package, which should do the job for these
tests.

[Open Source Insights]: https://deps.dev/go/github.com%2Fmoby%2Fmoby%2Fapi/v0.0.0-20250801143505-5f121ce46324/analysis
[pkg.go.dev]: https://pkg.go.dev/github.com/moby/moby/api@v0.0.0-20250801143505-5f121ce46324
[CAPABILITY_REFLECT]: 3166f9ba9d/docs/capabilities.md (capability_reflect)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-02 00:56:26 +02:00
Sebastiaan van Stijn
0f9c087c91 Merge pull request #50519 from corhere/plugin-interface-type-pkg
api/types: fix Plugin.Config.Interface.Types Swagger definition
2025-08-02 00:34:28 +02:00
Sebastiaan van Stijn
dab42db691 contrib: remove editorconfig
This file was added in 962f347923, at which
time there already were doubts about it being useful. For Go, `gofmt`
already dictates formatting (and proper editors would integrat with
that). For other languages, most editors would already have a config,
and our CI validates formatting for various files.

Give that the file was never updated since it was added, it's fair
to say that it's unmaintained. Let's remove.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-02 00:01:43 +02:00
Sebastiaan van Stijn
5fbbf040aa contrib: remove mac-install-bundle.sh
This script was added in 6860c101ad
to allow testing a custom daemon in Docker Desktop, but has not
been maintained since, and likely no longer functional, so let's
remove.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-01 23:55:39 +02:00
Sebastiaan van Stijn
5a40d4ed9f contrib: remove syntax (Dockerfile syntax) files
The Dockerfile syntax is now maintained as part of BuildKit in the
https://github.com/moby/buildkit repository, but our contrib still
had syntax highlighting files for various editors;

- The TextMate (`.tmbundle`) syntax was last update 9 months ago
  in c2029cb257, but this was a stale
  pull request from 2018, so at least 7 Years behind on updates to
  the syntax.
- The vim syntax is now integrated in upstream, and our copy was
  remove 6 Years ago in 5511f45767.
- The Nano syntax was added 10 Years ago in 76bc44fb91,
  and received an update 9 Years ago in 4cb71f8082,
  and received no contributions since.
- The kate syntax was already unmaintained, and removed 9 Years ago
  in a2f695d7fa.

I think it's fair to state that these are unmaintained and severely outdated.
I _do_ think it would be good to have maintained versions of such files,
as it can improve the experience for users. However, this would be more
suitable for the BuildKit project, and I'm not sure if the current copies
of these files are a good starting point (if needed, they can still be
obtained from git history).

This patch removes the files.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-01 23:46:04 +02:00
Sebastiaan van Stijn
62545ddf90 daemon/internal/image: remove image-spec markdown
The image spec was moved to the github.com/moby/docker-image-spec repository,
and 03a17a2887 removed the files from the
moby repository, but left markdown files in place to point people to
the new location.

As these files were now moved internally, they no longer serve that purpose,
so we can remove them.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-01 23:19:28 +02:00
Sebastiaan van Stijn
4cfc260a5f TESTING.md fix links to gotest.tools, and some touch-ups
- Update links to use the correct (v3) version.
- Slightly touch-up examples.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-01 22:44:04 +02:00
Sebastiaan van Stijn
1205a15db1 libnetwork/types: define RouteType type
Define a `RouteType` type, type the related consts, and update the
`JoinInfo.AddStaticRoute` signature in the interface.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-01 22:33:10 +02:00
Sebastiaan van Stijn
6aab881534 libnetwork/types: make Protocol consts strong-typed
These use the Linux-specific values as convention, so unfortunately,
the syscall package doesn't define consts for these on Windows, so
keeping our own definition (values are not really relevant here).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-01 22:33:08 +02:00
Sebastiaan van Stijn
ec5dbaf233 libnetwork/types: define IPFamily options using syscall.AF_XXX consts
Use the consts defined in syscall that basically match our intent here.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-01 22:33:03 +02:00
Sebastiaan van Stijn
95eeb0b3b0 libnetwork/types: define IPFamily type for IP-family consts
Define a type to help discovery, and update the signatures of
`ResolveName`, `Network.ResolveName`, and `Sandbox.ResolveName`
accordingly.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-01 22:32:57 +02:00
Sebastiaan van Stijn
311b2c87e1 Merge pull request #50384 from thaJeztah/daemon_inspect_unify
daemon: consolidate platform-specific inspectExecProcessConfig
2025-08-01 20:25:02 +02:00
Sebastiaan van Stijn
c55d02be07 Merge pull request #50507 from carsontham/migrate-test-container-api-rename
integration-cli: migrated test TestContainerAPIRename to docker/cli
2025-08-01 19:57:17 +02:00
Cory Snider
ee560a3b23 api/types: fix Plugin.Config.Interface.Types def'n
The wire type of Plugin.Config.Interface.Types is an array of strings,
not of objects with three properties. We just so happen to have a Go
struct type to represent a plugin-interface-type value in memory with
all the fields parsed out for convenience, but that is not part of the
REST API contract documented by the Swager spec.U pdate the Swagger spec
to correctly document that the Types property is an array of strings in
the API, while still generating Go definitions that unmarshal into the
convenient struct type.

Move the definition and marshal/unmarshal methods for
PluginInterfaceType into a more appropriate location than api/types.
Rename the type to one that does not stutter or overload already
heavily overloaded terminology.

Modernize the parser and use property-based testing to assert that it
behaves the same as the old parser for all well-formed inputs.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-08-01 13:37:20 -04:00
Cory Snider
2783f80ecf api/types: generate with latest go-swagger
Override some of the templates to suppress emitting unwanted validation
and marshal/unmarshal code.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-08-01 13:30:23 -04:00
Sebastiaan van Stijn
5365f08ae2 daemon/config: make DNSConfig.DNS a netip.Addr
Modernize the field and allow using it as-is in some places, or
convert it to a string (which won't produce an error down the line).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-01 18:48:10 +02:00
Sebastiaan van Stijn
a43198845b daemon/pkg/registry: un-export ResolveAuthConfig
It's now only used to back the `Service.ResolveAuthConfig` method, and
not used outside of the package currently.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-01 16:47:47 +02:00
Sebastiaan van Stijn
5fbf680f5d daemon/pkg/registry: move newIndexInfo to search
It's the only user of it.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-01 16:42:31 +02:00
Sebastiaan van Stijn
6a7f0008a3 daemon/pkg/registry: move searchRepositories to where it's used
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-01 16:42:31 +02:00
Sebastiaan van Stijn
17d0ac56f3 daemon/pkg/registry: remove session; make searchRepositories a func
The `session` struct was just bundling a http.Client with a v1Endpoint.
It was never a long-lived service; every use initialized the session,
only to call the `searchRepositories` method on it.

Dismantle it, and make it a regular function that gets a http.Client and
a v1Endpoint passed as argument.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-01 16:42:31 +02:00
Sebastiaan van Stijn
0c73c459b4 daemon/pkg/registry: un-export GetAuthConfigKey
We want to get rid of the use of using "registry.IndexInfo". Make the
function un-exported to discourage additional use.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-01 16:42:31 +02:00
Sebastiaan van Stijn
eda6a499e3 router/distribution: fetchManifest; detach from distributionRouter
The distributionRouter receiver was not used; make it a regular function
to make clear it doesn't require the router.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-01 16:41:17 +02:00
Sebastiaan van Stijn
aac2623115 integration/container: TestCheckpoint: inline containerExec util
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-01 16:36:43 +02:00
Sebastiaan van Stijn
5f121ce463 Merge pull request #50593 from thaJeztah/rm_unused_resolvconf
daemon/libnetwork/resolvconf: remove unused code
2025-08-01 16:35:05 +02:00
Sebastiaan van Stijn
03991f4846 builder-next: puller.Snapshot: cleanup handling of v1 images
- Remove redundant if/else
- Move vars closer to where used now that we don't have the if/else.
- Touch-up error-message to remove engine version and update doc link to DeprecatedSchema1ImageError.
- Touch-up TODOs and add reference to help trace back what's meant.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-01 14:50:26 +02:00
Sebastiaan van Stijn
0156a42200 daemon/libnetwork/resolvconf: remove unused code
This package is a wrapper for the libnetwork/internal/resolvconf package,
which is a modernized, more performant rewrite of the original parsing
code.

The libnetwork/resolvconf package was still maintained because it was
used by BuildKit, but since [moby/buildkit@3d43066], BuildKit maintains
its own copy of the internal package.

The only remaining uses of this package was as part of some tests (which
would also benefit of using the internal pacakge's implementation directly),
and a _single_ use of `resolvconf.Path` in the daemon, which cannot use
the internal package currently because it's internal to libnetwork.

This patch:

- Removes all functions that were not used.
- Rewrites some tests in libnetwork to use the internal/resolvconf package
  directly, instead of depending on the wrapper.
- Add TODOs to consider moving the "Path" function separate (which could
  be in daemon/config if we consider it to be the default for the daemon's
  resolvconf path configuration).

[moby/buildkit@3d43066]: 3d43066f2e

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-01 14:48:05 +02:00
Sebastiaan van Stijn
8c5c253b50 Merge pull request #50590 from thaJeztah/update_github_links
update github and pkg.go.dev links
2025-08-01 10:17:29 +02:00
carsontham
bbec7a5150 migrated test container API rename to docker/cli
Signed-off-by: carsontham <carsontham@outlook.com>
2025-08-01 13:27:07 +08:00
Sebastiaan van Stijn
3f54a4e539 Merge pull request #50589 from thaJeztah/remove_go_build
remove obsolete //go:build tags
2025-08-01 02:44:31 +02:00
Sebastiaan van Stijn
6d35ec7b42 Merge pull request #50588 from thaJeztah/cleanup_integration
integration: remove stray "distribution" directory
2025-08-01 02:15:08 +02:00
Sebastiaan van Stijn
1e499bae79 daemon: consolidate platform-specific inspectExecProcessConfig
This function was introduced in 1af76ef597
and based on the previous code in the daemon, which had platform-specific
handling for exec inspect in [setPlatformSpecificExecProcessConfig], which
was added in 5fa2e4d4f2 to account for
Windows not having "Privileged" and not setting the "User".

Given that "User" would be empty and "Privileged" not set, we may as well
combine both platforms, and just return the info we have.

[setPlatformSpecificExecProcessConfig]: 1af76ef597/daemon/exec_unix.go (L11-L21)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-01 02:06:22 +02:00
Sebastiaan van Stijn
49aa38e9e7 update links to swarmkit v2 docs
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-01 01:49:04 +02:00
Sebastiaan van Stijn
c98e5cb60b update github links to moby/moby
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-01 01:48:55 +02:00
Sebastiaan van Stijn
cf15d5bbc6 remove obsolete //go:build tags
These are no longer needed as these are now part of a module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-01 00:49:22 +02:00
Sebastiaan van Stijn
02b3f1cd99 integration: remove stray "distribution" directory
Looks like I accidentally added these 5 Years ago in
9f0b3f5609, and never
noticed.

Let's clean this up.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-31 23:53:33 +02:00
Sebastiaan van Stijn
ff14d7edf0 Merge pull request #50512 from dmcgowan/make-moby-v2-module
Make `github.com/moby/moby/v2` module
2025-07-31 23:41:00 +02:00
Rob Murray
297ea75204 check_config: add nftables modules to optional features
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-07-31 19:38:33 +01:00
Derek McGowan
83357620e2 Update unit test script for windows
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-31 10:49:03 -07:00
Derek McGowan
58c95cde9b Replace uses of code which requires 1.24+
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-31 10:49:03 -07:00
Derek McGowan
900a0516de Update hack/test/unit for go module
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-31 10:49:02 -07:00
Derek McGowan
1d571e619d Rename build package to moby v2 module
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-31 10:49:02 -07:00
Derek McGowan
65867642d3 Remove go module workarounds
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-31 10:49:02 -07:00
Derek McGowan
f74e5d48b3 Create github.com/moby/moby/v2 module
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-31 10:13:29 -07:00
Derek McGowan
a954a0f4a2 Remove profiles
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-31 10:13:08 -07:00
Derek McGowan
53bd828853 Remove libnetwork
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-31 10:13:08 -07:00
Sebastiaan van Stijn
4faedf2bec Merge pull request #50583 from thaJeztah/fix_auth
Revert "api/types/registry: EncodeAuthConfig: use empty string for zero value"
2025-07-31 17:26:56 +02:00
Sebastiaan van Stijn
e55d294ea7 api/types/registry: add TODO/note about empty authConfigs
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-31 15:41:33 +02:00
Sebastiaan van Stijn
8b68b977b1 Revert "api/types/registry: EncodeAuthConfig: use empty string for zero value"
This reverts commit 3a447bc079.

Some daemon versions don't handle empty values well, which resulted in
an io.EOF error when sending an empty X-Registry-Auth during decoding
or unmarshaling.

We should investigate what code-paths are hit to trigger this, but
in the meantime, let's revert this patch.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-31 15:38:41 +02:00
Akihiro Suda
39030fdf94 Merge pull request #50580 from thaJeztah/no_nat_step2
replace direct uses of nat types for api/types/container aliases
2025-07-31 14:32:23 +09:00
Sebastiaan van Stijn
5bbf3af980 daemon: fix linting S1016 (staticcheck) false positive
Staticcheck is suggesting to cast the type or to directly copy, but
doesn't account for nat.SortPortMap mutating the second argument, so
mutating the HostConfig.PortBindings. From the code, it looks like the
intent here was to prevent that (creating a deep copy), so let's keep
that.

    daemon/container_operations.go:109:39: S1016: should convert bb (type github.com/docker/docker/vendor/github.com/docker/go-connections/nat.PortBinding) to github.com/docker/docker/vendor/github.com/moby/moby/api/types/container.PortBinding instead of using struct literal (staticcheck)
                    bindings[p] = append(bindings[p], containertypes.PortBinding{
                                                      ^
    daemon/network.go:952:39: S1016: should convert bb (type github.com/docker/docker/vendor/github.com/docker/go-connections/nat.PortBinding) to github.com/docker/docker/vendor/github.com/moby/moby/api/types/container.PortBinding instead of using struct literal (staticcheck)
                    bindings[p] = append(bindings[p], containertypes.PortBinding{
                                                      ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-31 02:57:39 +02:00
Sebastiaan van Stijn
d58dc493fe replace direct uses of nat types for api/types/container aliases
Follow-up to 494677f93f, which added
the aliases, but did not yet replace our own use of the nat types.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-31 02:57:39 +02:00
Sebastiaan van Stijn
0a5fb23b35 Merge pull request #49264 from thaJeztah/jsonmessage_remove_deprecated
pkg/jsonmessage: stop printing deprecated progressDetail, errorDetail, remove DisplayJSONMessagesToStream and Stream interface
2025-07-31 02:24:24 +02:00
Sebastiaan van Stijn
0564d7f084 Merge pull request #50573 from thaJeztah/no_nat
api/types/container: add aliases for go-connections/nat types
2025-07-31 02:18:24 +02:00
Sebastiaan van Stijn
494677f93f api/types/container: add aliases for go-connections/nat types
This allows us to update code to not be attached to go-connections
directly (in future we may be able to move the types to be concrete
types).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-30 23:46:56 +02:00
Sebastiaan van Stijn
f3ba0b2dc2 client/pkg/jsonmessage: remove Stream interface
It was an interface to match CLI-specific primitives and is no
longer used.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-30 23:22:12 +02:00
Sebastiaan van Stijn
19edf5c53c client/pkg/jsonmessage: remove DisplayJSONMessagesToStream
It was an adaptor around DisplayJSONMessagesStream for CLI-specific
primitives that was used in the CLI, but can be implemented by users
of this package.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-30 23:22:09 +02:00
Sebastiaan van Stijn
fdaccdb233 pkg/jsonmessage: stop printing deprecated progressDetail, errorDetail
The API still returns it for backward-compatibility (but probably
shouldn't), but we should no longer print it. This removes the
use of these fields for printing, but keeps them for streamformatter
to use.

- ErrorMessage was deprecated in 3043c26419
- ProgressMessage was deprecated in 597e0e69b4

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-30 22:51:13 +02:00
Sebastiaan van Stijn
7bb2a15294 Merge pull request #50565 from dmcgowan/move_jsonmessage
Move jsonmessage, streamformatter, and progress
2025-07-30 18:55:51 +02:00
Sebastiaan van Stijn
263a21705b Merge pull request #50574 from thaJeztah/remove_NoBaseImageSpecifier
api: remove deprecated NoBaseImageSpecifier
2025-07-30 16:41:50 +02:00
Sebastiaan van Stijn
94ac102e4b api: remove deprecated NoBaseImageSpecifier
It was deprecated in 7b9bd987bf, but
won't be carried in the API module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-30 15:00:59 +02:00
Derek McGowan
0d8ca8eefe Move pkg/jsonmessage to client/pkg/jsonmessage
Signed-off-by: Derek McGowan <derek@mcg.dev>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-30 14:22:31 +02:00
Derek McGowan
d00ecdc479 Move pkg/streamformatter to api/pkg/streamformatter
Signed-off-by: Derek McGowan <derek@mcg.dev>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-30 14:22:31 +02:00
Derek McGowan
66862e14d1 Move pkg/progress to api/pkg/progress
Signed-off-by: Derek McGowan <derek@mcg.dev>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-30 14:22:31 +02:00
Derek McGowan
1da417980c Move api/stdcopy to api/pkg/stdcopy
Signed-off-by: Derek McGowan <derek@mcg.dev>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-30 14:22:30 +02:00
Derek McGowan
ebef4a44fd Split streamformatter from jsonmessage
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-30 14:22:30 +02:00
Sebastiaan van Stijn
5a144c40e2 pkg/streamformatter: reduce jsonmessage.JSONMessage dependency
This package depends on jsonformatter.JSONProgress and jsonmessage.JSONMessage,
and it looks like it requires some of those for their stringer interface.

Signed-off-by: Derek McGowan <derek@mcg.dev>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-30 14:22:30 +02:00
Sebastiaan van Stijn
f4127d76c5 pkg/jsonmessage: move JSONProgress to api/types/jsonstream
Move the type to the API, but embed it, so that we keep the
methods on the struct in this package.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-30 14:22:30 +02:00
Sebastiaan van Stijn
0515e1c991 pkg/jsonmessage: move JSONError to api/types/jsonstream
Also rename api type JSONError to Error

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-30 14:22:27 +02:00
Sebastiaan van Stijn
6453f9d5f4 Merge pull request #50570 from thaJeztah/jsonmessage_less_deps
pkg/jsonmessage: remove github.com/morikuni/aec dependency
2025-07-30 14:21:32 +02:00
Sebastiaan van Stijn
bda72b5c57 Merge pull request #50571 from thaJeztah/daemon_no_jsonstream
Add separate const for daemon httputils to avoid jsonmessage import
2025-07-30 14:21:08 +02:00
Sebastiaan van Stijn
7c626bea7e Merge pull request #50569 from thaJeztah/tidy_vendor
tidy vendor.mod
2025-07-30 14:20:48 +02:00
Sebastiaan van Stijn
9a52e474a3 pkg/jsonmessage: suppress unhandled errors
Keep the linters happy.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-30 12:48:02 +02:00
Derek McGowan
02fcde0c18 Add separate const for daemon httputils to avoid jsonmessage import
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-30 12:41:46 +02:00
Sebastiaan van Stijn
e257027903 pkg/jsonmessage: remove github.com/morikuni/aec dependency
We can probably use [aec.EmptyBuilder] for managing the output, but
currently we're doing it all manually, so defining some consts for
the basics we use.

[aec.EmptyBuilder]: https://pkg.go.dev/github.com/morikuni/aec#EmptyBuilder

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-30 12:34:45 +02:00
Sebastiaan van Stijn
d7082848a6 tidy vendor.mod
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-30 12:17:56 +02:00
Sebastiaan van Stijn
2574c2b2e9 Merge pull request #50561 from thaJeztah/internalize_legacy_filter
api/types/filters: remove deprecated ToParamWithVersion
2025-07-29 14:50:42 +02:00
Sebastiaan van Stijn
1be59a838d Merge pull request #50558 from thaJeztah/cleanup_fileutils
remove pkg/fileutils, and move its functionality where used
2025-07-29 13:49:52 +02:00
Sebastiaan van Stijn
7381c0da6e Merge pull request #50554 from dmcgowan/move-logdriver-interface
Move logdriver interface
2025-07-29 13:47:47 +02:00
Sebastiaan van Stijn
0e582c691e Merge pull request #50557 from thaJeztah/registry_deadcode
daemon/pkg/registry: remove unused code
2025-07-29 13:38:00 +02:00
Sebastiaan van Stijn
12b761321b Merge pull request #50559 from thaJeztah/pkg_system_clean
pkg/system: move to daemon/internal
2025-07-29 13:05:40 +02:00
Sebastiaan van Stijn
6c7e2909c2 api/types/filters: remove deprecated ToParamWithVersion
It's only used by the client to support API versions older than v1.22.
Make it an internal utility that doesn't depend on internal fields of
`filter.Args`.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-29 13:04:39 +02:00
Sebastiaan van Stijn
5535e81a79 pkg/system: move to daemon/internal
It has no external users, and this package still has too many different
responsibilities, some of which may be available elsewhere, so moving it
internal so that we can decide to dismantle it further.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-29 11:48:57 +02:00
Sebastiaan van Stijn
d94171bfaa pkg/system: make XattrError linux-only
It's only produced in Linux code, so put it in a Linux-only file.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-29 11:36:23 +02:00
Sebastiaan van Stijn
aa9de914ca pkg/system: remove unused ErrNotSupportedPlatform
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-29 11:36:23 +02:00
Sebastiaan van Stijn
28b822d5b3 pkg/system: remove Lgetxattr, Lsetxattr stubs for non-Linux
It's only used in Linux code. Remove the stubs, which are not carried
forward into the module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-29 11:36:23 +02:00
Sebastiaan van Stijn
450ac30e4a pkg/system: LUtimesNano: remove stub for non-Linux
It's not used, and is not carried in the new module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-29 11:36:23 +02:00
Sebastiaan van Stijn
03f44e6d14 pkg/system: MkdirAllWithACL: remove stubs and unused os.FileMode arg
Remove the stub implementation for non-Windows platforms, and remove the
os.FileMode argument, which is ignored on Windows.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-29 11:36:23 +02:00
Sebastiaan van Stijn
6f9e099fd3 pkg/system: remove deprecated IsAbs
It was deprecated in f8a2550a22, but won't
be carried to the new modules.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-29 11:36:22 +02:00
Sebastiaan van Stijn
53a3085256 pkg/system: remove deprecated EscapeArgs
It was deprecated in 63bada41e5, but won't
be carried to the new modules.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-29 11:36:20 +02:00
Sebastiaan van Stijn
8c7365e1ff Merge pull request #50556 from thaJeztah/builder_rm_dead_code
daemon/builder/remotecontext: remove detection of system.XattrError
2025-07-29 11:35:52 +02:00
Sebastiaan van Stijn
1313b8caff pkg/fileutils: move ReadSymlinkedDirectory to daemon
It has no external consumers, is written with specific behavior, making
it not a good candidate to carry in the module.

This moves it to the daemon as a non-exported `resolveSymlinkedDirectory`
utility, so that it's only accessible where it's currently used.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-29 11:17:32 +02:00
Sebastiaan van Stijn
ae0a3d6918 pkg/fileutils: move ReadSymlinkedDirectory internal to daemon
It has no external consumers, is written with specific behavior (including
some potentially surprising behavior), making it not a good candidate to
carry in the module.

This moves it internal to the daemon as a non-exported utility, so that
it's only accessible where it's currently used.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-29 11:16:25 +02:00
Sebastiaan van Stijn
bae46854c5 pkg/fileutils: remove unused CopyFile utility
It's not used, and has no external consumers; we don't have to carry it
in the new module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-29 10:47:35 +02:00
Sebastiaan van Stijn
46854ca5ab daemon/pkg/registry: remove copy of rootless.RunningWithRootlessKit
Now that it's part of the daemon, we can use the internal
package again to help discovery of rootless-specific codepaths

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-29 10:39:26 +02:00
Sebastiaan van Stijn
f1c65c1dd6 daemon/pkg/registry: Service.Auth: remove unused statusMessage return
It was only used by the CLI, which now has its own fork.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-29 10:26:12 +02:00
Sebastiaan van Stijn
f797ced96a daemon/pkg/registry: remove unused ParseRepositoryInfo, RepositoryInfo
It was only used by the CLI, which now has its own fork.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-29 10:22:09 +02:00
Sebastiaan van Stijn
e30d541da0 daemon/pkg/registry: remove unused ReadCertsDirectory
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-29 10:07:44 +02:00
Sebastiaan van Stijn
d80e16bb18 daemon/pkg/registry: remove unused ParseSearchIndexInfo
It was only used by the CLI, which now has its own fork.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-29 10:06:36 +02:00
Sebastiaan van Stijn
4c1ab68c6c daemon/builder/remotecontext: remove detection of system.XattrError
Both locations checked an error from `filepath.Rel` in stdlib, which
would never return a `system.XattrError`, so this was just dead code.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-29 09:51:40 +02:00
Derek McGowan
1dc53e8ec7 Update client go.mod
Remove transitive gogo dependency

Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-28 23:05:19 -07:00
Derek McGowan
03d7f47f31 Update api go.mod
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-28 23:05:19 -07:00
Derek McGowan
5bbb7182e7 Move logdriver to internal under daemon/logger
The logdriver package should be moved to another external repository for
building plugins. While transitioning, move to internal package using
the same structure.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-28 23:05:19 -07:00
Derek McGowan
d7cfe97984 Update logdriver to remove proto definitions
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-28 22:05:11 -07:00
纯真
f866621303 contrib/check-config: fix kernel version range check
Signed-off-by: 纯真 <38834411+chunzhennn@users.noreply.github.com>
2025-07-29 10:45:18 +08:00
纯真
df8d45c7c9 contrib/check-config: fix MEMCG_SWAP
CONFIG_MEMCG_SWAP has been deprecated since kernel v5.8-rc1 (commit 2d1c498) and removed since kernel v6.1-rc1 (commit e55b9f9).

Since kernel v5.8-rc1, swap tracking has been an integral part of memory control. CONFIG_MEMCG_SWAP becomes invisible to user and simply means CONFIG_MEMCG && CONFIG_SWAP. 

Disable the check for kernel v5.8+.

Signed-off-by: 纯真 <38834411+chunzhennn@users.noreply.github.com>
2025-07-29 10:30:13 +08:00
Derek McGowan
ee24dcec3d Move swarm runtime plugin storage type to internal
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-28 18:18:39 -07:00
Derek McGowan
86190e7366 Move swarm runtime plugin spec to swarm types
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-28 17:27:57 -07:00
Sebastiaan van Stijn
1e835a8cf5 Merge pull request #50550 from thaJeztah/rootless_internal
pkg/rootless: move to daemon/internal
2025-07-28 22:52:31 +02:00
Sebastiaan van Stijn
d761d9d358 pkg/rootless: move to daemon/internal
This package is used internally by the daemon, and was only used out
side of the daemon by pkg/plugins (for which we still need to look
where it should be kept).

Making it internal because it's trivial to implement if needed by
anyone. The only reason it's a package is to keep it central, and
to make it easier to discover where we have rootlesskit-specific
codepaths in our codebase.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-28 22:04:39 +02:00
Sebastiaan van Stijn
1e0531c8d5 Merge pull request #50533 from thaJeztah/internal_runconfig
runconfig: rewrite ContainerDecoder to DecodeCreateRequest
2025-07-28 21:29:08 +02:00
Sebastiaan van Stijn
0153bebebb Merge pull request #50547 from thaJeztah/internal_stack
pkg/stack: move to daemon/internal
2025-07-28 20:44:35 +02:00
Sebastiaan van Stijn
0075bafe0c Merge pull request #50548 from thaJeztah/rm_stringid_stdcopy
remove pkg/stringid, pkg/stdcopy as they moved to the client and api modules
2025-07-28 20:42:45 +02:00
Sebastiaan van Stijn
17959aff2c remove pkg/stdcopy as it has moved to the api module
pkg/stdcopy moved to github.com/moby/moby/api/stdcopy, and the 28.4
transitional releasee will provide an alias for those that use
github.com/docker/docker as dependency, so we can remove the alias
for the moby module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-28 19:02:00 +02:00
Sebastiaan van Stijn
c055c3e098 remove pkg/stringid as it has moved to the client module
pkg/stringid moved to github.com/moby/moby/client/pkg/stringid, and
the 28.4 transitional releasee will provide an alias for those that
use github.com/docker/docker as dependency, so we can remove the
alias for the moby module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-28 19:00:17 +02:00
Sebastiaan van Stijn
76e2ca1d41 pkg/stack: move to daemon/internal
This package is used by the daemon to produce a stack-dump, It has no
external consumers, so we can move it to daemon/internal.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-28 18:39:22 +02:00
Sebastiaan van Stijn
f78d595c96 runconfig: move to daemon/internal/runconfig
The runconfig package is used by the "container" router to unmarshal, normalize,
and validate a container.CreateRequest. The router converts the result to a
backend.ContainerCreateConfig to be passed on to the backend (daemon).

This package could possibly be part of the router itself, or moved to an
internal package in the server, but we don't have an internal package
there yet.

Put it in daemon/internal for now, which still leaves our options open.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-28 18:32:15 +02:00
Sebastiaan van Stijn
75bc4c5292 daemon/server/router/container: request sysInfo from daemon / backend
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-28 18:32:14 +02:00
Sebastiaan van Stijn
02867f9473 runconfig: rewrite ContainerDecoder to DecodeCreateRequest
Now that we no longer need the ContainerDecoder interface, we can
simplify this to just a function; effectively the ContainerDecoder
had three tasks;

- decode a container.CreateRequest
- validate the hostConfig
- split the container.CreateRequest to Config, HostConfig, and NetworkingConfig

Rewrite this to a DecodeCreateRequest function that returns
a DecodeCreateRequest.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-28 18:32:14 +02:00
Sebastiaan van Stijn
5e567a3856 daemon/server/httputils: remove ContainerDecoder interface
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-28 18:32:14 +02:00
Sebastiaan van Stijn
1d6d8f390f Merge pull request #50495 from thaJeztah/move_back_StateStatus_take2
api/types/container: move StateStatus, NewStateStatus internal again
2025-07-28 17:30:48 +02:00
Sebastiaan van Stijn
ec3e83a7b5 api/types/container: move StateStatus, NewStateStatus internal again
These types used to be internal to the container package, but were
moved to the API in 100102108b.

However, the `StateStatus` type is only used internally; it's used
as an intermediate type because [`container.State`] contains a sync.Mutex
field which would make copying it unsafe (see [moby@2998945]).

This moves the type and re-introduces an internal type
in the original location, effectively reverting
100102108b

[`container.State`]: 19e79906cb/container/state.go (L15-L23)
[moby@2998945]: 2998945a54

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-28 13:57:10 +02:00
Sebastiaan van Stijn
25e2b4d485 Merge pull request #50540 from thaJeztah/fix_vendor
fix vendor
2025-07-28 13:56:25 +02:00
Rob Murray
3555bb4193 Merge pull request #50539 from robmry/iptables_remove_unused_sctp_checksum
iptables: remove deprecated SCTP checksum rule
2025-07-28 12:19:28 +01:00
Sebastiaan van Stijn
a362ae937b Merge pull request #50532 from thaJeztah/runconfig_rm_errors
runconfig: remove exported errors
2025-07-28 12:46:28 +02:00
Sebastiaan van Stijn
bc6851e5a1 Merge pull request #50521 from thaJeztah/move_StatsResponseReader
api/types/container.StatsResponseReader: move to client
2025-07-28 12:31:33 +02:00
Sebastiaan van Stijn
dbfe7649e0 Merge pull request #50525 from thaJeztah/migrate_defaultshmsize_test
integration-cli: migrate TestPostContainersCreateShmSizeXXX to integration
2025-07-28 12:17:17 +02:00
Sebastiaan van Stijn
667cb4bec8 fix vendor
follow-up to e6298db297, which for some
reason didn't cause CI to fail.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-28 11:53:45 +02:00
Sebastiaan van Stijn
26fda349b8 runconfig: remove exported errors
These errors were not used as sentinel error, and used as any other
"invalid parameter" / "invalid argument" error, so remove them, and
just produce errors where used.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-28 11:46:19 +02:00
Sebastiaan van Stijn
bf8b738ed5 Merge pull request #50458 from thaJeztah/commit_simplify
daemon/server/router/container: postCommit: only decode Config
2025-07-28 11:30:51 +02:00
Rob Murray
969b293778 iptables: remove SCTP checksum rule
Since 28.0.0, an iptables rule related to SCTP has only been
included if escape hatch variable DOCKER_IPTABLES_SCTP_CHECKSUM=1

Nobody's reported that the escape hatch was needed, and the rule
it guards doesn't make sense. So, remove.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-07-28 10:26:01 +01:00
Sebastiaan van Stijn
a7d4b915c3 Merge pull request #50524 from thaJeztah/cleanup_testutils
integration, integration-cli: remove various deprecated test-utilities, and some minor (linting) fixes
2025-07-28 11:11:48 +02:00
Paweł Gronowski
79dd3b0fd3 Merge pull request #50537 from ndeloof/cli
cli/ is not in moby repo (anymore)
2025-07-28 08:49:33 +00:00
Paweł Gronowski
2406d7bdb5 Merge pull request #50534 from thaJeztah/move_backend
api/types: move backend types to daemon/server
2025-07-28 08:42:53 +00:00
Paweł Gronowski
72455d522e Merge pull request #50528 from thaJeztah/checkpoint_no_decoder
daemon/server/router/checkpoint: remove unused httputils.ContainerDecoder
2025-07-28 08:10:57 +00:00
Nicolas De Loof
e6298db297 cli/ is not in moby repo (anymore)
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2025-07-28 10:01:58 +02:00
Sebastiaan van Stijn
83510a26b3 api/types: move backend types to daemon/server
The "backend" types in API were designed to decouple the API server
implementation from the daemon, or other parts of the code that
back the API server. This would allow the daemon to evolve (e.g.
functionality moved to different subsystems) without that impacting
the API server's implementation.

Now that the API server is no longer part of the API package (module),
there is no benefit to having it in the API module. The API server
may evolve (and require changes in the backend), which has no direct
relation with the API module (types, responses); the backend definition
is, however, coupled to the API server implementation.

It's worth noting that, while "technically" possible to use the API
server package, and implement an alternative backend implementation,
this has never been a prime objective. The backend definition was
never considered "stable", and we don't expect external users to
(attempt) to use it as such.

This patch moves the backend types to the daemon/server package,
so that they can evolve with the daemon and API server implementation
without that impacting the API module (which we intend to be stable,
following SemVer).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-28 00:03:04 +02:00
Sebastiaan van Stijn
be27300c6e daemon/server/router/checkpoint: remove unused httputils.ContainerDecoder
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-27 15:19:50 +02:00
Sebastiaan van Stijn
b448dc5575 daemon/server/router/container: postCommit: only decode Config
The postCommit used the container-decoder from runconfig to unmarshal
the body. However, this function was written to decode a container
CreateRequest. Commit only accepts a container Config, so we can
just unmarshal to that type.

A local `commitRequest` type was added because the client posts a bare
`*container.Config` but it may be empty / nil (see [Client.ContainerCommit]
and [container.CommitOptions]), in which case it must be ignored, and no
overrides to be applied.

[Client.ContainerCommit]: c4afa77157/client/container_commit.go (L52)
[container.CommitOptions]: c4afa77157/api/types/container/options.go (L30)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-27 14:38:18 +02:00
Sebastiaan van Stijn
6b4dfb0135 integration-cli: migrate TestPostContainersCreateShmSizeXXX to integration
Some of these tests were making assumptions about the daemon's internals
by using `config.DefaultShmSize` from the daemon config package.

Rewrite them to start a daemon with a custom default, and verify the
tests to use that default.

This migrates the following tests from integration-cli to integration;

- `DockerAPISuite.TestPostContainersCreateShmSizeNegative`
- `DockerAPISuite.TestPostContainersCreateShmSizeHostConfigOmitted`
- `DockerAPISuite.TestPostContainersCreateShmSizeOmitted`
- `DockerAPISuite.TestPostContainersCreateWithShmSize`

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-26 20:52:00 +02:00
Sebastiaan van Stijn
617326a40c testutil, integration-cli: fix minor linting issues
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-26 16:34:31 +02:00
Sebastiaan van Stijn
da92ea2837 integration-cli/daemon: rewrite CheckActiveContainerCount with client
Use the API-client instead of shelling out to the CLI.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-26 16:34:30 +02:00
Sebastiaan van Stijn
6adbeff449 integration-cli: remove parseEventTime utility
It was only used in a single test.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-26 16:34:30 +02:00
Sebastiaan van Stijn
281a3f6c41 integration-cli: remove deprecaed inspectMountSourceField
The replacement is also deprecated, but at least returns a strong type,
which may help transitioning to using an api-client for these, and
removing one abstraction at a time.

Also rewriting the TestContainerAPIDeleteRemoveVolume to use the API
client (as it's part of the API suite), and touched-up the
TestRunMountShmMqueueFromHost test a bit.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-26 16:34:24 +02:00
Sebastiaan van Stijn
6124c00827 integration-cli: buildImageSuccessfully: don't wrap buildImage
Both are deprecated, but removing one abstraction at a time.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-26 13:05:40 +02:00
Sebastiaan van Stijn
877529c62d integration-cli: remove deprecated inspectFieldWithError utility
The replacement is also deprecated, but removing one abstraction at a time

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-26 13:00:11 +02:00
Sebastiaan van Stijn
68480dc11d integration-cli: remove createTmpFile utility
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-26 12:48:59 +02:00
Sebastiaan van Stijn
29a7d4039e integration-cli: remove deprecated inspectFieldMap utility
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-26 12:32:30 +02:00
Sebastiaan van Stijn
d100fd6a77 integration/system: remove "hdr" utility
It was a very shallow wrapper around reading the response
headers, and querying those directly is more transparent.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-26 12:19:22 +02:00
Sebastiaan van Stijn
97827e1a58 integration-cli: TestContainerAPIGetExport: fix minor linting issues
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-26 11:22:42 +02:00
Sebastiaan van Stijn
f73aba83dc client: TestContainerStats: fix minor linting issues
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-26 11:22:42 +02:00
Sebastiaan van Stijn
f67e6555bf api/types/container.StatsResponseReader: move to client
This type was only used in the client, and needs a rewrite; let's
move it to the client first.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-26 11:22:36 +02:00
Sebastiaan van Stijn
c4afa77157 Merge pull request #50518 from thaJeztah/fix_du_options
api: move "DiskUsage" related types to the right location
2025-07-26 02:02:15 +02:00
Sebastiaan van Stijn
4dda328af8 client: rename files for system-commands to their canonical name
It took me some time to find these commands because they were not named
after their canonical name, unlike (most) other commands.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-26 00:12:36 +02:00
Sebastiaan van Stijn
96a6884cb3 api/types: move DiskUsage types to api/types/system
Now that the types for the backend were moved to api/types/backend,
we can move the actual response-type and related options to
api/types/system.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-26 00:12:29 +02:00
Sebastiaan van Stijn
82c069c857 api/types/system: move DiskUsage, DiskUsageOptions to api/types/backend
These types were introduced in f07242f6d7,
but while their description mentions it's the type used for the
response, it actually isn't, and it's used by the backend, but
ultimately marshaled to the "types.DiskUsage" struct;

7dc46c6e0c/daemon/server/router/system/system_routes.go (L254-L270)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-26 00:09:24 +02:00
Sebastiaan van Stijn
436a546c30 Merge pull request #50510 from corhere/kill-api-types-client
api/types: move client.go contents into moby/moby/client
2025-07-26 00:05:18 +02:00
Sebastiaan van Stijn
58bd636c3d Merge pull request #50516 from thaJeztah/integration_cli_rm_requirements
integration-cli: remove "requirement" package
2025-07-25 21:09:26 +02:00
Cory Snider
24aa86991c api/types: move PluginCreateOptions to client
While it is imported by both the client and the daemon, values of the
PluginCreateOptions struct are not marshaled or unmarshaled. The only
field is mapped to and from an HTTP query parameter. Furthermore, this
options type is the odd one out: the daemon uses types in
api/types/backend to pass options around for the other plugin lifecycle
operations. Move the PluginCreateOptions type into client, and define a
new PluginCreateConfig struct in api/types/backend for the daemon to use
alongside PluginRmConfig, PluginEnableConfig and PluginDisableConfig.

Signed-off-by: Cory Snider <csnider@mirantis.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-25 19:51:58 +02:00
Cory Snider
b93ad81898 api/types: move plugin client options into client
These types are only consumed by the client, not the daemon.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-07-25 19:51:58 +02:00
Cory Snider
44ae4cd2b7 api/types: move HijackedResponse into client
Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-07-25 19:51:58 +02:00
Sebastiaan van Stijn
f491b70aa4 integration-cli: remove "requirement" package
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-25 17:49:30 +02:00
Sebastiaan van Stijn
7dc46c6e0c Merge pull request #50504 from thaJeztah/pkg_stringid
pkg/stringid: deprecate, move to daemon, and provide copy in client
2025-07-25 16:00:06 +02:00
Sebastiaan van Stijn
ca1c5ee08f pkg/stringid: move to daemon, and provide copy in client
The stringid package is used in many places; while it's trivial
to implement a similar utility, let's just provide it as a utility
package in the client, removing the daemon-specific logic.

For integration tests, I opted to use the implementation in the
client, as those should not ideally not make assumptions about
the daemon implementation.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-25 13:39:32 +02:00
Sebastiaan van Stijn
57e1cb2a28 Merge pull request #50446 from dmcgowan/move-image-daemon
Move remaining image packages to daemon
2025-07-25 13:03:40 +02:00
Derek McGowan
0abcdb7405 Update golangci for lazyregexp
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-24 12:21:11 -07:00
Derek McGowan
6514282136 Move internal/testutils/networking to integration/internal/testutils/networking
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-24 12:16:06 -07:00
Derek McGowan
14eb2770b9 Move internal/unshare to daemon/internal/unshare
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-24 12:15:50 -07:00
Derek McGowan
28de87fb28 Move internal/unix_noeintr to daemon/internal/unix_noeintr
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-24 12:15:34 -07:00
Derek McGowan
5b913b3ea0 Move internal/sliceutil to daemon/internal/sliceutil
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-24 12:15:19 -07:00
Derek McGowan
20cc1a6203 Move internal/rootless to daemon/internal/rootless
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-24 12:15:02 -07:00
Derek McGowan
8042010175 Move internal/platform to daemon/internal/platform
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-24 12:14:46 -07:00
Derek McGowan
c3b0e0130a Move internal/otelutil to daemon/internal/otelutil
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-24 12:14:30 -07:00
Derek McGowan
b62b542c2e Move internal/opts to daemon/internal/opts
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-24 12:14:14 -07:00
Derek McGowan
713d7f5ed1 Move internal/nlwrap to daemon/libnetwork/nlwrap
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-24 12:13:58 -07:00
Derek McGowan
fd21e3b935 Move internal/multierror to daemon/internal/multierror
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-24 12:13:42 -07:00
Derek McGowan
baea1c5092 Move internal/ioutils to daemon/internal/ioutils
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-24 12:13:26 -07:00
Derek McGowan
50743e3f38 Move internal/containerfs to daemon/internal/containerfs
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-24 12:13:10 -07:00
Derek McGowan
ca9c4dffb7 Move internal/cleanups to daemon/internal/cleanups
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-24 12:12:54 -07:00
Derek McGowan
222b2b8b2f Move internal/lazyregexp to daemon/internal/lazyregexp
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-24 12:12:38 -07:00
Derek McGowan
9566272f30 Move pkg/tarsum to daemon/builder/remotecontext/internal/tarsum
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-24 12:12:23 -07:00
Derek McGowan
ca5d2348d0 Move pkg/idtools to daemon/internal/idtools
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-24 12:12:07 -07:00
Derek McGowan
7bfb804dbe Move registry to daemon/pkg/registry
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-24 12:11:51 -07:00
Derek McGowan
f1f83dae55 Move reference to daemon/internal/refstore
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-24 12:11:35 -07:00
Derek McGowan
c74ba95583 Move oci to daemon/pkg/oci
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-24 12:11:19 -07:00
Derek McGowan
f24455c90b Move image to daemon/internal/image
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-24 12:11:02 -07:00
Derek McGowan
1ff6011e04 Move distribution to daemon/internal/distribution
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-24 12:10:46 -07:00
Derek McGowan
fa9a3c383d Move layer to daemon/internal/layer
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-24 12:10:30 -07:00
Rob Murray
462567acd6 Merge pull request #50505 from robmry/remove_TestRunDNSOptionsBasedOnHostResolvConf
Delete TestRunDNSOptionsBasedOnHostResolvConf
2025-07-24 17:00:43 +01:00
Sebastiaan van Stijn
49306c607b Merge pull request #50500 from thaJeztah/registry_fix_linting
registry: fix assorted linting issues
2025-07-24 16:00:36 +02:00
Paweł Gronowski
6cea77117d Merge pull request #50443 from corhere/fix-firewalld-reload
libnetwork/d/{bridge,overlay}: fix firewalld reload handling
2025-07-24 15:58:09 +02:00
Paweł Gronowski
665eb3aa88 Merge pull request #50386 from crazy-max/build-device-entitlement
build: device entitlement support
2025-07-24 15:57:52 +02:00
Rob Murray
3003c56c57 Delete TestRunDNSOptionsBasedOnHostResolvConf
Because:
- it's the last thing outside 'daemon/' that uses libnetwork's
  resolvconf package
- there's better coverage of the host resolv.conf transformations
  in the resolvconf package's unit tests
- there are integration tests that don't modify the test host's
  resolv.conf file in 'integration/networking/resolvconf_test.go'

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-07-24 14:51:22 +01:00
Sebastiaan van Stijn
1f88663afc Merge pull request #50503 from thaJeztah/pkg_stringid_docs
pkg/stringid: TruncateID: touch-up doc
2025-07-24 14:23:36 +02:00
Sebastiaan van Stijn
3205fcf6c7 pkg/stringid: TruncateID: touch-up doc
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-24 12:41:10 +02:00
Paweł Gronowski
f37c1c6abb Merge pull request #50404 from thaJeztah/saner_copy_defaults
daemon: ContainerExtractToDir: make AllowOverwriteDirWithFile opt-in
2025-07-24 12:35:25 +02:00
Sebastiaan van Stijn
4929f522b8 Merge pull request #50498 from thaJeztah/registry_rm_deprecated
registry: remove deprecated RepositoryInfo.Official, Class fields
2025-07-24 11:30:15 +02:00
Sebastiaan van Stijn
6ed00d5044 registry: ConvertToHostname: use strings.Cut
Also prevents linters from flagging the use of "http://".

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-24 11:07:31 +02:00
Sebastiaan van Stijn
547a2db21d registry: TestNewIndexInfo: inline testIndexInfo (thelper)
It's not really a helper, and it's trivial to inline it;

    registry/registry_test.go:366:19: test helper function should start from t.Helper() (thelper)
      testIndexInfo := func(t *testing.T, config *serviceConfig, expectedIndexInfos map[string]*registry.IndexInfo) {
                       ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-24 11:00:52 +02:00
Sebastiaan van Stijn
5ea78575e7 registry: fix assorted gocritic issues
registry/auth.go:43:31: import-shadowing: The name 'auth' shadows an import name (revive)
    func NewStaticCredentialStore(auth *registry.AuthConfig) auth.CredentialStore {
                                  ^
    registry/auth.go:63:7: unused-receiver: method receiver 'scs' is not referenced in method's body, consider removing or renaming it as _ (revive)
    func (scs staticCredentialStore) SetRefreshToken(*url.URL, string, string) {
          ^
    registry/auth.go:143:40: import-shadowing: The name 'transport' shadows an import name (revive)
    func PingV2Registry(endpoint *url.URL, transport http.RoundTripper) (challenge.Manager, error) {
                                           ^
    registry/registry_mock_test.go:85:22: response body must be closed (bodyclose)
        res, err := http.Get(makeURL("/v1/_ping"))
                            ^
    registry/search_session.go:222:96: integer-format: fmt.Sprintf can be replaced with faster strconv.Itoa (perfsprint)
      u := r.indexEndpoint.String() + "search?q=" + url.QueryEscape(term) + "&n=" + url.QueryEscape(fmt.Sprintf("%d", limit))
                                                                                                    ^
    registry/auth.go:134:24: import-shadowing: The name 'url' shadows an import name (revive)
    func ConvertToHostname(url string) string {
                           ^
    registry/search_endpoint_v1.go:61: line-length-limit: line is 437 characters, out of limit 200 (revive)
                      return nil, invalidParamf("invalid registry endpoint %s: %v. If this private registry supports only HTTP or HTTPS with an unknown CA certificate, please add `--insecure-registry %s` to the daemon's arguments. In the case of HTTPS, if you have access to the registry's CA certificate, no need for the flag; simply place the CA certificate at /etc/docker/certs.d/%s/ca.crt", endpoint, err, endpoint.URL.Host, endpoint.URL.Host)
    registry/search_endpoint_v1.go:166:17: import-shadowing: The name 'transport' shadows an import name (revive)
    func httpClient(transport http.RoundTripper) *http.Client {
                    ^
    registry/search_session.go:239:26: ST1005: error strings should not be capitalized (staticcheck)
              return nil, errUnknown{fmt.Errorf("Unexpected status code %d", res.StatusCode)}
                                     ^
    registry/search_test.go:18:6: test helper function should start from t.Helper() (thelper)
    func spawnTestRegistrySession(t *testing.T) *session {
         ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-24 10:57:18 +02:00
Sebastiaan van Stijn
406ee2feb5 registry: translateV2AuthError: fix singleCaseSwitch (gocritic)
registry/errors.go:11:2: singleCaseSwitch: should rewrite switch statement to if statement (gocritic)
        switch e := err.(type) {
        ^
     registry/errors.go:13:3: singleCaseSwitch: should rewrite switch statement to if statement (gocritic)
            switch e2 := e.Err.(type) {
            ^
     registry/errors.go:15:4: singleCaseSwitch: should rewrite switch statement to if statement (gocritic)
                switch e2.Code {
                ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-24 10:33:44 +02:00
Sebastiaan van Stijn
ecb0354da5 registry: isCIDRMatch: fix captLocal (gocritic)
registry/config.go:267:46: captLocal: `URLHost' should not be capitalized (gocritic)
        func isCIDRMatch(cidrs []*registry.NetIPNet, URLHost string) bool {

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-24 10:33:44 +02:00
Sebastiaan van Stijn
1ceda96864 registry: serviceConfig.loadInsecureRegistries: fix ifElseChain (gocritic)
registry/config.go:171:3: ifElseChain: rewrite if-else to switch statement (gocritic)
            if strings.HasPrefix(strings.ToLower(r), "http://") {
            ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-24 10:33:44 +02:00
Sebastiaan van Stijn
fcb916ad17 Merge pull request #50487 from thaJeztah/deprecate_strslice_step1
remove, update tests for deprecated API versions
2025-07-24 03:15:46 +02:00
Sebastiaan van Stijn
84083b0037 Merge pull request #50496 from thaJeztah/rm_old_doc
docs: remove old rootless placeholder
2025-07-24 03:15:00 +02:00
Sebastiaan van Stijn
d4e85443ff registry: remove deprecated RepositoryInfo.Class field
This was deprecated in 5f91c769f5, which
was part of the v28.x release, and is no longer used so we can remove.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-24 03:04:22 +02:00
Sebastiaan van Stijn
cc2d564a9e registry: remove deprecated RepositoryInfo.Official field
This was deprecated in 08654b0b30, which
was part of the v28.x release, and is no longer used so we can remove.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-24 03:04:16 +02:00
Sebastiaan van Stijn
ef9ce55ccf Merge pull request #50491 from thaJeztah/move_api_docs
api: move docs to api module
2025-07-24 02:12:13 +02:00
Sebastiaan van Stijn
c76f014a14 Merge pull request #50497 from thaJeztah/rm_contrib_gdb
contrib: remove gitdm
2025-07-24 02:10:26 +02:00
Sebastiaan van Stijn
5850abd9c7 Merge pull request #50492 from thaJeztah/rm_container_stats
api/types/container: remove deprecated Stats type
2025-07-24 02:09:49 +02:00
Sebastiaan van Stijn
38453db513 contrib: remove gitdm
This was added in bf6d52bba1, but don't
think it was ever used; at least it's severely outdated, so let's
remove it.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-24 00:54:01 +02:00
Sebastiaan van Stijn
0d9304c9e1 docs: remove old rootless placeholder
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-24 00:50:34 +02:00
Andrey Epifanov
a1f68bf5a6 overlay: Reload Ingress iptables rules in swarm mode
- Implement firewalld reload handling for Ingress rules restoration
- Add TestRestoreIngressRulesOnFirewalldReload() integration test

Signed-off-by: Andrey Epifanov <aepifanov@mirantis.com>
2025-07-23 15:52:10 -04:00
Andrey Epifanov
8b208f1b95 libnetwork: split programIngress() and dependent functions on Add and Del functions
- refactor programIngressPorts to use Rule.Insert/Append/Delete for improved rule management
- split programIngress() and dependent functions on Add and Del functions

Signed-off-by: Andrey Epifanov <aepifanov@mirantis.com>
2025-07-23 14:06:47 -04:00
Andrey Epifanov
50e6f4c4cb libnetwork: refactor ingress chain management for improved rule handling and initialization
Signed-off-by: Andrey Epifanov <aepifanov@mirantis.com>
2025-07-23 14:06:47 -04:00
Andrey Epifanov
4f0485e45f libnetwork: add FlushChain methods for improved iptables management
Signed-off-by: Andrey Epifanov <aepifanov@mirantis.com>
2025-07-23 14:06:47 -04:00
Andrey Epifanov
262c32565b libnetwork: refactor rule management to use Ensure method for Append and Insert operations
Signed-off-by: Andrey Epifanov <aepifanov@mirantis.com>
2025-07-23 14:06:47 -04:00
Andrey Epifanov
19a8083866 libnetwork: refactor iptable functions to include table parameter for improved rule management
Signed-off-by: Andrey Epifanov <aepifanov@mirantis.com>
2025-07-23 14:06:47 -04:00
Andrey Epifanov
c2e2e7fe24 libnetwork: extract plumpIngressProxy steps in a separate function
- Extract plumpIngressProxy steps in a separate function
- Don't create a new listener if there's already one in ingressProxyTbl

Signed-off-by: Andrey Epifanov <aepifanov@mirantis.com>
2025-07-23 14:06:47 -04:00
Andrey Epifanov
51ed289b06 libnetwork: extract programIngressPorts steps in a separate functions
Signed-off-by: Andrey Epifanov <aepifanov@mirantis.com>
2025-07-23 14:06:47 -04:00
Andrey Epifanov
752758ae77 libnetwork: extract creation/initiation of INGRESS-DOCKER chains in separate function
Signed-off-by: Andrey Epifanov <aepifanov@mirantis.com>
2025-07-23 14:06:47 -04:00
Andrey Epifanov
07393071ad bridge: Reapply endpoint iptables rules on firewalld reload
Signed-off-by: Andrey Epifanov <aepifanov@mirantis.com>
2025-07-23 14:06:44 -04:00
Rob Murray
6d457d9695 bridge: Trigger firewalld reload during bridge integration tests
Make sure iptables rules are restored properly once firewalld
has deleted them.

Signed-off-by: Rob Murray <rob.murray@docker.com>
Signed-off-by: Andrey Epifanov <aepifanov@mirantis.com>
2025-07-23 14:01:29 -04:00
Cory Snider
3c8ba15294 Merge pull request #50393 from corhere/libn/handle-coalesced-updates
libnetwork, libn/d/overlay: handle coalesced updates from NetworkDB
2025-07-23 14:00:50 -04:00
Sebastiaan van Stijn
f1a97bda3d api/types/container: remove deprecated Stats type
This type was deprecated in ca06b222e3,
and is no longer used. Now that the API is in a new module, we can
remove the alias.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-23 18:36:21 +02:00
Sebastiaan van Stijn
4d5a7289a0 api: move docs to api module
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-23 17:44:18 +02:00
Sebastiaan van Stijn
496c555d75 Merge pull request #50489 from thaJeztah/50166_followup
adjust minimum API-version for multiple platforms on save/load
2025-07-23 17:10:40 +02:00
Austin Vazquez
addc37324a Merge pull request #50485 from thaJeztah/client_remove_deprecated
client: remove deprecated types and functions
2025-07-23 07:28:13 -07:00
Sebastiaan van Stijn
bdcf4e8c85 adjust minimum API-version for multiple platforms on save/load
Follow-up to fcc8209e12, which didn't
make the window for API v1.51, so had to be adjusted for the API
version it requires.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-23 15:54:47 +02:00
Paweł Gronowski
e870545dd4 Merge pull request #50479 from mdaffad/50159-migrate-test-api-client-version-old-not-supported
integration-cli: migrate TestAPIClientVersionOldNotSupported to integration
2025-07-23 15:54:16 +02:00
Sebastiaan van Stijn
a401c0c046 runconfig: update fixtures for TestDecodeContainerConfig
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-23 15:34:46 +02:00
Sebastiaan van Stijn
1378604cc3 integration-cli: remove tests for pre-docker 1.7 clients
The strslice.StrSlice type is a string-slice with a custom JSON Unmarshal
function to provide backward-compatibility with older API requests from
before docker 1.7 (see [moby@17d6f00] and [moby@ea4a067]), which used a
string instead of an array of strings for some fields (Cmd, Entrypoint).

We no longer support those API versions, and we no longer support pulling
v1 images that may contain such a config, so we can remove these tests that
validate the behavior as they're invalid API requests.

This;

- removes DockerAPISuite.TestPostContainerAPICreateWithStringOrSliceEntrypoint
- removes DockerAPISuite.TestPostContainersCreateWithStringOrSliceCmd
- removes DockerAPISuite.TestPostContainersCreateWithStringOrSliceCapAddDrop
- updates DockerAPISuite.TestContainerAPIPostCreateNull, which used an invalid example

[moby@17d6f00]: 17d6f00ec2
[moby@ea4a067]: ea4a06740b

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-23 14:48:21 +02:00
Sebastiaan van Stijn
8d8bbefb90 client: remove deprecated CommonAPIClient interface
This interface was marked deprecated in 2997c0ddc0.

Now that the client is in a new module, we can remove the old.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-23 13:56:35 +02:00
Sebastiaan van Stijn
728f0769e1 client: remove deprecated ImageInspectWithRaw
This function was deprecated in 639a1214fa.
Now that the client is in a new module, we can remove the old.

This;

- Removes the `Client.ImageInspectWithRaw` implementation.
- Removes `ImageAPIClient.ImageInspectWithRaw` from the `ImageAPIClient` interface.
- Removes `APIClient.ImageInspectWithRaw` from the `APIClient` interface.
- Removes `ImageAPIClientDeprecated.ImageInspectWithRaw` from the `ImageAPIClientDeprecated`.
- Removes the `ImageAPIClientDeprecated` interface.

Note that the `ImageAPIClientDeprecated` interface itself was not marked
as deprecated, but it has no known external users, and it has no remaining
definitions.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-23 13:56:35 +02:00
Sebastiaan van Stijn
2f200f9e05 client: remove deprecated IsErrNotFound helper
This function was marked deprecated in 7aa7369f1f,
and is no longer used.

Now that the client is in a new module, we can remove the old.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-23 13:56:35 +02:00
Sebastiaan van Stijn
5ed9891eed client: remove deprecated ErrorConnectionFailed helper
This function was only used internally, and marked deprecated in
846b2272e6.

Now that the client is in a new module, we can remove the old.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-23 13:56:34 +02:00
Sebastiaan van Stijn
a0fa5da2ab client: remove deprecated NewClient and NewEnvClient functions
The `NewClient` and `NewEnvClient` function were deprecated in 2018
through 772edd020c, with the deprecation
message updated in a68ae4a2d9 and
6b9968e8b1 to make sure it's properly
identified as deprecated.

Now that the client is in a new module, we can remove the old.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-23 13:56:31 +02:00
Sebastiaan van Stijn
f49224b352 Merge pull request #50482 from thaJeztah/container_execinspect
api/types/container: add missing type for exec-inspect response.
2025-07-23 13:55:51 +02:00
Paweł Gronowski
db33a92940 Merge pull request #50484 from thaJeztah/client_update_example
client: fix example, and update refs to old modules
2025-07-23 13:50:57 +02:00
Sebastiaan van Stijn
2e2a8a7a7b Merge pull request #50285 from thaJeztah/request_clean_errs
client: Client.doRequest: improve some connection errors
2025-07-23 13:48:40 +02:00
Sebastiaan van Stijn
db58fa5fdc Merge pull request #50483 from thaJeztah/remove_import_exception
hack/validate: remove obsolete exception, fix missing alias for stdcopy.Systemerr
2025-07-23 13:31:48 +02:00
Sebastiaan van Stijn
96cbee8c60 Merge pull request #50166 from ctalledo/fix-for-48759
Add support for multiple platforms in image export and load
2025-07-23 12:52:34 +02:00
Rob Murray
b0c22a931d Merge pull request #50476 from robmry/bridge-accept-fw-mark
Add option --bridge-accept-fwmark
2025-07-23 10:55:36 +01:00
Rob Murray
2dbde139ee Merge pull request #50140 from robmry/non-gateway_routed_access
Always allow access to published ports on addresses in gateway mode "routed" networks
2025-07-23 10:54:47 +01:00
Sebastiaan van Stijn
30322dd649 client: fix example, and update refs to old modules
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-23 10:57:06 +02:00
Sebastiaan van Stijn
4859497098 pkg/stdcopy: fix missing alias for stdcopy.Systemerr
This was missed in 20d594fb79

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-23 01:35:06 +02:00
Sebastiaan van Stijn
01c7b4233c hack/validate: remove obsolete exception
This was added in 20d594fb79, but was
written before the API module was added. Now that the API is a separate
module, the check will no longer flag packages importing the API.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-23 01:35:00 +02:00
Cesar Talledo
b91ebbde6d Refactor containerd platform matchers.
Merge the matchAllWithPreference matcher into the matchAnyWithPreference
matcher to reduce code duplication and simplify the code.

Signed-off-by: Cesar Talledo <cesar.talledo@docker.com>
2025-07-23 01:31:39 +02:00
Cesar Talledo
fcc8209e12 Add support for multiple platforms in image export and loading.
Currently the image export and load APIs can be used to export or load all
platforms for the image, or a single specified platform.

This commit updates the API so that it accepts a list of platforms to export or
load, thereby giving clients the ability to export only selected platforms of an
image into a tar file, or load selected platforms from a tar file.

Unit and integration tests were updated accordingly.

As this requires a daemon API change, the API version was bumped.

Signed-off-by: Cesar Talledo <cesar.talledo@docker.com>
2025-07-23 01:31:36 +02:00
Sebastiaan van Stijn
2303e6bff6 client: Client.doRequest: add special handling for DNS resolution errors
Before this patch:

    DOCKER_HOST=tcp://example.invalid/docker docker version
    error during connect: Get "http://example.invalid:2375/docker/v1.51/version": dial tcp: lookup example.invalid: no such host

With this patch:

    DOCKER_HOST=tcp://example.invalid/docker docker version
    failed to connect to the docker API at tcp://example.invalid:2375/docker: lookup example.invalid: no such host

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-23 01:20:54 +02:00
Sebastiaan van Stijn
67596f01e2 client: Client.doRequest: add special handling for "not found" errors
Before this change, a generic "Cannot connect to the docker daemon" error
was produced which, while helpful, instructed the user to check if the daemon
was running, but didn't provide context on the reason we failed (i.e., the
socket was not found).

This patch adds a dedicated check for cases where the socket was not found,
and preserves the original error.

Before this patch:

    DOCKER_HOST=unix:///var/run/no.sock docker version
    Cannot connect to the Docker daemon at unix:///var/run/no.sock. Is the docker daemon running?

With this patch:

    DOCKER_HOST=unix:///var/run/no.sock docker version
    failed to connect to the docker API at unix:///var/run/no.sock; check if the path is correct and the daemon is running: dial unix /var/run/no.sock: connect: no such file or directory

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-23 01:20:30 +02:00
Sebastiaan van Stijn
462d0ff5aa client: Client.doRequest: simplify permission check and unwrap error
Previously, we were using os.IsPermission, which doesn't unwrap errors;
change to use `errors.Is` to detect permission errors, and unwrap the
error to remove information about the request, which is irrelevant if
we weren't able to connect in the first place.

Also tweak the error slightly to not assume "docker socket", instead
mentioning "docker API".

Before this;

    permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/v1.51/version": dial unix /var/run/docker.sock: connect: permission denied

With this patch applied:

    permission denied while trying to connect to the docker API at unix:///var/run/docker.sock: dial unix /var/run/docker.sock: connect: permission denied

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-23 01:20:01 +02:00
Sebastiaan van Stijn
7072acac79 client: Client.doRequest: preserve wrapped error
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-23 01:19:35 +02:00
Sebastiaan van Stijn
3b4fbaacd7 client: Client.doRequest: use early return
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-23 01:19:11 +02:00
Sebastiaan van Stijn
c55a163523 Merge pull request #50474 from thaJeztah/rm_go_build
api: remove references to old module name
2025-07-22 22:59:35 +02:00
Austin Vazquez
38a612c2f0 Merge pull request #50481 from thaJeztah/migrate_profiles
profiles/apparmor, seccomp: migrate to separate module
2025-07-22 11:50:31 -07:00
Rob Murray
cf1695bef1 Add option --bridge-accept-fwmark
Packets with the given firewall mark are accepted by the bridge
driver's filter-FORWARD rules.

The value can either be an integer mark, or it can include a
mask in the format "<mark>/<mask>".

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-07-22 19:15:02 +01:00
Sebastiaan van Stijn
2a342079c6 api/types/container: add missing type for exec-inspect response.
While the container package had a type for `ExecInspect`, this type only
contained the information currently used by the client, which was a subset
of the information returned by the API endpoint;

    curl --unix-socket /var/run/docker.sock http://localhost/v1.51/exec/2f8fc8b4b5003e9a58d97459e6561f2bf2d88bc059bc59c6633e7f765fb8d1e9/json | jq .
    {
      "ID": "2f8fc8b4b5003e9a58d97459e6561f2bf2d88bc059bc59c6633e7f765fb8d1e9",
      "Running": true,
      "ExitCode": null,
      "ProcessConfig": {
        "tty": true,
        "entrypoint": "bash",
        "arguments": [],
        "privileged": false
      },
      "OpenStdin": true,
      "OpenStderr": true,
      "OpenStdout": true,
      "CanRemove": false,
      "ContainerID": "8b7cd6b151613ccc20ebe9fc24d72cc7865b04c592848ab1415a80da9b315479",
      "DetachKeys": "EBE=",
      "Pid": 19964
    }

The API documentation for the endpoint documented the full response, but
we did not have a type for this, other than a type used by the backend.

This patch adds a type for the response. It currently aliases the backend
type to this type to preserve backward compatibility (and allow the API
module to be used in older branches). We can probably switch the backend
to use this type directly though (unless we want the backend to be
decoupled from the API response).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-22 19:28:04 +02:00
Sebastiaan van Stijn
a600da91f4 profiles/apparmor, seccomp: migrate to separate module
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-22 18:48:39 +02:00
Rob Murray
0c60a0e482 Merge pull request #50467 from robmry/no_nftables_in_swarm
No nftables in swarm
2025-07-22 16:58:26 +01:00
Rob Murray
30752f0780 Always allow access to routed endpoints
When an endpoint in a gateway mode "nat" network is selected
as a container's default gateway, the bridge driver sets up
bindings between host and container ports (NAT, userland proxy
etc).

When gateway mode "routed" was added as an alternative to
the default "nat" mode - port bindings followed the same rules.

But, unlike "nat" mode, there's no host port binding to set
up - there's routing between remote client and the container,
so it doesn't matter what the default gateway is.

So, in "routed" mode, set up the rules to make a container's
published ports accessible when the endpoint is added, and
remove those rules when the endpoint is removed (when the
container is disconnected from the endpoint's network).

Port mappings are only provided by ProgramExternalConnectivity,
they can't be set up during the Join. So, include routed
bindings in the port bindings mode that's stored as part of
endpoint state - and use that to work out whether to add or
remove bindings.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-07-22 16:51:59 +01:00
Cory Snider
4538a1de0a libnetwork: handle coalesced endpoint events
The eventually-consistent nature of NetworkDB means we cannot depend on
events being received in the same order that they were sent. Nor can we
depend on receiving events for all intermediate states. It is possible
for a series of entry UPDATEs, or a DELETE followed by a CREATE with the
same key, to get coalesced into a single UPDATE event on the receiving
node. Watchers of NetworkDB tables therefore need to be prepared to
gracefully handle arbitrary UPDATEs of a key, including those where the
new value may have nothing in common with the previous value.

The libnetwork controller naively handled events for endpoint_table
assuming that an endpoint leave followed by a rejoin of the same
endpoint would always be expressed as a DELETE event followed by a
CREATE. It would handle a coalesced UPDATE as a CREATE, adding a new
service binding without removing the old one. This would
have various side effects, such as having the "transient state" of
having multiple conflicting service bindings where more than one
endpoint is assigned an IP address never settling.

Modify the libnetwork controller to handle an UPDATE by removing the
previous service binding then adding the new one.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-07-22 11:51:18 -04:00
Cory Snider
e1a586a9a7 libnetwork/d/overlay: handle coalesced peer updates
The eventually-consistent nature of NetworkDB means we cannot depend on
events being received in the same order that they were sent. Nor can we
depend on receiving events for all intermediate states. It is possible
for a series of entry UPDATEs, or a DELETE followed by a CREATE with the
same key, to get coalesced into a single UPDATE event on the receiving
node. Watchers of NetworkDB tables therefore need to be prepared to
gracefully handle arbitrary UPDATEs of a key, including those where the
new value may have nothing in common with the previous value.

The overlay driver naively handled events for overlay_peer_table
assuming that an endpoint leave followed by a rejoin of the same
endpoint would always be expressed as a DELETE event followed by a
CREATE. It would handle a coalesced UPDATE as a CREATE, inserting a new
entry into peerDB without removing the old one. This would
have various side effects, such as having the "transient state" of
multiple entries in peerDB with the same peer IP never settle.

Update driverapi to pass both the previous and new value of a table
entry into the driver. Modify the overlay driver to handle an UPDATE by
removing the previous peer entry from peerDB then adding the new one.
Modify the Windows overlay driver to match.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-07-22 11:51:18 -04:00
Cory Snider
8340e109de libn/d/win/overlay: dedupe NetworkDB definitions
Windows and Linux overlay driver instances are interoperable, working
from the same NetworkDB table for peer discovery. As both drivers
produce and consume serialized data through the table, they both need to
have a shared understanding of the shape and semantics of that data.
The Windows overlay driver contains a duplicate copy of the protobuf
definitions used for marshaling and unmarshaling the NetworkDB peer
entries for dubious reasons. It gives us the flexibility to have the
definitions diverge, which is only really useful for shooting ourselves
in the foot.

Make daemon/libnetwork/drivers/overlay the source of truth for the peer
record definitions and the name of the NetworkDB table for distributing
peer records.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-07-22 11:51:18 -04:00
Cory Snider
c7b93702b9 libn/d/overlay: extract hashable address types
The macAddr and ipmac types are generally useful within libnetwork. Move
them to a dedicated package and overhaul the API to be more like that of
the net/netip package.

Update the overlay driver to utilize these types, adapting to the new
API.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-07-22 11:51:18 -04:00
Cory Snider
844023f794 libnetwork/driverapi: make EventNotify optional
Overlay is the only driver which makes use of the EventNotify facility,
yet all other driver implementations are forced to provide a stub
implementation. Move the EventNotify and DecodeTableEntry methods into a
new optional TableWatcher interface and remove the stubs from all the
other drivers.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-07-22 11:51:14 -04:00
Cory Snider
69c3c56eba libn/networkdb: report prev value in update events
When handling updates to existing entries, it is often necessary to know
what the previous value was. NetworkDB knows the previous and new values
when it broadcasts an update event for an entry. Include both values in
the update event so the watchers do not have to do their own parallel
bookkeeping.

Unify the event types under WatchEvent as representing the operation kind
in the type system has been inconvenient, not useful. The operation is
now implied by the nilness of the Value and Prev event fields.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-07-22 11:49:00 -04:00
Muhammad Daffa Dinaya
34fb2486ef test: migrate test api client version old not supported
Signed-off-by: Muhammad Daffa Dinaya <muhammaddaffadinaya@gmail.com>
2025-07-22 14:49:43 +00:00
Sebastiaan van Stijn
cc9e6a13a2 api/types/swarm/runtime: remove module path for generating proto
It only uses the last element of the import_path to be used as package
name (omitting it will pick the name of the `.proto`).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-22 15:49:58 +02:00
Sebastiaan van Stijn
76c1afeb97 api/types/plugins/logdriver: remove module path for generating proto
It only uses the last element of the import_path to be used as package
name (omitting it will pick the name of the `.proto`).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-22 15:49:57 +02:00
Sebastiaan van Stijn
85ecf8c0f4 api: update references to old module name
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-22 15:49:57 +02:00
Sebastiaan van Stijn
a17a2e8f3d api/stdcopy: touch-up godoc
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-22 15:49:57 +02:00
Sebastiaan van Stijn
5b8ef1aff2 api: remove redundant //go:build lines
These are no longer neeeded now that it's a go module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-22 15:49:55 +02:00
Sebastiaan van Stijn
e1281f09fc Merge pull request #50477 from thaJeztah/fix_vendor
fix vendor
2025-07-22 15:49:30 +02:00
Albin Kerouanton
f996384932 Merge pull request #50382 from akerouanton/split-nat-routed-portmappers
libnet/d/bridge: mv portmapper to libnet/pms/{nat,routed}
2025-07-22 15:45:52 +02:00
Sebastiaan van Stijn
260cc008f4 fix vendor
Commit a88e13f4f9 updated client code,
but did not re-vendor.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-22 15:27:20 +02:00
Albin Kerouanton
4e246efcd1 libnet/d/bridge: mv portmapper to libnet/pms/{nat,routed}
Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-07-22 12:37:01 +02:00
Albin Kerouanton
289ef96d8b libnet/d/bridge/i/rlkclient: move to libnet/i/rlkclient
Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-07-22 12:37:01 +02:00
Albin Kerouanton
41cd92f6c0 libnet/portmapperapi: add PortMapper interface, registry
Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-07-22 12:37:01 +02:00
Albin Kerouanton
afb231d027 libnet/d/bridge: add a new Hairpin config flag
The bridge driver currently determines if hairpin mode is enabled by
checking whether the userland proxy is enabled, and if the binary path
is set to a non-empty string. It's used (amongst other things) by the
driver to decide whether 6-to-4 portmappings are supported, while it
normalizes port bindings.

As the userland proxy is going to be handled by the nat portmapper,
proxy-related params will be removed from the bridge driver, but the
port binding normalization will stay in the bridge driver.

So, introduce a new Hairpin config flag, and reimplement the original
logic in the daemon, when creating the bridge config.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-07-22 12:37:01 +02:00
Albin Kerouanton
6f59a8e665 libnet/d/bridge: call setChildHostIP while binding
Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-07-22 12:37:01 +02:00
Albin Kerouanton
43f384c452 libnet/d/bridge: connectivityConfiguration: use PortBindingReq type
Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-07-22 12:37:01 +02:00
Albin Kerouanton
aa36cc5d25 libnet/d/bridge: move portBinding to portmapperapi
All unexported fields in portBinding are now exported.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-07-22 12:37:01 +02:00
Albin Kerouanton
429818f969 libnet/d/bridge: move portBindingReq to portmapperapi
The two unexported fields of portBindingReq (ChildHostIP and DisableNAT)
are temporarily exported. DisableNAT will be replaced in a future commit
by a 'Mapper' field indicating which portmapper should be used (e.g.
'nat' or 'routed').

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-07-22 12:03:33 +02:00
Paweł Gronowski
c9a83e3161 Merge pull request #50448 from alessio-perugini/fix-data-race-on-list
client: fix datarace when accessing cli.Version field
2025-07-22 10:55:33 +02:00
Rob Murray
090c319f2e Don't allow the daemon to start with nftables and Swarm enabled
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-07-22 09:13:45 +01:00
Rob Murray
26e487db78 testutil: Fix sense of hasFwBackendArg check
Introduced by commit 39ab393 ("Add daemon option --firewall-backend").

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-07-22 09:13:11 +01:00
Sebastiaan van Stijn
596e088bd0 Merge pull request #50432 from thaJeztah/cleanup_request
client: cleanup encoding body and add test-coverage
2025-07-22 01:41:13 +02:00
Sebastiaan van Stijn
b20888a707 Merge pull request #50281 from mdaffad/50253-add-container-health-on-containers-list-api
Add HealthStatus attribute on the docker ps command
2025-07-22 00:47:30 +02:00
Austin Vazquez
29ab09d5d1 Merge pull request #50469 from thaJeztah/integration_noshadow
integration: rename vars that shadowed import
2025-07-21 15:05:45 -07:00
Austin Vazquez
65ff636b39 Merge pull request #50455 from thaJeztah/daemon_noshadow
daemon/server: rename vars that shadowed imports
2025-07-21 15:05:20 -07:00
Sebastiaan van Stijn
9bed95200e Merge pull request #50468 from austinvazquez/add-awslog-driver-log-option-to-validate-list
fix: add create log stream awslog driver log option to validate list
2025-07-21 23:27:58 +02:00
Sebastiaan van Stijn
36d43f1432 Merge pull request #50454 from thaJeztah/pkg_process_split
pkg/process: separate exported funcs from implementation, and fix build-tag for implementation
2025-07-21 23:25:05 +02:00
Muhammad Daffa Dinaya
6e7a2c830d Add Health attribute on the docker ps command
Signed-off-by: Muhammad Daffa Dinaya <muhammaddaffadinaya@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-21 22:57:03 +02:00
Sebastiaan van Stijn
c4f9616c4a client: cleanup encoding body and add test-coverage
This code has various other issue, for which TODOs were added; this
commit only does some initial cleaning up, and improves docs and
test-coverage.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-21 22:51:18 +02:00
Sebastiaan van Stijn
81caabae43 Merge pull request #50462 from thaJeztah/move_stdcopy
deprecate pkg/stdcopy, move to api/stdcopy
2025-07-21 22:50:05 +02:00
Sebastiaan van Stijn
b5d7d6c1e7 Merge pull request #50465 from thaJeztah/less_lazyregexp
remove uses of lazyregexp in tests, test-utilities and packages used externally
2025-07-21 22:49:30 +02:00
Sebastiaan van Stijn
024414b47e integration: rename vars that shadowed import
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-21 22:23:58 +02:00
Sebastiaan van Stijn
b0dbf751e1 Merge pull request #50460 from thaJeztah/tailfile_noshadow
pkg/tailfile: rename vars that shadowed type
2025-07-21 22:13:02 +02:00
Sebastiaan van Stijn
94866b10f9 Merge pull request #50461 from thaJeztah/oci_containerd
oci: deprecate SetCapabilities, and some minor cleanups/fixes
2025-07-21 22:08:00 +02:00
Sebastiaan van Stijn
b486373105 Merge pull request #50459 from thaJeztah/runconfig_touchup_godoc
runconfig: decodeContainerConfig: fix godoc referencing wrong type
2025-07-21 22:07:31 +02:00
Sebastiaan van Stijn
4f309de5c3 Merge pull request #50456 from thaJeztah/idtools_rm_deprecated
pkg/idtools: remove deprecated functions and types
2025-07-21 22:07:01 +02:00
Sebastiaan van Stijn
20d594fb79 deprecate pkg/stdcopy, move to api/stdcopy
The stdcopy package is used to produce and read multiplexed streams for
"attach" and "logs". It is used both by the API server (to produce), and
the client (to read / de-multiplex).

Move it to the api package, so that it can be included in the api module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-21 21:41:39 +02:00
Sebastiaan van Stijn
f651a5d5e9 registry: remove uses of lazyregexp
This package is imported by the CLI; implement a more basic approach.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-21 21:24:46 +02:00
Sebastiaan van Stijn
b33b4bd290 internal/testutils/networking: rm uses of lazyregexp
It's not needed for test-utilities.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-21 21:24:13 +02:00
Sebastiaan van Stijn
daa991c3d8 testutil/environment: don't use regex for string-matching error
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-21 21:24:11 +02:00
Sebastiaan van Stijn
0dc3193b2b integration-cli: remove uses of lazyregexp
Not needed for test-files.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-21 21:23:35 +02:00
Sebastiaan van Stijn
354efb065b Merge pull request #50280 from dmcgowan/api-go-mod
Create github.com/moby/moby/api and github.com/moby/moby/client module
2025-07-21 21:21:34 +02:00
Sebastiaan van Stijn
22bb28c98a Merge pull request #50447 from olljanat/win-keep-network-labels
windows: include labels when re-creating non-default nat networks
2025-07-21 19:56:58 +02:00
Austin Vazquez
6f9758047d fix: add create log stream awslog driver log option to validate list
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-07-21 10:16:53 -07:00
Derek McGowan
c47afd41c8 Create github.com/moby/moby/client module
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-21 09:30:26 -07:00
Derek McGowan
afd6487b2e Create github.com/moby/moby/api module
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-21 09:30:05 -07:00
Derek McGowan
135cea2a10 Update test-unit for client module
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-21 09:29:26 -07:00
Derek McGowan
7e708a5416 Update unit tests for api module
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-21 09:29:26 -07:00
Derek McGowan
0971099c5f Add options to vendor to add and remove replace
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-21 09:29:25 -07:00
Derek McGowan
eab076f217 Gocompat tests no longer needed with go modules
These tests don't account well for submodules and are not needed when
importers are using go modules. The tests are still relevant in the 28
branch which does not use go modules.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-21 09:29:18 -07:00
Austin Vazquez
fb99e3375d Merge pull request #50464 from thaJeztah/rm_pkg_platform_leftovers
internal/platform: remove NumProcs() stub for Linux
2025-07-21 08:18:33 -07:00
Sebastiaan van Stijn
2b05296ee4 Merge pull request #50433 from thaJeztah/client_separate_version
client: define default (and maximum) API version
2025-07-21 17:08:20 +02:00
Sebastiaan van Stijn
842b631efe Merge pull request #50436 from thaJeztah/daemon_separate_version
daemon: define default (and maximum) API version
2025-07-21 17:07:50 +02:00
Sebastiaan van Stijn
3c418749ad Merge pull request #50453 from thaJeztah/daemon_withfields
daemon: killProcessDirectly: use "WithFields" for logging
2025-07-21 17:05:56 +02:00
Paweł Gronowski
6462c01438 Merge pull request #50457 from thaJeztah/integration_cli_norunconfig
integration-cli: remove uses of "runconfig"
2025-07-21 15:42:36 +02:00
Sebastiaan van Stijn
c469e5ebab daemon/server: rename vars that shadowed imports
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-21 15:30:19 +02:00
Sebastiaan van Stijn
61b19a494a oci: deprecate SetCapabilities
rewrite daemon.WithCapabilities using c8d's oci.WithCapabilities.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-21 15:29:43 +02:00
Sebastiaan van Stijn
b9196ed703 oci: fix godoc for SetCapabilities, TweakCapabilities
TweakCapabilities takes privileged into account, but SetCapabilities
does not, so fix the GoDoc.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-21 15:29:43 +02:00
Sebastiaan van Stijn
5c683e8603 oci: sort defaultLinuxMaskedPaths
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-21 15:29:42 +02:00
Rob Murray
3385489aef Merge pull request #50360 from robmry/nftables_with_firewalld
Nftables with firewalld
2025-07-21 14:25:25 +01:00
Sebastiaan van Stijn
0433def57d internal/platform: remove NumProcs() stub for Linux
Follow-up to 04618dfc0b, which removed
the pkg/platform package, but forgot to remove the stub.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-21 13:07:14 +02:00
Akihiro Suda
a1ee5668e8 Merge pull request #50452 from thaJeztah/api_remove_deprecated_aliases
api/types: remove deprecated aliases
2025-07-21 19:58:13 +09:00
Rob Murray
1a504f68fd Add nftables+firewalld tests to CI
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-07-21 11:36:32 +01:00
Rob Murray
02d7a3026a Support nftables+firewalld
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-07-21 11:36:32 +01:00
CrazyMax
d95dceb3b1 build: device entitlement support
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2025-07-21 10:26:14 +02:00
Sebastiaan van Stijn
655dbe69d0 pkg/tailfile: rename vars that shadowed type
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-20 23:10:17 +02:00
Sebastiaan van Stijn
a089c51160 pkg/idtools: remove deprecated functions and types
Remove;

- `MkdirAllAndChown`
- `MkdirAndChown`
- `MkdirAllAndChownNew`
- `GetRootUIDGID`
- `FromUserIdentityMapping`
- `ToUserIdentityMapping`
- `CurrentIdentity`
- `IdentityMapping`
- `Identity.Chown`
- `IDMap`

Also remove the temporary consts that were previously in use by BuildKit;

- `SeTakeOwnershipPrivilege`
- `ContainerAdministratorSidString`
- `ContainerUserSidString`

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-20 23:06:16 +02:00
Sebastiaan van Stijn
3bc64b312e runconfig: decodeContainerConfig: fix godoc referencing wrong type
The ContainerConfigWrapper type was deprecated and removed; refer
to the correct type (container.CreateCreateRequest).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-20 22:16:00 +02:00
Sebastiaan van Stijn
b10cbd9313 Merge pull request #50451 from thaJeztah/gha_bump_bk
hack/buildkit-ref: temporarily bump BuildKit to head of v0.23 branch
2025-07-20 22:15:49 +02:00
Sebastiaan van Stijn
ab5d348b77 integration-cli: remove uses of "runconfig"
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-20 21:04:49 +02:00
Sebastiaan van Stijn
0c3185a835 daemon: killProcessDirectly: use "WithFields" for logging
Don't chain "WithError" and "WithFields"

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-20 15:09:07 +02:00
Sebastiaan van Stijn
1cc42643ae hack/buildkit-ref: temporarily bump BuildKit to head of v0.23 branch
To skip some flaky tests on Windows

diff: https://github.com/moby/buildkit/compare/v0.23.2...dd2b4e18663c58ac3762d7b60b2c3301f71d5fa9

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-20 15:06:15 +02:00
Sebastiaan van Stijn
18e463a082 api/types: remove deprecated RequestPrivilegeFunc type
This was added in bb899c654a,
which shipped in the latest v28.x releases, so we can remove these.

This removes the `RequestPrivilegeFunc` type.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-20 14:56:56 +02:00
Sebastiaan van Stijn
a3920ae6a0 api/types: remove deprecated IDResponse type
This was added in b99b5422b0,
which shipped in the latest v28.x releases, so we can remove these.

This removes the `IDResponse` type.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-20 14:55:38 +02:00
Sebastiaan van Stijn
3e5a06179e api/types: remove deprecated container-inspect types
This was added in 1abc8f6158,
which shipped in the latest v28.x releases, so we can remove these.

This removes the `ContainerJSONBase`, `ContainerJSON` types.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-20 14:53:25 +02:00
Sebastiaan van Stijn
8347b05435 api/types: remove deprecated Container type
This was added in 05b0e653dd,
which shipped in the latest v28.x releases, so we can remove these.

This removes the Container type.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-20 14:50:56 +02:00
Sebastiaan van Stijn
f050df0329 api/types: remove deprecated ContainerState type
This was added in 84ffc644ef,
which shipped in the latest v28.x releases, so we can remove these.

This removes the ContainerState type.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-20 14:50:06 +02:00
Sebastiaan van Stijn
7abeb4d5a4 api/types: remove deprecated container-networksettings types
This was added in df22a511cb,
which shipped in the latest v28.x releases, so we can remove these.

This removes the NetworkSettings, NetworkSettingsBase, DefaultNetworkSettings,
and SummaryNetworkSettings types.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-20 14:49:03 +02:00
Sebastiaan van Stijn
c5a2194b5d api/types: remove deprecated container Health types
This was added in c130ce1f5d,
which shipped in the latest v28.x releases, so we can remove these.

This removes the `Health` and `HealthcheckResult` types to the container package,
as well as the related `NoHealthcheck`, `Starting`, `Healthy`, and `Unhealthy`
consts.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-20 14:46:37 +02:00
Sebastiaan van Stijn
76bf0e2929 api/types: remove deprecated MountPoint
These was added in 5517322cf9,
which shipped in the latest v28.x releases, so we can remove these.

This removes the deprecated `api/types.MountPoint`.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-20 14:44:12 +02:00
Sebastiaan van Stijn
207db8792e api/types: remove deprecated Port
These was added in e12b7493b9,
which shipped in the latest v28.x releases, so we can remove these.

This removes the deprecated `api/types.Port`.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-20 14:43:11 +02:00
Sebastiaan van Stijn
fa8177ba7a api/types: remove deprecated GraphDriverData
These was added in da039ca918,
which shipped in the latest v28.x releases, so we can remove these.

This removes the deprecated `api/types.GraphDriverData`.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-20 14:41:42 +02:00
Sebastiaan van Stijn
836ec65d5f api/types: remove deprecated ImageInspect, RootFS
These was added in 7053007f71,
which shipped in the latest v28.x releases, so we can remove these.

This removes the deprecated `api/types.ImageInspect` and
`RootFS`.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-20 14:39:58 +02:00
Sebastiaan van Stijn
7d3459e7fb api/types: remove deprecated SecretCreateResponse, SecretListOptions
These was added in 23117afca8,
which shipped in the latest v28.x releases, so we can remove these.

This removes the deprecated `api/types.SecretCreateResponse` and
`SecretListOptions`.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-20 14:38:02 +02:00
Sebastiaan van Stijn
68744c8b05 api/types: remove deprecated ConfigCreateResponse, ConfigListOptions
These was added in a411a39be0,
which shipped in the latest v28.x releases, so we can remove these.

This removes the deprecated `api/types.ConfigCreateResponse` and
`ConfigListOptions`.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-20 14:36:58 +02:00
Sebastiaan van Stijn
33f07ff3f4 api/types: remove deprecated NodeListOptions, NodeRemoveOptions
These was added in f008d85edc,
which shipped in the latest v28.x releases, so we can remove these.

This removes the deprecated `api/types.NodeListOptions` and
`NodeRemoveOptions`.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-20 14:35:06 +02:00
Sebastiaan van Stijn
f13796d2af api/types: remove deprecated TaskListOptions
These was added in 5ad0867236,
which shipped in the latest v28.x releases, so we can remove these.

This removes the deprecated `api/types.TaskListOptions`

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-20 14:33:43 +02:00
Sebastiaan van Stijn
72b1e11264 api/types: remove deprecated ServiceCreateOptions
These aliases were added in 31d62930f7,
which shipped in the latest v28.x releases, so we can remove these.

This removes the deprecated `api/types.ServiceCreateOptions`

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-20 14:32:13 +02:00
Sebastiaan van Stijn
3faead6fc1 api/types: remove deprecated ServiceUpdateOptions
These aliases were added in 0b1c7a8306,
which shipped in the latest v28.x releases, so we can remove these.

This removes the deprecated `api/types`;

- `ServiceUpdateOptions`
- `RegistryAuthFromSpec`
- `RegistryAuthFromPreviousSpec`

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-20 14:30:56 +02:00
Sebastiaan van Stijn
55ad118eaf api/types: remove deprecated ServiceListOptions, ServiceInspectOptions
These aliases were added in b13528522a,
which shipped in the latest v28.x releases, so we can remove this.

This removes the deprecated `api/types.ServiceListOptions` and
`api/types.ServiceInspectOptions` types.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-20 14:29:07 +02:00
Sebastiaan van Stijn
91558ae3f3 api/types: remove deprecated SwarmUnlockKeyResponse
This alias was added in 7e8f630bec,
which shipped in the latest v28.x releases, so we can remove this.

This removes the deprecated `api/types.SwarmUnlockKeyResponse` type.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-20 14:26:54 +02:00
Sebastiaan van Stijn
74fe646ac2 api/types: remove deprecated build-cache types
These aliases were added in eefe68a37c,
which shipped in the latest v28.x releases, so we can remove these.

This removes the deprecated `api/types`;

- `BuildCache`
- `BuildCachePruneOptions`
- `BuildCachePruneReport`

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-20 14:25:20 +02:00
Sebastiaan van Stijn
3eac6e7888 api/types: remove deprecated BuildResult
This alias was added in bb7dbaafcd,
which shipped in the latest v28.x releases, so we can remove this.

This removes the deprecated `api/types.BuildResult` type.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-20 14:03:59 +02:00
Sebastiaan van Stijn
088cb2ffa6 api/types: remove deprecated build-related types
These aliases were added in 3d1e4d9002,
which shipped in the latest v28.x releases, so we can remove these.

This removes the deprecated `api/types`;

- `ImageBuildOptions`
- `ImageBuildOutput`
- `ImageBuildResponse`
- `BuilderVersion`
- `BuilderV1`
- `BuilderBuildKit`

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-20 14:00:45 +02:00
Sebastiaan van Stijn
1359046a36 pkg/process: call out that "Zombie" is only supported on Linux
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-18 16:16:08 +02:00
Sebastiaan van Stijn
94618ac3ab pkg/process: separate exported funcs from implementation
This allows us to maintain GoDoc in a single place, and for
"Kill" and "Alive" to have consistent error-handling (Windows
does not support negative process-IDs).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-18 16:16:05 +02:00
Alessio Perugini
a88e13f4f9 client: fix datarace when accessing cli.Version field
Originally I've found this datarace on a project I'm working at. I'm not
able to consistently reproduce this. But by looking at the codebase I
took a chance to fix other 2 possible function that might produce such
data race.

Original stack trace produced when running `go test -race` on GH CI:

```
WARNING: DATA RACE
Write at 0x00c0005dc688 by goroutine 43:
  github.com/docker/docker/client.(*Client).negotiateAPIVersionPing()
      /home/runner/go/pkg/mod/github.com/docker/docker@v28.2.2+incompatible/client/client.go:389 +0x12f
  github.com/docker/docker/client.(*Client).checkVersion()
      /home/runner/go/pkg/mod/github.com/docker/docker@v28.2.2+incompatible/client/client.go:298 +0x249
  github.com/docker/docker/client.(*Client).getAPIPath()
      /home/runner/go/pkg/mod/github.com/docker/docker@v28.2.2+incompatible/client/client.go:307 +0x76
  github.com/docker/docker/client.(*Client).sendRequest()
      /home/runner/go/pkg/mod/github.com/docker/docker@v28.2.2+incompatible/client/request.go:111 +0x9b
  github.com/docker/docker/client.(*Client).get()
      /home/runner/go/pkg/mod/github.com/docker/docker@v28.2.2+incompatible/client/request.go:28 +0x736
  github.com/docker/docker/client.(*Client).ContainerList()
      /home/runner/go/pkg/mod/github.com/docker/docker@v28.2.2+incompatible/client/container_list.go:47 +0x6f0

Previous read at 0x00c0005dc688 by goroutine 42:
  github.com/docker/docker/client.(*Client).ContainerList()
      /home/runner/go/pkg/mod/github.com/docker/docker@v28.2.2+incompatible/client/container_list.go:39 +0x5ef
```

Co-authored-by: Luca Rinaldi <lucarin@protonmail.com>
Signed-off-by: Alessio Perugini <alessio@perugini.xyz>
2025-07-18 11:07:44 +02:00
Olli Janatuinen
e6cdf24bcd windows: include labels when re-creating non-default nat networks
Signed-off-by: Olli Janatuinen <olli.janatuinen@gmail.com>
2025-07-18 00:24:59 -07:00
Austin Vazquez
f776cd6922 Merge pull request #50367 from dmcgowan/move-volume-daemon
Move volume under daemon
2025-07-17 14:21:06 -07:00
Rob Murray
2f4f78bd3c Merge pull request #50327 from Adrien-Atmosphere/50326-wait-for-dependent-containers
Wait for container dependencies upon daemon start up
2025-07-17 20:24:34 +01:00
Rob Murray
87fdd1bfca Merge pull request #50437 from thaJeztah/no_scratch
api: deprecate NoBaseImageSpecifier
2025-07-17 19:39:56 +01:00
Rob Murray
8c79486dab Merge pull request #50357 from robmry/firewall_backend_option
Add daemon option --firewall-backend
2025-07-17 19:21:12 +01:00
Adrien Pompée
d4e026fe20 Wait for container dependencies upon daemon start up
- Get dependent containers before starting containers
- Dependent containers can be either from legacy link or container network
- Wait on a best effort basis for the dependent containers

Fixes: #50326

Signed-off-by: Adrien Pompée <adrien.pompee@atmosphere.aero>
2025-07-17 19:41:39 +02:00
Sebastiaan van Stijn
c616e7690f Merge pull request #50421 from vvoland/ci-c8d-windows
ci/windows: Always run tests with c8d
2025-07-17 16:18:13 +02:00
Rob Murray
39ab393274 Add daemon option --firewall-backend
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-07-17 15:12:01 +01:00
Sebastiaan van Stijn
7b9bd987bf api: deprecate NoBaseImageSpecifier
This const is no longer used and will be removed in the next release.

Also fixed a var that shadowed a type.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-17 15:43:08 +02:00
Rob Murray
254f64ded6 Merge pull request #50434 from thaJeztah/resolvconf_no_write
libnet/internal/resolvconf: don't use rc.WriteFile in tests
2025-07-17 13:35:42 +01:00
Sebastiaan van Stijn
a632b8495b daemon: define default (and maximum) API version
With the daemon and API migrating to separate modules, users of the daemon
module may upgrade the API module to higher versions. Currently, the daemon
uses the API's Default version. While the version of the API module is
allowed to be updated (following SemVer), we should not allow the Daemon
to support higher API versions than it was written for.

This patch introduces a DefaultAPIVersion in the daemon/config package that is
used as default version of the API for the daemon to use.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-17 14:35:05 +02:00
Sebastiaan van Stijn
2b17ab0ec6 libnet/internal/resolvconf: fix naming of error (errname)
#27 94.97 executor/oci/internal/resolvconf/resolvconf.go:461:6: the error type name `systemErr` should conform to the `xxxError` format (errname)
    #27 94.97 type systemErr struct{ error }
    #27 94.97      ^

Also fix an unhandled error; we don't need a defer() for that one

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-17 13:58:31 +02:00
Sebastiaan van Stijn
aa757e591d libnet/internal/resolvconf: don't use rc.WriteFile in tests
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-17 13:57:38 +02:00
Sebastiaan van Stijn
9af9d2742c Merge pull request #50428 from thaJeztah/resolvconf_notemplate
libnet/internal/resolvconf: optimize Generate() without text/template
2025-07-17 12:01:18 +02:00
Sebastiaan van Stijn
8d54d36bce libnet/internal/resolvconf: fix naming of error
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-17 11:43:33 +02:00
Sebastiaan van Stijn
60a3a28a04 libnet/internal/resolvconf: minor optimizations
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-17 11:40:17 +02:00
Sebastiaan van Stijn
f22a3dfdb7 libnet/internal/resolvconf: optimize Generate() without text/template
Rewrite this function to not use text/template, which is ~74× faster,
~25× less memory, and ~56× fewer allocations.

Before/After:

    BenchmarkGenerate-10       42550     27439 ns/op    18083 B/op    394 allocs/op
    BenchmarkGenerate-10     3148328       373 ns/op      712 B/op      7 allocs/op

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-17 11:40:11 +02:00
Sebastiaan van Stijn
0775ab6661 libnet/internal/resolvconf: add benchmark for Generate()
goos: darwin
    goarch: arm64
    pkg: github.com/docker/docker/daemon/libnetwork/internal/resolvconf
    cpu: Apple M1 Pro
    BenchmarkGenerate
    BenchmarkGenerate-10    	   42550	     27439 ns/op	   18083 B/op	     394 allocs/op
    PASS

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-17 11:37:28 +02:00
Sebastiaan van Stijn
41da5700a4 client: define default (and maximum) API version
With the client and API migrating to separate modules, users of the Client
module may upgrade the API module to higher versions. Currently, the Client
uses the API's Default version. While the version of the API module is
allowed to be updated (following SemVer), we should not allow the Client
to support higher API versions than it was written for.

This patch introduces a DefaultAPIVersion in the client package that is
used as default version of the API for the client to use.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-17 11:20:17 +02:00
Sebastiaan van Stijn
4c6f586740 Merge pull request #50426 from thaJeztah/no_empty_auth
api/types/registry: EncodeAuthConfig: use empty string for zero value
2025-07-17 08:33:54 +02:00
Sebastiaan van Stijn
098ff1aed1 Merge pull request #50405 from thaJeztah/bump_dev_tools
Dockerfile: update CLI to v28.3.2, Buildx v0.25.0, compose v2.38.2
2025-07-17 06:58:13 +02:00
Sebastiaan van Stijn
9fb7c6a493 Merge pull request #50425 from thaJeztah/detect_empty_authconfig
api/types/registry: DecodeAuthConfig: add early returns and improve errors
2025-07-17 06:56:31 +02:00
Sebastiaan van Stijn
28adc4a395 Merge pull request #50408 from thaJeztah/docker_py_reformat
hack/make/test-docker-py: split test-exclusions to separate lines
2025-07-17 06:55:17 +02:00
Austin Vazquez
535c2bc6b7 Merge pull request #50429 from dmcgowan/detangle-testutil-imports
Move testutils image load to integration internal
2025-07-16 18:32:57 -07:00
Austin Vazquez
977dd1833b Merge pull request #50365 from dmcgowan/move-builder-daemon
Move builder under daemon
2025-07-16 16:29:00 -07:00
Derek McGowan
b54bde4376 Move testutils image load to integration internal
The image load is only used by integration tests but the specialimage
testutils package used by many different tests. The image load relies on
the client which creates a transitive client dependency from the daemon
packages.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-16 16:15:27 -07:00
Derek McGowan
b83f36877f Move internal/mod to daemon/internal/builder-next/worker/mod
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-16 15:06:31 -07:00
Derek McGowan
af86e80825 Move daemon/build to daemon/builder/backend
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-16 15:06:15 -07:00
Derek McGowan
7d48302134 Move builder to daemon/builder
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-16 15:06:00 -07:00
Derek McGowan
6ff9bea6a7 Move builder/builder-next to daemon/internal/builder-next
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-16 15:05:44 -07:00
Austin Vazquez
7766b8a763 Merge pull request #50423 from thaJeztah/fix_context_linting
builder/remotecontext/git: fix linting issues
2025-07-16 15:01:06 -07:00
Sebastiaan van Stijn
3a447bc079 api/types/registry: EncodeAuthConfig: use empty string for zero value
Currently, EncodeAuthConfig always returns a base64url-encoded JSON
doc, even if an empty auth-config passed. As a result, it's more
complicated to detect if authentication was present.

This patch changes the behavior to return an empty string for these
cases so that teh client can skip setting the `X-Registry-Auth` header,
and the daemon can detect whether authentication is sent or not.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-16 22:26:10 +02:00
Sebastiaan van Stijn
472e09ac47 api/types/registry: DecodeAuthConfig: add early returns and improve errors
Add an early return for empty JSON or malformed base64url values.

Before:

    go test -bench=DecodeAuthConfig -benchmem ./api/types/registry/
    goos: darwin
    goarch: arm64
    pkg: github.com/docker/docker/api/types/registry
    cpu: Apple M1 Pro
    BenchmarkDecodeAuthConfig/empty-10           47380755        25.44 ns/op      112 B/op          1 allocs/op
    BenchmarkDecodeAuthConfig/empty_JSON-10       2426870       491.70 ns/op     3056 B/op          8 allocs/op
    BenchmarkDecodeAuthConfig/valid-10             909601      1255.00 ns/op     3160 B/op         13 allocs/op
    BenchmarkDecodeAuthConfig/invalid_base64-10   1679551       703.40 ns/op     3410 B/op         15 allocs/op
    BenchmarkDecodeAuthConfig/malformed_JSON-10   1387849       817.10 ns/op     4795 B/op         12 allocs/op
    PASS

After:

    go test -bench=DecodeAuthConfig -benchmem ./api/types/registry/
    goos: darwin
    goarch: arm64
    pkg: github.com/docker/docker/api/types/registry
    cpu: Apple M1 Pro
    BenchmarkDecodeAuthConfig/empty-10           45892863        25.11 ns/op      112 B/op          1 allocs/op
    BenchmarkDecodeAuthConfig/empty_JSON-10      25347739        46.50 ns/op      115 B/op          2 allocs/op
    BenchmarkDecodeAuthConfig/valid-10            1292016       928.10 ns/op     1208 B/op         12 allocs/op
    BenchmarkDecodeAuthConfig/invalid_base64-10   5728990       208.50 ns/op      160 B/op          6 allocs/op
    BenchmarkDecodeAuthConfig/malformed_JSON-10   1821925       646.80 ns/op     2833 B/op         13 allocs/op
    PASS

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-16 22:25:43 +02:00
Sebastiaan van Stijn
6865032baa api/types/registry: add BenchmarkDecodeAuthConfig
Basic benchmark;

    go test -bench=DecodeAuthConfig -benchmem ./api/types/registry/
    goos: darwin
    goarch: arm64
    pkg: github.com/docker/docker/api/types/registry
    cpu: Apple M1 Pro
    BenchmarkDecodeAuthConfig/empty-10           47380755        25.44 ns/op      112 B/op          1 allocs/op
    BenchmarkDecodeAuthConfig/empty_JSON-10       2426870       491.70 ns/op     3056 B/op          8 allocs/op
    BenchmarkDecodeAuthConfig/valid-10             909601      1255.00 ns/op     3160 B/op         13 allocs/op
    BenchmarkDecodeAuthConfig/invalid_base64-10   1679551       703.40 ns/op     3410 B/op         15 allocs/op
    BenchmarkDecodeAuthConfig/malformed_JSON-10   1387849       817.10 ns/op     4795 B/op         12 allocs/op
    PASS

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-16 22:25:42 +02:00
Sebastiaan van Stijn
c1e5ab4e50 Merge pull request #50415 from thaJeztah/push_no_empty_body_step1
client: always send (empty) body on push
2025-07-16 19:45:17 +02:00
Rob Murray
55f0bd8ee9 Merge pull request #50345 from corhere/libn/networkdb-property-testing
libnetwork/networkdb: add property-based tests
2025-07-16 18:44:23 +01:00
Paweł Gronowski
c1b95c0ca2 ci/windows: Always run tests with c8d
Remove the special condition needed to run Windows integration tests
with the containerd integration enabled in addition to the graphdriver.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-07-16 18:04:31 +02:00
Paweł Gronowski
d716e4c46d Merge pull request #50424 from vvoland/fix-windows-ci-test
integration: Skip TestRunMountImageMultipleTimes on Windows
2025-07-16 18:03:52 +02:00
Sebastiaan van Stijn
121518bc78 Merge pull request #50416 from thaJeztah/resolvconf_modernize
libnet/internal/resolvconf: use slices.Clone
2025-07-16 17:26:07 +02:00
Paweł Gronowski
967daa627a integration: Skip TestRunMountImageMultipleTimes on Windows
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-07-16 17:25:37 +02:00
Sebastiaan van Stijn
a615ec798d builder/remotecontext/git: fix linting issues
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-16 16:27:48 +02:00
Paweł Gronowski
d33d46d016 Merge pull request #50418 from vvoland/api-bump
api: bump to 1.52
2025-07-16 14:07:40 +02:00
Paweł Gronowski
f88631b4b3 Merge pull request #50417 from dmcgowan/remove-unneeded-integraiton-test
Remove integration test using daemon internals
2025-07-16 11:55:54 +02:00
Paweł Gronowski
e32e1f6f04 Merge pull request #50268 from vvoland/image-mount-multiple
daemon: Fix mounting same image multiple times with different destinations
2025-07-16 11:21:47 +02:00
Paweł Gronowski
6a8654a808 api: bump to 1.52
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-07-16 11:10:32 +02:00
Akihiro Suda
543c4339a4 Merge pull request #50411 from thaJeztah/client_ContainerExecAttach_linkify
client: ContainerExecAttach: update GoDoc links
2025-07-16 11:07:21 +09:00
Akihiro Suda
33533378ae Merge pull request #50409 from thaJeztah/registry_nohomedir
registry: replace pkg/homedir.GetConfigHome for os.UserConfigDir
2025-07-16 11:06:43 +09:00
Cory Snider
ac5f464649 libnetwork/networkdb: improve quality of randomness
The property test for the mRandomNodes function revealed that it may
sometimes pick out a sample of fewer than m nodes even when the number
of nodes to pick from (excluding the local node) is >= m. Rewrite it
using a random shuffle or permutation so that it always picks a
uniformly-distributed sample of the requested size whenever the
population is large enough.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-07-15 18:07:59 -04:00
Cory Snider
5799deb853 libnetwork/networkdb: test quality of mRandomNodes
TestNetworkDBAlwaysConverges will occasionally find a failure where one
entry is missing on one node even after waiting a full five minutes. One
possible explanation is that the selection of nodes to gossip with is
biased in some way. Test that the mRandomNodes function picks a
uniformly distributed sample of node IDs of sufficient length.

The new test reveals that mRandomNodes may sometimes pick out a sample
of fewer than m nodes even when the number of nodes to pick from
(excluding the local node) is >= m. Put the test behind an xfail tag so
it is opt-in to run, without interfering with CI or bisecting.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-07-15 18:07:54 -04:00
Cory Snider
d8730dc1d3 libnetwork/networkdb: add convergence test
Add a property-based test which asserts that a cluster of NetworkDB
nodes always eventually converges to a consistent state. As this test
takes a long time to run it is build-tagged to be excluded from CI.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-07-15 18:07:09 -04:00
Derek McGowan
7771a38896 Remove integration test using daemon internals
Integration tests should not be using daemon internals. Since this is
testing against regression and the relevant code has a feature freeze on
it, this test can be removed. The test is not relevant with containerd,
which has more protection against these cases through gc.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-15 11:48:34 -07:00
Derek McGowan
17d5f731f1 Move internal/safepath to daemon/volume/safepath
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-15 10:45:47 -07:00
Derek McGowan
7edd7c68b1 Move internal/mounttree to daemon/internal/mounttree
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-15 10:45:31 -07:00
Derek McGowan
daeaac0d3c Move internal/directory to daemon/internal/directory
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-15 10:45:15 -07:00
Derek McGowan
33d824b838 Move quota to daemon/internal/quota
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-15 10:45:00 -07:00
Derek McGowan
04f5276267 Move volume to daemon/volume
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-15 10:44:44 -07:00
Rob Murray
d86a303086 Merge pull request #50397 from thaJeztah/testutil_denoise
minor cleanups and reduce logs in tests
2025-07-15 17:25:29 +01:00
Sebastiaan van Stijn
cf3a152c61 Merge pull request #50410 from thaJeztah/bump_cgroups
vendor: github.com/opencontainers/cgroups v0.0.4
2025-07-15 18:03:26 +02:00
Sebastiaan van Stijn
fdd9ae3465 libnet/internal/resolvconf: use slices.Clone
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-15 17:28:59 +02:00
Albin Kerouanton
d8089c82ed Merge pull request #50362 from akerouanton/linux-osallocator
libnet/portallocator: introduce OSAllocator
2025-07-15 13:56:16 +02:00
Sebastiaan van Stijn
b1ce0c89f0 client: always send (empty) body on push
Before ea29dffaa5, the image create endpoint
had a [fallback for very old client versions][1] that would send authentication
as body instead of through the `X-Registry-Auth` header.

However, the implementation of this fallback did not handle empty bodies,
resulting in an `io.EOF` error to be returned when trying to parse the
body as JSON.

In practice, this problem didn't happen when using the CLI, because even
if no authentication was present, `registry.EncodeAuthConfig()` (used by
the CLI to set the `X-Registry-Auth` header) would produce an empty JSON
document (`{}`), which would be encoded in base64 (`e30=`), so we would
never set an empty `X-Registry-Auth` (but other clients may have hit this
situation). That behavior was unexpected, because not all registries require
authentication, and omitting the `X-Registry-Auth` should be valid. We
also want to have more flexibility in authentication (and being able to
distinguish unauthenticated requests, so that we can fallback to
alternative paths).

Unfortunately, we can't change existing daemons, so must account for the
faulty fallback. Currently, omitting the `X-Registry-Auth` produces an
error, but we can avoid this by unconditionally sending a body, which
may be an empty JSON document (`{}`).

I explored possible options for this; we can either construct our own
empty JSON (`json.RawMessage("{}")`) to be explicit that we're sending
empty JSON, but [`encodeBody()`][2] is currently hard-coded to expect
JSON requests, and unconditionally calls [`encodeData`][3], which
encodes to JSON, so we may as well take advantage of `http.NoBody`,
which gets marshaled to an empty JSON document;
https://go.dev/play/p/QCw9dJ6LGQu

    package main

    import (
        "encoding/json"
        "fmt"
        "net/http"
    )

    func main() {
        body, _ := json.Marshal(http.NoBody)
        fmt.Println(string(body))
    }

Before this patch, a client omitting `X-Registry-Auth` (and no body)
would produce an error;

    docker pull -q busybox
    docker tag busybox 127.0.0.1:5001/myimage:latest

    docker run -d --name registry -p 127.0.0.1:5001:5000 registry:3
    docker push 127.0.0.1:5001/myimage:latest
    Error response from daemon: bad parameters and missing X-Registry-Auth: invalid X-Registry-Auth header: EOF

With this patch applied, no error is produced;

    docker pull -q busybox
    docker tag busybox 127.0.0.1:5001/myimage:latest

    docker run -d --name registry -p 127.0.0.1:5001:5000 registry:3
    docker push 127.0.0.1:5001/myimage:latest
    The push refers to repository [127.0.0.1:5001/myimage]
    189fdd150837: Pushed
    latest: digest: sha256:68a0d55a75c935e1101d16ded1c748babb7f96a9af43f7533ba83b87e2508b82 size: 610

[1]: 63fcf7d858/api/types/registry/authconfig_test.go (L109-L114)
[2]: 63fcf7d858/client/request.go (L67-L87)
[3]: 63fcf7d858/client/request.go (L296-L304)
[4]: ea29dffaa5

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-15 13:51:52 +02:00
Albin Kerouanton
50d2dafc7f libnet/portallocator: introduce OSAllocator
This new struct allocates ports from the operating system by creating
sockets and binding them. It's based on the existing bindTCPOrUDP and
bindSCTP functions previously defined in the bridge driver. It tries to
detect conflicts on best effort basis, and doesn't guarantee that the
ports it allocates are not in use by other processes.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-07-15 12:16:01 +02:00
Sebastiaan van Stijn
14bd3451d8 client: ContainerExecAttach: update GoDoc links
- Use doc-links for references to other types.
- Fix reference to "types.HijackedConnection", which doesn't exist.
- Use a bullet-list for the different stream formats used.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-15 10:44:31 +02:00
Rob Murray
63fcf7d858 Merge pull request #50288 from dmcgowan/move-libnetwork-daemon
Move libnetwork under daemon
2025-07-15 08:19:30 +01:00
Sebastiaan van Stijn
830e0d79f5 vendor: github.com/opencontainers/cgroups v0.0.4
- fs2: Fix statHugeTlb error when rsvd usage is present
- fs2: ignore no device error when reading freezer state

No changes in vendored code

full diff: https://github.com/opencontainers/cgroups/compare/v0.0.3...v0.0.4

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-15 00:58:44 +02:00
Sebastiaan van Stijn
d66cf14a87 registry: replace pkg/homedir.GetConfigHome for os.UserConfigDir
The registry package is used in docker/cli, and currently depends on
pkg/homedir. This package was anly used when running with rootlesskit,
which only is supported on Linux; on other platforms, homedir.GetConfigHome
would return an error;
abba330bbf/pkg/homedir/homedir_others.go (L24-L27)

Replace homedir.GetConfigHome with os.UserConfigDir from stdlib, which
is similar, with exception of not falling back to `getent` for
resolving the user's homedir, which would be a corner-case.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-14 23:30:54 +02:00
Paweł Gronowski
14d9be4978 daemon: Fix mounting same image multiple times with different destinations
The previous implementation generated layer names based on container ID
and source image, which would cause conflicts when mounting the same
image to multiple destinations within a container.

This fixes the issue by changing the layer naming strategy to include
the destination path in the layer name, making it unique for each mount
point.

To avoid filesystem paths producing unexpected names, the combined
string is hex-encoded and used as a layer name.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-07-14 20:34:24 +02:00
Derek McGowan
a28f031298 Fix libnetwork proto generation
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-14 10:35:07 -07:00
Derek McGowan
b1884b6bba Restore libnetwork/resolvconf
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-14 10:35:06 -07:00
Derek McGowan
3b5f7c2a29 Move internal/modprobe to daemon/libnetwork/internal/modprobe
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-14 09:25:55 -07:00
Derek McGowan
7f4713a364 Move internal/maputil to daemon/libnetwork/internal/maputil
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-14 09:25:39 -07:00
Sebastiaan van Stijn
22ed8b1327 hack/make/test-docker-py: split test-exclusions to separate lines
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-14 18:25:30 +02:00
Derek McGowan
7a720df61f Move libnetwork to daemon/libnetwork
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-14 09:25:23 -07:00
Derek McGowan
f05652867d Move opts to daemon/pkg/opts
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-14 09:25:05 -07:00
Sebastiaan van Stijn
abba330bbf Merge pull request #50208 from thaJeztah/rm_deprecated
pkg/* remove deprecated functions and packages
2025-07-14 16:18:20 +02:00
Paweł Gronowski
649256a269 Merge pull request #50387 from thaJeztah/flaky_TestRemoveContainerWithVolume
integration/container: fix flaky TestRemoveContainerWithVolume
2025-07-14 16:14:44 +02:00
Paweł Gronowski
33f1ac3c83 Merge pull request #50398 from thaJeztah/less_pkg_system
pkg/system: remove EnableContainerdRuntime, ContainerdRuntimeSupported
2025-07-14 13:24:21 +02:00
Akihiro Suda
407881d45a Merge pull request #50392 from thaJeztah/authcfg_coverage
api/types/registry: add some tests for encoding/decoding authconfig
2025-07-14 19:40:52 +09:00
Paweł Gronowski
a470ad7ffd Merge pull request #50390 from Abubacarr075/50159-migrate-api-images-history-cli-tests-to-integration
migrate test api images history integration cli test to integration test
2025-07-14 12:26:31 +02:00
Sebastiaan van Stijn
7fba6cb96c Merge pull request #50396 from thaJeztah/flaky_TestRestartStoppedContainer
integration-cli: fix flaky TestRestartStoppedContainer
2025-07-14 11:49:30 +02:00
Akihiro Suda
2dd6dcb75a Merge pull request #50400 from thaJeztah/api_deprecated_container_types
api/types/container: remove deprecated ContainerUpdateOKBody, ContainerTopOKBody
2025-07-14 17:40:50 +09:00
Akihiro Suda
e00c358b5f Merge pull request #50399 from thaJeztah/pkg_system_deprecate_escapeargs
pkg/system: deprecate EscapeArgs, IsAbs and move them internal
2025-07-14 17:40:27 +09:00
Paweł Gronowski
3ae462e370 Merge pull request #50403 from thaJeztah/xfail_TestExecResize
integration/container: XFAIL flaky TestExecResize on Windows
2025-07-14 09:17:21 +02:00
Sebastiaan van Stijn
e0292b6da6 Merge pull request #50406 from thaJeztah/bump_delve
Dockerfile: upgrade Delve to v1.25.0
2025-07-14 00:51:25 +02:00
Sebastiaan van Stijn
fb2117987d Dockerfile: upgrade Delve to v1.25.0
Update to the latest version:

- https://github.com/go-delve/delve/releases/tag/v1.25.0
- https://github.com/go-delve/delve/blob/v1.25.0/CHANGELOG.md#1250-2025-04-16

Also update links to supported platforms.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-13 17:33:31 +02:00
Sebastiaan van Stijn
18438f3c13 Dockerfile: update compose to v2.38.2
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-13 17:25:15 +02:00
Sebastiaan van Stijn
8c3e10a011 Dockerfile: update buildx to v0.25.0
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-13 17:24:22 +02:00
Sebastiaan van Stijn
4dee288b51 Dockerfile: update cli to v28.3.2
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-13 17:23:36 +02:00
Sebastiaan van Stijn
9bcb12aa48 daemon: ContainerExtractToDir: make AllowOverwriteDirWithFile opt-in
This change changes the default for noOverwriteDirNonDir to be true
internally, with the intent to change the default at the API to follow
accordingly.

The `AllowOverwriteDirWithFile` option in the Client was added when
reimplementing the CLI using the API Client lib in [moby@1b2b91b].
Before that refactor, the `noOverwriteDirNonDir` query argument
[would be set unconditionally][1] by the CLI, with no options to
control the behavior.

The `noOverwriteDirNonDir` query parameter was added in [moby@db9cc91] to
set the `NoOverwriteDirNonDir` option that was implemented in pkg/archive
in [moby@a74799b].

It was added in [PR13171-comment2], following a discussion on the risk
of replacing a directory with a file and vice-versa in [PR13171-comment].

> In my latest changes from yesterday:
>
> - Removed the `GET stat-path` endpoint and added a `HEAD` handler to
>   the `archive-path` endpoint. Updated the api docs to reflect this.
>   Also moved api docs changes from `v1.19` to `v1.20`.
> - Added a `NoOverwriteDirNonDir` flag to `archive.TarOptions` to indicate
>   that we do not want to overwrite a directory with a non-directory (and
>   vice versa) when unpacking an archive.
> - Added a corresponding but optional `noOverwriteDirNonDir` parameter
>   to the `PUT extract-to-dir` endpoint to specify desired behavior.
>
> These changes combine to keep the behavior we want

It's unclear why these were added as an *option* and why it was implemented
as opt-in (not opt-out), as overwriting a file with a directory (or vice-versa)
would generally be unexpected behavior.

[1]: 8c9ad7b818/api/client/cp.go (L345-L346)
[moby@1b2b91b]: 1b2b91ba43
[moby@a74799b]: a74799b701
[moby@db9cc91]: db9cc91a9e
[PR13171-comment]: https://github.com/moby/moby/pull/13171#issuecomment-106559765
[PR13171-comment2]: https://github.com/moby/moby/pull/13171#issuecomment-108538643

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-13 16:37:36 +02:00
Sebastiaan van Stijn
fd8fec18cd integration/container: XFAIL flaky TestExecResize on Windows
This test is failing frequently (50%) on Windows;

    === FAIL: github.com/docker/docker/integration/container TestExecResize/success (0.01s)
        exec_test.go:144: assertion failed: error is not nil: Error response from daemon: NotFound: exec: '9c19c467436132df24d8b606b0c462b1110dacfbbd13b63e5b42579eda76d7fc' in task: '7d1f371218285a0c653ae77024a1ab3f5d61a5d097c651ddf7df97364fafb454' not found: not found

Let's keep the test, but log the failure and skip on Windows.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-13 15:13:16 +02:00
Sebastiaan van Stijn
4a8d77c958 api/types/container: remove deprecated ContainerTopOKBody alias
This was deprecated in be1ac5d8e5, which
was part of v28, so we can remove it for v29

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-12 20:40:03 +02:00
Sebastiaan van Stijn
3d8d9c2bb3 api/types/container: remove deprecated ContainerUpdateOKBody alias
This was deprecated in f4dc38cd36, which
was part of v28, so we can remove it for v29

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-12 20:38:50 +02:00
Sebastiaan van Stijn
f8a2550a22 pkg/system: deprecate IsAbs and move internal
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-12 19:51:34 +02:00
Sebastiaan van Stijn
63bada41e5 pkg/system: deprecate EscapeArgs and move internal
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-12 19:49:22 +02:00
Sebastiaan van Stijn
0fc1493654 pkg/system: remove EnableContainerdRuntime, ContainerdRuntimeSupported
These functions were used internally to keep track of whether containerd
was enabled as runtime on Windows; move it to libcontainerd.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-12 19:16:30 +02:00
Sebastiaan van Stijn
a327a9f341 integration-cli: fix flaky TestRestartStoppedContainer
This test was failing frequently on Windows, waiting for the state
of the container to be "running" after restarting, however, this
would race because the command of the container was very short-lived;

    === Failed
    === FAIL: github.com/docker/docker/integration-cli TestDockerCLIRestartSuite/TestRestartStoppedContainer (37.00s)
        docker_cli_restart_test.go:42: assertion failed: error is not nil: condition ""true" == "false"" not true in time (20s)

Ironically, that check was added in 48ccdd46ae
to make the test less flaky.

This patch takes the approach from TestRestartRunningContainer, which had
similar issues on Windows that were addressed in bae22d167c

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-12 17:45:27 +02:00
Sebastiaan van Stijn
59d5743a43 testutil/daemon: Daemon.Stop() don't log when already stopped
`Daemon.Stop()` is called in teardown of tests, resulting in a lot of noise;

    docker_cli_network_unix_test.go:52: [d124e10f67e01] daemon is not started
    docker_cli_network_unix_test.go:1143: [dadd2ae3b638b] daemon is not started
    docker_cli_external_volume_driver_test.go:59: [d50e371ba1d6f] daemon is not started

Let's ignore if the daemon is already stopped, as that's what we want to here.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-12 17:39:14 +02:00
Sebastiaan van Stijn
1c8b09ccf6 integration-cli: TestDockerNetworkHostModeUngracefulDaemonRestart start, not restart
This test was testing a non-gracceful kill od the daemon, after which it
started it again, however `d.Stop()` would log that the daemon wasn't running,
which is expected, so let's reduce noise;

    docker_cli_network_unix_test.go:1143: [dadd2ae3b638b] daemon is not started

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-12 17:35:51 +02:00
Sebastiaan van Stijn
9e69fc567e testutil/daemon: remove string-matching for error
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-12 17:31:20 +02:00
Sebastiaan van Stijn
cf41e9ac60 testutil/daemon: gofumpt
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-12 17:30:56 +02:00
Sebastiaan van Stijn
d6c90dcb87 integration/container: fix flaky TestRemoveContainerWithVolume
This test depended on the container to die after running the `true` command,
but this condition failed frequently on Windows 2025.

    === Failed
    === FAIL: github.com/docker/docker/integration/container TestRemoveContainerWithVolume (32.68s)
        remove_test.go:61: timeout hit after 10s: waiting for container State.Status to be 'exited', currently 'running'

While this may be revealing an actual issue (and we should have a test for
that), it's irrelevant for this test, which;

- creates and starts a container with an anonymous volume
- verifies the anonymous volume was created
- removes the container
- verifies the anonymous volume was removed

We can force-remove the container to kill, and removed it; we probably
could've sufficed with "container create" (without starting), but it's
good to add extra coverage, in case running the container impacts whether
we're able to remove the volume.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-12 15:58:27 +02:00
Sebastiaan van Stijn
d30e61bff4 api/types/registry: add some tests for encoding/decoding authconfig
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-12 15:52:50 +02:00
Sebastiaan van Stijn
1d272a430d Merge pull request #50373 from thaJeztah/registry_deprecated
registry: remove deprecated `HostCertsDir()` and `SetCertsDir()`
2025-07-11 23:32:19 +02:00
Sebastiaan van Stijn
a7488beadd Merge pull request #50383 from thaJeztah/no_inspect_with_size
integration/container: use subtests in some places, add separate test for ContainerInspectWithRaw
2025-07-11 23:20:31 +02:00
Sebastiaan van Stijn
c7f02581b7 Merge pull request #50391 from robmry/no_error_on_stopped_userland_proxy
Don't log a warning when stopping a stopped docker-proxy
2025-07-11 23:17:38 +02:00
Sebastiaan van Stijn
9caa11d3c2 Merge pull request #50370 from thaJeztah/auth_unused_return
daemon: AuthenticateToRegistry: remove statusMessage return
2025-07-11 20:58:36 +02:00
Rob Murray
c31368fffb Don't raise an error when stopping a stopped docker-proxy
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-07-11 18:29:25 +01:00
Abubacarr Ceesay
f6b3b257c8 implement test api images history integration test on dedicated file
Signed-off-by: Abubacarr Ceesay <abubacarr671@gmail.com>
2025-07-11 19:04:37 +02:00
Abubacarr Ceesay
669163c416 remove test api images history integration cli test suite
Signed-off-by: Abubacarr Ceesay <abubacarr671@gmail.com>
2025-07-11 19:03:19 +02:00
Sebastiaan van Stijn
ca3e884c4d Merge pull request #50378 from thaJeztah/container_remove_deprecated
daemon/container: remove deprecated types and functions
2025-07-11 18:23:23 +02:00
Rob Murray
d52edeba07 Merge pull request #50358 from robmry/nftables_iptables_switching
Remove iptables rules when using nftables, and vice-versa
2025-07-11 16:41:23 +01:00
Rob Murray
16c886402d Merge pull request #50388 from robmry/fix_nftablesdoc_results
Fix expected results for nftablesdoc tests
2025-07-11 16:38:39 +01:00
Sebastiaan van Stijn
eb8c54cba5 Merge pull request #50377 from thaJeztah/graphdriver_cleanups
daemon/graphdriver: remove deprecated GetDriver(), redundant `init()`, and leftovers for graphdriver-plugins
2025-07-11 17:17:48 +02:00
Abubacarr Ceesay
04dbcddd6a migrate test api images history integration cli test to integration test
Signed-off-by: Abubacarr Ceesay <abubacarr671@gmail.com>
2025-07-11 17:16:31 +02:00
Sebastiaan van Stijn
99595adf51 Merge pull request #50385 from thaJeztah/client_add_raw_test
client: TestContainerInspectWithEmptyID test both inspect variants
2025-07-11 17:12:59 +02:00
Rob Murray
d51b0dd786 Merge pull request #50376 from thaJeztah/registry_deprecated_fields
registry: remove deprecated APIEndpoint fields
2025-07-11 15:53:06 +01:00
Rob Murray
b74c1dcca0 Merge pull request #50375 from thaJeztah/api_registry_remove_nondistributable
api/types/registry: remove deprecated fields for non-distributable artifacts
2025-07-11 15:52:10 +01:00
Rob Murray
f44f309edc Merge pull request #50374 from thaJeztah/registry_deprecated_ResolveRepository
registry: remove deprecated Service.ResolveRepository()
2025-07-11 15:51:53 +01:00
Rob Murray
adad33b30e Fix expected results for nftablesdoc tests
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-07-11 15:32:52 +01:00
Sebastiaan van Stijn
dde698a2e8 integration/container: add basic test for ContainerInspectWithRaw
Make sure we have basic coverage for this function; integration-cli may
have additional tests covering this as well.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-11 15:00:19 +02:00
Sebastiaan van Stijn
16ed75572f client: TestContainerInspectWithEmptyID test both inspect variants
Test both ContainerInspect and ContainerInspectWithRaw

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-11 14:52:23 +02:00
Rob Murray
2837112c8e Merge pull request #50355 from robmry/nftablesdoc
Add "nftablesdoc"
2025-07-11 13:01:32 +01:00
Paweł Gronowski
c47a4ab498 Merge pull request #50356 from robmry/nftables_ci
Run nftables in CI
2025-07-11 13:36:22 +02:00
Rob Murray
7f602d3b94 When switching between iptables/nftables, delete old rules
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-07-11 12:35:28 +01:00
Sebastiaan van Stijn
a5e3f39770 integration/container: avoid ContainerInspectWithRaw with "size"
These tests didn't use the raw output, and didn't use the size.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-11 13:01:56 +02:00
Sebastiaan van Stijn
88b67eb2fc integration/container: cleanup TestCreateWithCustomReadonlyPaths
- Use ContainerInspect instead of manually unmarshaling the raw JSON
- Explicitly stop the container instead of polling for it to die
- Add test for privileged containers
- Use subtests and run parallel

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-11 12:51:54 +02:00
Sebastiaan van Stijn
bd091c1a9d integration/container: cleanup TestCreateWithCustomMaskedPaths
- Use ContainerInspect instead of manually unmarshaling the raw JSON
- Explicitly stop the container instead of polling for it to die
- Use subtests and run parallel

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-11 12:51:30 +02:00
Rob Murray
0d189dd4e1 Merge pull request #50321 from robmry/simplify_gateway_programming
Simplify gateway programming
2025-07-11 10:47:03 +01:00
Rob Murray
779052873d Add nftablesdoc
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-07-11 09:36:08 +01:00
Sebastiaan van Stijn
ad579b8a1d daemon/container: remove deprecated IsValidStateString
This was deprecated in 44b653ef99, which
was part of v28.2, but the container package was moved inside the daemon
in 5419eb1efc, so these aliases were no
longer useful.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-11 01:47:24 +02:00
Sebastiaan van Stijn
312eebde49 daemon/container: remove deprecated IsValidHealthString
This was deprecated in df662ebc59, which
was part of v28.2, but the container package was moved inside the daemon
in 5419eb1efc, so these aliases were no
longer useful.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-11 01:42:10 +02:00
Sebastiaan van Stijn
e9fb208e87 daemon/container: remove deprecated StateStatus, WaitCondition
These were deprecated in 100102108b, which
was part of v28.2, but the container package was moved inside the daemon
in 5419eb1efc, so these aliases were no
longer useful.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-11 01:42:05 +02:00
Sebastiaan van Stijn
0d24798529 daemon/graphdriver: remove error or deprecated graphdriver-plugins
This error was added in 555dac5e14 to produce
an error for the deprecated graphdriver-plugins.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-11 01:24:39 +02:00
Sebastiaan van Stijn
7767525ccd daemon/graphdriver: remove deprecated GetDriver()
This was deprecated in 84cabde357, which
was part of v28.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-11 01:16:46 +02:00
Sebastiaan van Stijn
1fe4a0a7ad daemon/graphdriver: remove redundant init()
This was added in a63ff8da46, but looks
like the only reason was to just have the var initialized, so let's
do so when we create the var.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-11 01:10:47 +02:00
Akihiro Suda
1b072f717a Merge pull request #50371 from thaJeztah/push_auth_body
daemon/server: remove compatibility with API v1.4 auth-config on push
2025-07-11 07:22:38 +09:00
Sebastiaan van Stijn
bd8f9c3c1b registry: remove deprecated APIEndpoint.AllowNondistributableArtifacts
This field was deprecated in 1932091e21,
which is part of v28.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-11 00:17:29 +02:00
Sebastiaan van Stijn
65d424e126 registry: remove deprecated APIEndpoint.Official
This field was deprecated in d8fa2f8071,
which is part of v28.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-11 00:17:22 +02:00
Sebastiaan van Stijn
7252c3c78d registry: remove deprecated APIEndpoint.TrimHostName
This field was deprecated in 3014d6d7a3,
which is part of v28.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-11 00:01:20 +02:00
Sebastiaan van Stijn
11a18d3b00 api/types/registry: remove deprecated fields for non-distributable artifacts
These fields were deprecated in 1932091e21,
which is part of v28. They were kept in place for responses in older API
versions, but no longer used since 7d9c50db2b,
which implemented a fallback without requiring the fields to be present.

This patch:

- removes `ServiceConfig.AllowNondistributableArtifactsCIDRs`
- removes `ServiceConfig.AllowNondistributableArtifactsHostnames`

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-10 23:47:43 +02:00
Sebastiaan van Stijn
b3e513f80a registry: remove deprecated Service.ResolveRepository()
It was deprecated in 6c643bc366, which is
part of v28, and had no external consumers.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-10 23:19:13 +02:00
Sebastiaan van Stijn
5862b926f5 registry: remove deprecated SetCertsDir and unify CertsDir code
This was deprecated in b633c4cc33, which was
in v28, and no longer has any consumer, so we can remove it.

Now that we no longer have to synchronise `CertsDir` with `SetCertsDir`
we can also remove the synchronization (`homedir.GetConfigHome()` does
some additional lookups, but those usually are just looking up env-vars,
and `user.Current()` already has a `sync.Once` or equivalent). Also
unifying the platform-specific code to remove some abstraction and put
the logic in plain sight.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-10 22:47:17 +02:00
Sebastiaan van Stijn
924cd22d1d registry: remove deprecated HostCertsDir
This was deprecated in dd7ab0e82b which was
in v28, and no longer has any consumer, so we can remove it.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-10 21:41:25 +02:00
Rob Murray
178416334f Run CI tests with nftables
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-07-10 19:53:15 +01:00
Rob Murray
d82900dfde Merge pull request #50184 from robmry/nftables_port_rules
nftables: per-port rules
2025-07-10 19:36:27 +01:00
Cory Snider
5de59ca3d9 Merge pull request #50260 from corhere/libn/overlay-fix-logical-races
libnetwork/d/overlay: fix logical race conditions
2025-07-10 14:04:20 -04:00
Cory Snider
0059929d28 Merge pull request #50342 from corhere/libn/fix-networkdb-tombstone-bug
libn/networkdb: stop forging tombstone entries
2025-07-10 13:04:17 -04:00
Sebastiaan van Stijn
ea29dffaa5 daemon/server: remove compatibility with API v1.4 auth-config on push
Docker [API v1.4] and lower expected registry authentication to be sent in
the request body when pushing or pulling ("creating") images. [API v1.5]
(Docker v0.6.1) changed this to this to use a `X-Registry-Auth` header
instead.

This change was implemented in d04beb7f43,
which kept a fallback for clients using old (< v1.5) API versions which
would send authentication in the request body.

Given that we no longer support API versions older than v1.24, and clients
using API v1.5 would be over 12 Years old.

[API v1.4]: https://github.com/moby/moby/blob/v0.6.1/docs/sources/api/docker_remote_api_v1.4.rst#push-an-image-on-the-registry
[API v1.5]: https://github.com/moby/moby/blob/v0.6.2/docs/sources/api/docker_remote_api_v1.5.rst#push-an-image-on-the-registry

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-10 18:35:11 +02:00
Albin Kerouanton
aaf3e76ef2 Merge pull request #50344 from corhere/libn/fix-bcast-queue-deadlocks
libnetwork/networkdb: fix broadcast queue deadlocks
2025-07-10 16:22:22 +02:00
Paweł Gronowski
397149482a Merge pull request #50366 from dmcgowan/fix-integration-import-image-dep
Replace integration import test use of image type
2025-07-10 15:15:34 +02:00
Sebastiaan van Stijn
54e67d0054 daemon: AuthenticateToRegistry: remove statusMessage return
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-10 14:55:28 +02:00
Rob Murray
e8396af484 nftabler: add per-port rules
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-07-10 10:27:46 +01:00
Sebastiaan van Stijn
d4aa1cf9a9 Merge pull request #50364 from corhere/libn/ov-writetostore-comment
libn/d/overlay: drop obsolete writeToStore comment
2025-07-10 10:13:39 +02:00
Derek McGowan
b677c1a671 Replace integration import test use of image type
This is the only non-daemon import of the image package. The platform
type is also the better type to use.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-09 21:06:59 -07:00
Cory Snider
d90277372f libn/d/overlay: drop obsolete writeToStore comment
The writeToStore() call was removed from CreateNetwork in
commit 0fa873c0fe. The comment about
undoing the write is no longer applicable.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-07-09 16:48:37 -04:00
Albin Kerouanton
20ed15f607 Merge pull request #50340 from akerouanton/split-nat-routed-portmappings
libnet/d/bridge: split NATed and routed port mappings
2025-07-09 22:11:42 +02:00
Rob Murray
30b9480107 Create legacy links during endpoint Join
Legacy links were set up by ProgramExternalConnectivity, but
removed by Leave (rather than RevokeExternalConnectivity). The
options needed by legacy links are all available in Join, and
Join will only be called once per Endpoint. So, create legacy
links there.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-07-09 19:42:36 +01:00
Rob Murray
dd9e289b6e Don't pass sandbox options to ProgramExternalConnectivity
The same sandbox options are passed to Join.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-07-09 19:42:36 +01:00
Rob Murray
4f7afb8ac9 Remove libnet's logic to track a driver's port mapping state
Change the semantics of ProgramExternalConnectivity, libnet
can now call it whenever an endpoint is selected or deselected
as a container's gateway endpoint.

It's the driver's responsibility to remember what bindings it's
set up, and to work out what needs to change.

So, calling ProgramExternalConnectivity to tell the driver
an endpoint is no longer a gateway has the same effect as
RevokeExternalConnectivity - bindings need to be removed.

That means libnet no longer needs to work out whether to
Program/Revoke, it can just call ProgramExternalConnectivity.
RevokeExternalConnectivity has been removed.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-07-09 19:42:36 +01:00
Cory Snider
89d3419093 libnetwork/d/overlay: fix logical race conditions
The concurrency control in the overlay driver is logically unsound.
While the use of mutexes is sufficient to prevent data races --
violations of the Go memory model -- many operations which need to be
atomic are performed with unbounded concurrency.

Overhaul the use of locks in the overlay network driver. Implement sound
locking at the network granularity: operations may proceed concurrently
iff they are being applied to distinct networks. Push the responsibility
of locking up to the code which calls methods or accesses struct fields
to avoid deadlock situations like we had previously with
d.initSandboxPeerDB() and to make the code easier to reason about.

Each overlay network has a distinct peer db. The NetworkDB watch for the
overlay peer table for the network will only start after
(*driver).CreateNetwork returns and will be stopped before libnetwork
calls (*driver).DeleteNetwork, therefore the lifetime of the peer db for
a network is constrained to the lifetime of the network itself. Yet the
peer db for a network is tracked in a dedicated map, separately from the
network objects themselves. This has resulted in a parallel set of
mutexes to manage concurrency of the peer db distinct from the mutexes
for the driver and networks. Move the peer db for a network into a field
of the network struct and guard it from concurrent access using the
per-network lock. Move the methods for manipulating the peer db into the
network struct so that the methods can only be called if the caller has
a reference to the network object.

Network creation and deletion are synchronized using the driver-scope
mutex, but some of the kernel programming is performed outside of the
critical section. It is possible for network deletion to race with
recreating the network, interleaving the kernel programming for the
network creation and deletion, resulting in inconsistent kernel state.
Parallelize network creation and deletion soundly. Use a double-checked
locking scheme to soundly handle the case of concurrent CreateNetwork
and DeleteNetwork for the same network id without blocking operations
on other networks. Synchronize operations on a network so that
operations on the network such as adding a neighbor to the peer db are
performed atomically, not interleaved with deleting the network.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-07-09 14:12:59 -04:00
Cory Snider
843cd96725 libn/d/overlay: fix encryption race conditions
There is a dedicated mutex for synchronizing access to the encrMap.
Separately, the main driver mutex is used for synchronizing access to
the encryption keys. Their use is sufficient to prevent data races (if
used correctly, which is not the case) but not logical race conditions.
Programming the encryption parameters for a peer can race with
encryption keys being updated, which could lead to inconsistencies
between the parameters programmed into the kernel and the desired state.

Introduce a new mutex for synchronizing encryption operations. Use that
mutex to synchronize access to both encrMap and keys. Handle encryption
key updates in a critical section so they can no longer be interleaved
with kernel programming of encryption parameters.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-07-09 14:12:26 -04:00
Cory Snider
a1d299749c libn/d/overlay: inline secMapWalk into only caller
func (*driver) secMapWalk is a curious beast. It is named walk, yet it
also mutates the collection being iterated over. It returns an error,
but that error is always nil. It takes a callback that can break
iteration, yet the only caller makes no use of that affordance. Its
utility is limited and the abstraction hinders readability more than it
helps. Open-code the d.secMap.nodes loop into
func (*driver) updateKeys(), the only caller.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-07-09 12:53:20 -04:00
Cory Snider
74713e1a7d libnetwork/d/overlay: un-embed mutexes
It is easier to find all references when they are struct fields rather
than embedded structs.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-07-09 12:53:20 -04:00
Paweł Gronowski
674e401519 Merge pull request #50318 from dmcgowan/client-remove-buildkit-dep
Remove client buildkit dep
2025-07-09 12:32:27 +02:00
Albin Kerouanton
10f3491546 Merge pull request #50182 from robmry/nftables_endpoint_rules
nftables: per-endpoint rules
2025-07-09 10:50:37 +02:00
Paweł Gronowski
222610ae13 Merge pull request #50353 from vvoland/update-go
Update to go1.24.5
2025-07-09 01:22:42 +02:00
Albin Kerouanton
a05080c26c libnet/d/bridge: split NATed and routed port mappings
bindHostPorts currently handles both NATed and routed port mappings.
Split this into two separate functions, one for each type of mapping.
This will help split portmappers.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-07-09 00:05:28 +02:00
Albin Kerouanton
d229c1ba31 libnet/d/bridge: norm pb reqs before forming groups
Port bindings are currently sorted — to form groups that should be
mapped in one go — and then normalized by `configurePortBindingIPv[4|6]`.
However, gw_modes might not be the same for IPv4/v6, so the upcoming
split of NATed / routed portmappers will require that they're processed
independently.

With this commit, PBs are now normalized (by calling the `configure...`
funcs), and then sorted. The sort func is updated to group routed PBs.

`needSamePort` was comparing the container's IP address, but this field
was never set by the time it's called. Now it's set, and has a different
value when IPv4 / IPv6 portmappings are mixed, so remove it from the
comparison.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-07-09 00:05:28 +02:00
Albin Kerouanton
bc97e2820d Merge pull request #50307 from akerouanton/sctp-filelistener
libnet/d/bridge: pass SCTP sock to the proxy
2025-07-09 00:04:27 +02:00
Rob Murray
e2034267f6 nftabler: add per-endpoint rules
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-07-08 19:43:34 +01:00
Albin Kerouanton
b5bf89c315 libnet/d/bridge: pass SCTP sock to the proxy
Since commit b3fabedec, the bridge driver maps ports following a 3-step
process: 1. create a socket, and bind it to the host port; 2. create
iptables rules; 3. start the userland proxy (if it's enabled). This
ensures that the port is really free before inserting iptables rules
that could otherwise disrupt host services.

However, this 3-step process wasn't implemented for SCTP, because we had
no way to instiantiate an SCTP listener from an fd. Since
github.com/ishidawataru/sctp@4719921f9, we can.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-07-08 20:07:22 +02:00
Paweł Gronowski
5c9e4c5d0b Merge pull request #50316 from corhere/libn/networkdb-wireshark
contrib: add Wireshark plugins for NetworkDB
2025-07-08 19:31:26 +02:00
Paweł Gronowski
0a047e825c update to go1.24.5
- https://github.com/golang/go/issues?q=milestone%3AGo1.24.5+label%3ACherryPickApproved
- full diff: https://github.com/golang/go/compare/go1.24.4...go1.24.5

This minor releases include 1 security fixes following the security policy:

- cmd/go: unexpected command execution in untrusted VCS repositories

    Various uses of the Go toolchain in untrusted VCS repositories can result in
    unexpected code execution. When using the Go toolchain in directories fetched
    using various VCS tools (such as directly cloning Git or Mercurial repositories)
    can cause the toolchain to execute unexpected commands, if said directory
    contains multiple VCS configuration metadata (such as a '.hg' directory in a Git
    repository). This is due to how the Go toolchain attempts to resolve which VCS
    is being used in order to embed build information in binaries and determine
    module versions.

    The toolchain will now abort attempting to resolve which VCS is being used if it
    detects multiple VCS configuration metadata in a module directory or nested VCS
    configuration metadata (such as a '.git' directoy in a parent directory and a
    '.hg' directory in a child directory). This will not prevent the toolchain from
    building modules, but will result in binaries omitting VCS related build
    information.

    If this behavior is expected by the user, the old behavior can be re-enabled by
    setting GODEBUG=allowmultiplevcs=1. This should only be done in trusted
    repositories.

    Thanks to RyotaK (https://ryotak.net) of GMO Flatt Security Inc for reporting
    this issue.

    This is CVE-2025-4674 and https://go.dev/issue/74380.

View the release notes for more information:
https://go.dev/doc/devel/release#go1.24.5

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-07-08 19:21:37 +02:00
Sebastiaan van Stijn
836bd72114 Merge pull request #50347 from thaJeztah/windows_networking_deflake
integration/networking: increase context timeout for attach
2025-07-08 16:50:42 +02:00
Sebastiaan van Stijn
20c0fe24f5 Merge pull request #50086 from vvoland/vendor-clock
vendor: code.cloudfoundry.org/clock v1.37.0
2025-07-08 16:37:30 +02:00
Sebastiaan van Stijn
963e7e6595 Merge pull request #50179 from thaJeztah/windows_updates
gha: update to windows 2022 / 2025
2025-07-08 15:28:23 +02:00
Rob Murray
266d10a075 Merge pull request #50181 from robmry/nftables_network_rules
nftables: per-network rules
2025-07-08 14:11:13 +01:00
Sebastiaan van Stijn
0ea28fede0 integration/networking: increase context timeout for attach
The TestNatNetworkICC and TestFlakyPortMappedHairpinWindows (TestPortMappedHairpinWindows)
tests were frequently failing on Windows with a context timeout;

    === FAIL: github.com/docker/docker/integration/networking TestNatNetworkICC/User_defined_nat_network (9.67s)
        nat_windows_test.go:62: assertion failed: error is not nil: Post "http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.51/containers/4357bd24c9b77b955ee961530d1f552ce099b3dcbeb396db599971b2396d8b08/start": context deadline exceeded
        panic.go:636: assertion failed: error is not nil: Error response from daemon: error while removing network: network mynat has active endpoints (name:"ctr2" id:"dc8d597dafef")

    === FAIL: github.com/docker/docker/integration/networking TestNatNetworkICC (18.34s)

    === FAIL: github.com/docker/docker/integration/networking TestFlakyPortMappedHairpinWindows (13.02s)
        nat_windows_test.go:110: assertion failed: error is not nil: Post "http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.51/containers/65207ae3d6953d85cd2123feac45af60b059842d570d4f897ea53c813cba3cb4/start": context deadline exceeded
        panic.go:636: assertion failed: error is not nil: Error response from daemon: error while removing network: network clientnet has active endpoints (name:"amazing_visvesvaraya" id:"18add58d415e")

These timeouts were set in c1ab6eda4b and
2df4391473, and were shared between Linux
and Windows; likely Windows is slower to start, so these timeouts to be
expected.

Let's increase the context timeout to give it a bit more time.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-08 14:18:37 +02:00
Sebastiaan van Stijn
1de9f39f2c Merge pull request #50343 from corhere/libn/networkdb-rejoin-tests
libnetwork/networkdb: make TestNetworkDBIslands not flaky
2025-07-08 12:34:50 +02:00
Albin Kerouanton
c833bd598e vendor: github.com/ishidawataru/sctp v0.0.0-20250708014235-1989182a9425
Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-07-08 12:33:18 +02:00
Paweł Gronowski
03a662b80e vendor: code.cloudfoundry.org/clock v1.37.0
full diff: https://github.com/cloudfoundry/clock/compare/v1.1.0...v1.37.0

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-07-08 10:41:18 +02:00
Sebastiaan van Stijn
b47847e139 Merge pull request #50336 from thaJeztah/remove_libtrust
distribution: fix detection of v1 images and remove libtrust dependency
2025-07-08 10:38:28 +02:00
Cory Snider
08bde5edfa libnetwork/networkdb: fix broadcast queue deadlocks
NetworkDB's JoinNetwork function enqueues a message onto a
TransmitLimitedQueue while holding the NetworkDB mutex locked for
writing. The TransmitLimitedQueue has its own synchronization;
it locks its mutex when enqueueing a message. Locking order:
  1. (NetworkDB).RWMutex.Lock()
  2. (TransmitLimitedQueue).mu.Lock()

NetworkDB's gossip periodic task calls GetBroadcasts on the same
TransmitLimitedQueue to retrieve the enqueued messages. GetBroadcasts
invokes the queue's NumNodes callback while the mutex is locked. The
NumNodes callback function that NetworkDB sets locks the NetworkDB mutex
for reading to take the length of the nodes map. Locking order:
  1. (TransmitLimitedQueue).mu.Lock()
  2. (NetworkDB).RWMutex.RLock()

If one goroutine calls GetBroadcasts on the queue concurrently with
another goroutine calling JoinNetwork on the NetworkDB, the goroutines
may deadlock due to the lock inversion.

Fix the deadlock by caching the number of nodes in an atomic variable so
that the NumNodes callback can load the value without blocking or
violating Go's memory model. And fix a similar deadlock situation with
the table-event broadcast queues.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-07-07 15:45:29 -04:00
Sebastiaan van Stijn
1284a44efa Merge pull request #50328 from thaJeztah/rm_LogReleaseMetadata
layer: remove LogReleaseMetadata utility
2025-07-07 21:27:04 +02:00
Sebastiaan van Stijn
42701c5406 Merge pull request #50335 from thaJeztah/less_distribution
integration-cli: remove uses of legacy distribution types
2025-07-07 21:26:14 +02:00
Sebastiaan van Stijn
0e40c2546f Merge pull request #50337 from thaJeztah/pkg_plugin_no_distribution
daemon/pkg/plugin: remove dependency on legacy distribution package
2025-07-07 21:25:45 +02:00
Cory Snider
aff444df86 libn/networkdb: make TestNetworkDBIslands not flaky
With rejoinClusterBootStrap fixed in tests, split clusters should
reliably self-heal in tests as well as production. Work around the other
source of flakiness in TestNetworkDBIslands: timing out waiting for a
failed node to transition to gracefully left. This flake happens when
one of the leaving nodes sends its NodeLeft message to the other leaving
node, and the second is shut down before it has a chance to rebroadcast
the message to the remaining nodes. The proper fix would be to leverage
memberlist's own bookkeeping instead of duplicating it poorly with user
messages, but doing so requires a change in the memberlist module.
Instead have the test check that the sum of failed+left nodes is
expected instead of waiting for all nodes to have failed==3 && left==0.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-07-07 14:09:01 -04:00
Cory Snider
1e1be54d3e libn/networkdb: prevent spurious rejoins in tests
The rejoinClusterBootStrap periodic task rejoins with the bootstrap
nodes if none of them are members of the cluster. It correlates the
cluster nodes with the bootstrap list by comparing IP addresses,
ignoring ports. In normal operation this works out fine as every node
has a unique IP address, but in unit tests every node listens on a
distinct port of 127.0.0.1. This situation causes the check to
incorrectly filter out all nodes from the list, mistaking them for the
local node.

Filter out the local node using pointer equality of the *node to avoid
any ambiguity. Correlate the remote nodes by IP:port so that the check
behaves the same in tests and in production.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-07-07 14:09:01 -04:00
Cory Snider
21d9109750 libn/networkdb: stop forging tombstone entries
When a node leaves a network, all entries owned by that node are
implicitly deleted. The other NetworkDB nodes handle the leave by
setting the deleted flag on the entries owned by the left node in their
local stores. This behaviour is problematic as it results in two
conflicting entries with the same Lamport timestamp propagating
through the cluster.

Consider two NetworkDB nodes, A, and B, which are both joined to some
network. Node A in quick succession leaves the network, immediately
rejoins it, then creates an entry. If Node B processes the
entry-creation event first, it will add the entry to its local store
then set the deleted flag upon processing the network-leave. No matter
how many times B bulk-syncs with A, B will ignore the live entry for
having the same timestamp as its local tombstone entry. Once this
situation occurs, the only way to recover is for the entry to get
updated by A with a new timestamp.

There is no need for a node to store forged tombstones for another
node's entries. All nodes will purge the entries naturally when they
process the network-leave or node-leave event. Simply delete the
non-owned entries from the local store so there is no inconsistent state
to interfere with convergence when nodes rejoin a network. Have nodes
update their local store with tombstones for entries when leaving a
network so that after a rapid leave-then-rejoin the entry deletions
propagate to nodes which may have missed the leave event.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-07-07 12:24:53 -04:00
Rob Murray
428dbe617a nftabler: add network level rules
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-07-07 13:49:35 +01:00
Rob Murray
a55fede2d4 Pass context to nftables functions
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-07-07 13:46:45 +01:00
Rob Murray
1c5d6d1ee3 Mark iptabler/nftabler golden results as generated
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-07-07 13:46:45 +01:00
Sebastiaan van Stijn
ee6a6b061f daemon/pkg/plugin: remove dependency on legacy distribution package
Use the media-types defined in containerd, and create a local copy
of the media-type for plugins, which is not defined in either the
OCI or containerd package.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-05 21:19:40 +02:00
Sebastiaan van Stijn
09689298e3 distribution: fix detection of v1 images and remove libtrust dependency
The current detection based on mediaType only accounted for the non-signed
mediatype (`application/vnd.docker.distribution.manifest.v1+json`), but
most (if not all) v1 images used the "signed" manifest type; for example;

    docker buildx imagetools inspect docker:1.0.1
    Name:      docker.io/library/docker:1.0.1
    MediaType: application/vnd.docker.distribution.manifest.v1+prettyjws
    Digest:    sha256:666987df8e0c46670ea52bcd078547297a738fd6b421ec77aac910e1c0f688fd

Various code-paths would still detect the unsupported type through type-
matching the `*schema1.SignedManifest` type, but given that the only reason
for this is to detect whether the image is supported, we might as well just
match the mediaType.

Unfortunately, the [containerd images package][1] currently only defines a
const for the signed variant, and not for the unsigned ones, so to remove
the dependency on the `schema1` package, this patch introduces a (temporary)
local definition.

With this patch, the dependency on the "schema1" package is removed, and with
that also the use of "libtrust"; the dependency still shows up in vendor.mod
due to the docker/distribution dependency not being a go module, but should
dissolve once we remove that dependency in future.

This patch can also be verified using the `distribution` endpoint, which
returns an error when trying to get information for a "v1" image;

    curl -v --unix-socket /var/run/docker.sock 'http://localhost/v1.51/distribution/docker.io/library/docker:1.0.1/json'
    *   Trying /var/run/docker.sock:0...
    * Connected to localhost (/var/run/docker.sock) port 80 (#0)
    > GET /v1.51/distribution/docker.io/library/docker:1.0.1/json HTTP/1.1
    > Host: localhost
    > User-Agent: curl/7.88.1
    > Accept: */*
    >
    < HTTP/1.1 400 Bad Request
    < Api-Version: 1.51
    < Content-Type: application/json
    < Docker-Experimental: false
    < Ostype: linux
    < Server: Docker/dev (linux)
    < Date: Sat, 05 Jul 2025 17:00:18 GMT
    < Content-Length: 311
    {"message":"Docker Image Format v1 and Docker Image manifest version 2, schema 1 support has been removed. Suggest the author of docker.io/library/docker:1.0.1 to upgrade the image to the OCI Format or Docker Image manifest v2, schema 2. More information at https://docs.docker.com/go/deprecated-image-specs/"}

    curl -v --unix-socket /var/run/docker.sock 'http://localhost/v1.51/distribution/docker.io/library/docker:28/json'
    *   Trying /var/run/docker.sock:0...
    * Connected to localhost (/var/run/docker.sock) port 80 (#0)
    > GET /v1.51/distribution/docker.io/library/docker:28/json HTTP/1.1
    > Host: localhost
    > User-Agent: curl/7.88.1
    > Accept: */*
    >
    < HTTP/1.1 200 OK
    < Api-Version: 1.51
    < Content-Type: application/json
    < Docker-Experimental: false
    < Ostype: linux
    < Server: Docker/dev (linux)
    < Date: Sat, 05 Jul 2025 17:01:06 GMT
    < Content-Length: 541
    {"Descriptor":{"mediaType":"application/vnd.oci.image.index.v1+json","digest":"sha256:0a2ee60851e1b61a54707476526c4ed48cc55641a17a5cba8a77fb78e7a4742c","size":5165},"Platforms":[{"architecture":"amd64","os":"linux"},{"architecture":"unknown","os":"unknown"},{"architecture":"arm","os":"linux","variant":"v6"},{"architecture":"unknown","os":"unknown"},{"architecture":"arm","os":"linux","variant":"v7"},{"architecture":"unknown","os":"unknown"},{"architecture":"arm64","os":"linux","variant":"v8"},{"architecture":"unknown","os":"unknown"}]}

[1]: https://github.com/containerd/containerd/blob/v2.1.3/core/images/mediatypes.go#L54-L55

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-05 19:57:10 +02:00
Sebastiaan van Stijn
ac9d5a6068 integration-cli: TestPullFailsWithAlteredLayer: use OCI manifest
The OCI types should be able to unmarshal the image manifest (regardless
if it was created from the legacy distribution types or otherwise), so
we can drop the use of the legacy distribution types here.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-05 17:56:35 +02:00
Sebastiaan van Stijn
fd47ccef7b integration-cli: TestPullFailsWithAlteredManifest: use OCI manifest
The OCI types should be able to unmarshal the image manifest (regardless
if it was created from the legacy distribution types or otherwise), so
we can drop the use of the legacy distribution types here.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-05 17:52:48 +02:00
Sebastiaan van Stijn
4e818970e2 integration-cli: TestPullManifestList: use OCI media-types
This test is verifying that push/pull works; current versions of the registry
used should support both the legacy (docker distribution) and OCI media-types,
so let's use the OCI types.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-05 17:48:48 +02:00
Sebastiaan van Stijn
f6ef56a0bc integration-cli: TestPullManifestList: rewrite using OCI types
Trying to reduce the places where we depend on the legacy distribution
dependency. For this test, we used it to generate the JSON for a manifest-list,
which we can do with the OCI types as well.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-05 17:44:50 +02:00
Sebastiaan van Stijn
83264918d3 Merge pull request #50333 from fussybeaver/50331-swagger-gwpriority-integer
api: swagger: Tweak type of GwPriority to integer
2025-07-05 17:16:41 +02:00
Niel Drummond
51d6687754 api: swagger: Tweak type of GwPriority to integer
Signed-off-by: Niel Drummond <niel@drummond.lu>
2025-07-05 14:47:50 +01:00
Niel Drummond
bfc0c7cff5 docs: api: Tweak type of GwPriority to integer
Signed-off-by: Niel Drummond <niel@drummond.lu>
2025-07-05 14:46:12 +01:00
Sebastiaan van Stijn
73c199f215 Merge pull request #50323 from thaJeztah/use_oci_identity
deprecate layer.CreateChainID for OCI identity
2025-07-05 15:39:00 +02:00
Sebastiaan van Stijn
557b5d60d3 layer: remove LogReleaseMetadata utility
Inline the code where used to allow producing logs customized to the
code-path performing the cleanup.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-04 18:27:01 +02:00
Sebastiaan van Stijn
7d18f65eb2 distribution/xfer: improve test reporting
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-04 17:12:34 +02:00
Sebastiaan van Stijn
291872e086 remove type conversions
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-04 17:12:34 +02:00
Sebastiaan van Stijn
ade244f97d deprecate layer.CreateChainID for OCI identity
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-04 17:12:31 +02:00
Brian Goff
8652cf6920 Merge pull request #50324 from thaJeztah/rm_legacy_load 2025-07-04 07:39:19 -07:00
Sebastiaan van Stijn
10e9ab66f9 image/tarexport: inline validateManifest utility
It was just checking if a value is nil; no need to maintain a utility
for that.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-04 11:49:29 +02:00
Sebastiaan van Stijn
471f173170 image/tarexport: improve error messages for invalid archives
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-04 11:49:02 +02:00
Sebastiaan van Stijn
033750cf80 image/tarexport: remove suport for loading v0/v1 images
This removes the tarexporter.legacyLoadImage method and related helpers.
This functionality was added in 01ba0a935b
(docker v1.10), which introduced the new content-addressable image
format; this code provided backward-compatibility with older archives
which contained v0/v1 images.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-04 11:48:52 +02:00
Cory Snider
ebfafa1561 contrib: add Wireshark plugins for NetworkDB
Contribute a Wireshark plugin for decrypting and dissecting
hashicorp/memberlist messages. And contribue a plugin for dissecting the
NetworkDB messages transported as memberlist User messages.

Add a feature to NetworkDB to log the encryption keys to a file for the
Wireshark memberlist plugin to consume, configured using an environment
variable.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-07-03 17:58:19 -04:00
Rob Murray
242916b3f9 Merge pull request #45415 from thaJeztah/test_TestPushToCentralRegistryUnauthorized
integration-cli: debug TestPushToCentralRegistryUnauthorized
2025-07-03 14:16:56 +01:00
Sebastiaan van Stijn
a8bcd0db55 Merge pull request #50314 from thaJeztah/gha_rm_go_version_arg
gha: remove GO_VERSION build-arg from builds
2025-07-03 09:59:18 +02:00
Albin Kerouanton
1e1711d405 Merge pull request #50283 from robmry/gatewayness_visible_to_libnet_drivers
Tell libnet's drivers which endpoints have been selected as gateways
2025-07-03 08:22:18 +02:00
Akihiro Suda
c1e6edb7ee Merge pull request #50312 from thaJeztah/image_rootfs_clone
image: RootFS.Clone: simplify
2025-07-03 11:33:55 +09:00
Akihiro Suda
27fc271ef5 Merge pull request #50315 from thaJeztah/bump_gotestsum
Dockerfile: bump gotest.tools/gotestsum v1.12.3 (for go1.25)
2025-07-03 11:32:50 +09:00
Akihiro Suda
166f02ad14 Merge pull request #50317 from dmcgowan/client-test-cleanup
Replace use of env test util with standard library call
2025-07-03 11:32:28 +09:00
Derek McGowan
aae26b80fe Remove client buildkit dep
Remove unused package from client which brings in buildkit dep

Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-02 16:08:15 -07:00
Derek McGowan
e93e15afb0 Replace use of env test util with standard library call
As of Go 1.17, `Setenv` can be used to set environment variables
specific to a single test. This also removes a package which gets
vendored just for this.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-02 15:34:01 -07:00
Sebastiaan van Stijn
4754c15e2b Dockerfile: bump gotest.tools/gotestsum v1.12.3 (for go1.25)
full diff: https://github.com/gotestyourself/gotestsum/compare/v1.12.0...v1.12.3

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-02 23:13:03 +02:00
Sebastiaan van Stijn
fa4f3c979f gha: remove GO_VERSION build-arg from builds
The same env-var is used for action/setup-go as for overriding
the default Go version in Dockerfiles, however action/setup-go
only accepts SemVer (e.g. 1.25.0-rc.1) whereas the official golang
image follows the Go project's versioning, which doesn't use
a SemVer-compatible format (go1.25rc1 / 1.25rc1).

Trying to use the same "GO_VERSION" value for both will therefore
fail.

As we're already updating the default version in the Dockerfile to
the version we want to use, let's remove the --build-arg, and use
the default that's set in the Dockerfile.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-02 22:31:39 +02:00
Sebastiaan van Stijn
3b50d0dbdc Merge pull request #50311 from thaJeztah/stack_ignore_errs
pkg/stack: suppress some unhandled errors
2025-07-02 21:55:55 +02:00
Sebastiaan van Stijn
136c0e591b image: RootFS.Clone: simplify
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-02 17:36:48 +02:00
Sebastiaan van Stijn
c64178d612 Merge pull request #50303 from thaJeztah/xfer_remove_arg
distribution/xfer: LayerDownloadManager.Download: remove initialRootFS arg
2025-07-02 17:36:01 +02:00
Rob Murray
90ba723280 Merge pull request #50310 from akerouanton/drop-libnet-diag-stackdump-handler
libnet/diag: remove /stackdump endpoint
2025-07-02 16:01:45 +01:00
Sebastiaan van Stijn
aea776332b pkg/stack: suppress some unhandled errors
Keeping my IDE happy

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-02 16:02:04 +02:00
Albin Kerouanton
e32d26cb59 libnet/diag: remove /stackdump endpoint
This endpoint was useful when libnetwork was a standalone component that
could be integrated with other products, but now that libnetwork is part
of moby/moby, and considered an internal package, we're sure that the
Engine's SIGUSR1 handler is available to dump stack traces. No need
to keep a duplicate feature.

Moreover, this endpoint is only available over an HTTP server listening
on 127.0.0.1 (hardcoded), and the stackdump is always written to the
disk. So, to have use of it, you need access to the host anyway.

Finally, unlike the Engine's SIGUSR1 handler, this endpoint write stack
traces to `/tmp` and not to the daemon's `--data-root`.

This is a non-core feature, there's an alternative available, it's not
documented in libnetwork/cmd/diagnostic/README.md (which is the
only place that mentions the diag server AFAIK), and the diag client
doesn't support it, so drop it unceremoniously.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-07-02 15:16:51 +02:00
Sebastiaan van Stijn
c463c3295f Merge pull request #50306 from thaJeztah/image_rm_legacy_handling
image: remove special handling for legacy "layers+base" windows images
2025-07-02 12:54:04 +02:00
Sebastiaan van Stijn
106d8e1ad5 Merge pull request #50287 from thaJeztah/less_loopie
builder/dockerfile: BuildFromConfig: combine loops
2025-07-02 12:52:47 +02:00
Rob Murray
a881e9e057 Remember port binding state in the bridge driver
When ProgramExternalConnectvity is called, the bridge driver
works out whether it needs to add port bindings for an endpoint
based on whether it was selected as the container's gateway.

Remember whether IPv4/IPv6 bindings have been set up, as part
of the endpoint's state. When ProgramExternalConnectivity is
called again, use differences between that stored state and
the newly requested state to decide whether to add bindings.

Port binding state is not persisted, on live-restore port
bindings are re-created (so, the initial state should always
be that no port bindings are set up).

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-07-02 11:40:29 +01:00
Sebastiaan van Stijn
dab8341a87 Merge pull request #50294 from thaJeztah/listeners_doc_permissions
daemon/listeners: extract utility for DACL, and improve docs
2025-07-02 11:47:02 +02:00
Rob Murray
7ea50c14d6 Remote network driver: remember gateway state
In the remote network driver's ProgramExternalConnectivity,
remember whether endpoints have already been configured as
gateways - so that it's ok for libnetwork to call it more
than once with the same configuration (without passing on
those calls to the actual network driver in HTTP requests).

There's no need to persist this data, even on live-restore
ProgramExternalConnectivity will be called again.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-07-02 10:21:31 +01:00
Rob Murray
054738bce3 Pass gateway endpoint ids to ProgramExternalConnectivity
Moving towards making it the network driver's responsibility
to work out whether it should set up port bindings, based on
libnet's gateway selection.

This first step lets the driver know whether an endpoint has
been selected as the container's gateway, allowing the driver
to work out whether mappings between IPv6 host addresses and
IPv4 container addresses are required (when supported).

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-07-02 10:16:07 +01:00
Sebastiaan van Stijn
3805bbf913 Merge pull request #50305 from tonistiigi/update-buildkit-v0.23.2
vendor: update buildkit to v0.23.2
2025-07-02 10:46:34 +02:00
Sebastiaan van Stijn
07e5be0a18 image: remove special handling for legacy "layers+base" windows images
This special case was added in 540c8e9b20 to
handle situations where a Windows daemon would still have images in legacy
format on Disk.

For legal reasons, Windows base-images were not allowed to be distributed
through registries, and because of that had to be pre-loaded on the host.
Such images would have a RootFS with a special `layers+base` type.

This type is no longer used and [removed from the OCI image spec][1], which
now only allows a single type ("Layers"); from the [OCI image-spec][2]:

> - **rootfs** _object_, REQUIRED
>
>   The rootfs key references the layer content addresses used by the image.
>   This makes the image config hash depend on the filesystem hash.
>
>     - **type** _string_, REQUIRED
>
>       MUST be set to `layers`.
>       Implementations MUST generate an error if they encounter a unknown value while verifying or unpacking an image.

The special handling was added in 2016 to help in the transition, but
it's very unlikely such images still exist, so we can remove the special
handling.

This reverts commit 540c8e9b20.

[1]: https://github.com/opencontainers/image-spec/pull/211
[2]: https://github.com/opencontainers/image-spec/blob/v1.1.1/config.md#properties

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-02 10:40:28 +02:00
Tonis Tiigi
5efd2286da vendor: update buildkit to v0.23.2
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2025-07-01 20:33:42 -07:00
Tianon Gravi
ab92fc4524 Merge pull request #50297 from thaJeztah/remove_contrib_mkimage
contrib: remove mkimage-xxx scripts
2025-07-01 14:25:47 -07:00
Sebastiaan van Stijn
7f69ff5c56 Merge pull request #50302 from thaJeztah/import_aliases
fix some inconsistency in import aliases
2025-07-01 21:59:24 +02:00
Sebastiaan van Stijn
e1b70074ec distribution/xfer: LayerDownloadManager.Download: remove initialRootFS arg
All uses of this method would construct a RootFS from scratch, so we may as
well remove the argument.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-01 21:52:36 +02:00
Sebastiaan van Stijn
173436c702 distribution/xfer: rename var that shadowed type
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-01 21:51:36 +02:00
Sebastiaan van Stijn
0683bc6355 fix some inconsistency in import aliases
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-01 21:48:26 +02:00
Sebastiaan van Stijn
a25cc9d6d0 Merge pull request #50296 from thaJeztah/move_usergroup_to_daemon
internal/usergroup: move to daemon/internal
2025-07-01 21:42:48 +02:00
Sebastiaan van Stijn
9582e205d0 Merge pull request #50299 from thaJeztah/internalize_restartmanager
restartmanager: move to daemon/internal
2025-07-01 21:42:19 +02:00
Sebastiaan van Stijn
fe55b9e54e Merge pull request #50301 from thaJeztah/remove_reports
remove project dev "reports"
2025-07-01 21:41:29 +02:00
Sebastiaan van Stijn
43951937d7 Merge pull request #50298 from thaJeztah/remove_vendoring
remove VENDORING.md
2025-07-01 21:41:08 +02:00
Sebastiaan van Stijn
c8c5dc274e Merge pull request #50300 from thaJeztah/hide_codecov
rename codecov.yml to .codecov.yml
2025-07-01 21:40:49 +02:00
Sebastiaan van Stijn
d207ee97ff daemon/listeners: extract utility for DACL, and improve docs
- Outline the DACL used on Windows.
- Extract constructing the SDDL to a utility, to allow re-using
  for unix sockets in future.
- Improve documentation to mention that Windows allows multiple
  groups and/or users to be given access.

Also removing an intermediate variable.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-01 21:39:52 +02:00
Sebastiaan van Stijn
f4ddb1fd2f Merge pull request #50278 from dmcgowan/api-build-aux
Add progress aux emitter to build backend
2025-07-01 18:03:53 +02:00
Rob Murray
725bc227da Merge pull request #50284 from thaJeztah/remove_deprecated_dockerCmdWithResult
integration-cli: remove uses of deprecated dockerCmdWithResult utility
2025-07-01 15:59:34 +01:00
Sebastiaan van Stijn
18dc570918 remove project dev "reports"
The original intent of this directory was to provide weekly reports
for calls and project meetings, but these haven't been produced for
several Years now (with the most recent report being 8 Years ago).

Let's remove this directory as the information in these reports is
outdated and no longer relevant. If needed, they can still be found
in Git history.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-01 16:42:17 +02:00
Sebastiaan van Stijn
93bbd21d82 rename codecov.yml to .codecov.yml
Make it a hidden file. From the [CodeCov docs][1]:

> Can I name the file .codecov.yml?
>
> Yes, you can name the file `codecov.yml` or `.codecov.yml`. However, the
> file must still be located in the repository root, `dev/`, or `.github/`
> directories

[1]: https://docs.codecov.com/docs/codecov-yaml#can-i-name-the-file-codecovyml

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-01 16:17:17 +02:00
Sebastiaan van Stijn
ce3c8785dc restartmanager: move to daemon/internal
The restartmanager is only used internally by the daemon, and has no external
users. Move it to the daemon/internal package.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-01 16:10:03 +02:00
Sebastiaan van Stijn
256f96ef59 remove VENDORING.md
This document was added to outline our vendoring policies and to describe
versioning. It's obsoleted by Go module's definition, which follows SemVer
and MVS.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-01 16:03:21 +02:00
Sebastiaan van Stijn
717188201a contrib: remove mkimage-xxx scripts
These scripts have not been actively maintained for several Years, are
un-tested, and there may be better alternatives / implementations to
use for this purpose. A search on GitHub only showed a single active
use of one of these scripts; let's remove them, as there are no plans
to maintain (and test) these scripts.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-01 15:51:56 +02:00
Sebastiaan van Stijn
3f8630cb84 internal/usergroup: move to daemon/internal
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-01 15:22:39 +02:00
Sebastiaan van Stijn
cbe6e31487 internal/usergroup: move windows consts to builder/dockerfile
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-01 15:18:27 +02:00
Brian Goff
89eb40858c Merge pull request #50125 from thaJeztah/client_winio_dialpipe
client: use go-winio.DialPipe directly
2025-06-30 12:10:59 -07:00
Rob Murray
9cb179d614 Merge pull request #50106 from corhere/libn/overlay-peerdb-soundness
libnetwork/d/overlay: properly model peer db
2025-06-30 19:13:08 +01:00
Sebastiaan van Stijn
8dbe0f45a9 integration-cli: debug TestPushToCentralRegistryUnauthorized
Seeing some test-failures, which could be due to changes on Docker Hub

    === Failed
    === FAIL: github.com/docker/docker/integration-cli TestDockerCLIPushSuite/TestPushToCentralRegistryUnauthorized (51.08s)
        docker_cli_push_test.go:229: assertion failed: strings.Contains(out, "Retrying") is true

    === FAIL: github.com/docker/docker/integration-cli TestDockerCLIPushSuite (101.49s)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-30 15:44:52 +02:00
Sebastiaan van Stijn
5fe253cd79 builder/dockerfile: BuildFromConfig: combine loops
This function effectively is looping three times over the given commands
to apply to the image. The first two loops did not yet invoke the builder
instance, so we can combine those and execute then before constructing the
builder. We could even consider combining all of them to a single loop, but
keeping it closer to the existing logic or now.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-30 15:40:49 +02:00
Sebastiaan van Stijn
de52d67ec0 Merge pull request #50279 from dmcgowan/move-libcontainerd
Move libcontainerd and container under daemon
2025-06-30 13:35:37 +02:00
Sebastiaan van Stijn
a30b63eafc integration-cli: remove uses of deprecated dockerCmdWithResult utility
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-30 13:21:30 +02:00
Sebastiaan van Stijn
650ab23785 Merge pull request #49920 from mmorel-35/fix-nakedret
pluginrpc-gen: align generator with generated
2025-06-30 12:18:27 +02:00
Sebastiaan van Stijn
c5b25bf7de Merge pull request #50225 from robmry/TestRoutedNonGateway
Add TestRoutedNonGateway
2025-06-30 11:56:40 +02:00
Derek McGowan
90f9ce14f1 Move libcontainerd to daemon/internal/libcontainerd
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-27 14:29:12 -07:00
Derek McGowan
3ee8c1e3a9 Move libcontainerd/types to daemon/internal/libcontainerd/types
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-27 14:28:56 -07:00
Derek McGowan
841a369b8f Move libcontainerd/supervisor to daemon/internal/libcontainerd/supervisor
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-27 14:28:40 -07:00
Derek McGowan
fe959261d3 Move libcontainerd/shimopts to daemon/internal/libcontainerd/shimopts
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-27 14:28:24 -07:00
Derek McGowan
4e8bd050bf Move libcontainerd/remote to daemon/internal/libcontainerd/remote
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-27 14:28:08 -07:00
Derek McGowan
dd1656e6bc Move libcontainerd/queue to daemon/internal/libcontainerd/queue
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-27 14:27:52 -07:00
Derek McGowan
6835f367e5 Move libcontainerd/local to daemon/internal/libcontainerd/local
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-27 14:27:36 -07:00
Derek McGowan
5419eb1efc Move container to daemon/container
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-27 14:27:21 -07:00
Derek McGowan
a02ba3c7df Move container/stream to daemon/internal/stream
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-27 14:27:05 -07:00
Derek McGowan
9d9cb00d50 Move container/stream/bytespipe to daemon/internal/stream/bytespipe
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-27 14:26:49 -07:00
Derek McGowan
3581b982f7 Move plugin to daemon/pkg/plugin
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-27 14:26:33 -07:00
Derek McGowan
1c700c876f Move plugin/v2 to daemon/pkg/plugin/v2
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-27 14:26:17 -07:00
Derek McGowan
f5ceed8719 Move plugin/executor/containerd to daemon/internal/plugin/executor/containerd
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-27 14:26:01 -07:00
Derek McGowan
0b2582dc8f Move internal/metrics to daemon/internal/metrics
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-27 14:25:45 -07:00
Sebastiaan van Stijn
3ff85c7343 Merge pull request #50276 from thaJeztah/client_remove_getDockerOS
client: remove getDockerOS utility in favor of "Ostype" header
2025-06-27 19:48:24 +02:00
Sebastiaan van Stijn
8a63d1daa3 Merge pull request #50004 from dmcgowan/move-api-server-packages
Move api server packages to daemon
2025-06-27 19:42:24 +02:00
Sebastiaan van Stijn
b59ba9460c Merge pull request #50256 from thaJeztah/client_auth_RequestAuthConfig
client: omit empty auth headers and use registry.RequestAuthConfig
2025-06-27 19:13:34 +02:00
Derek McGowan
87238882e0 Move api/server to daemon/server
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-27 09:18:20 -07:00
Derek McGowan
3a6e3f85c6 Move api/server/backend/build to daemon/build
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-27 09:18:05 -07:00
Derek McGowan
79f802d46a Move api/server/httputils to daemon/server/httputils
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-27 09:17:49 -07:00
Derek McGowan
c7a87f0dee Move api/server/httpstatus to daemon/server/httpstatus
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-27 09:17:33 -07:00
Derek McGowan
d64bd2cceb Move api/server/middleware to daemon/server/middleware
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-27 09:17:18 -07:00
Derek McGowan
72a020fcd8 Move api/server/router to daemon/server/router
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-27 09:17:02 -07:00
Derek McGowan
f293628f55 Move api/server/router/volume to daemon/server/router/volume
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-27 09:16:46 -07:00
Derek McGowan
15c8007064 Move api/server/router/system to daemon/server/router/system
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-27 09:16:31 -07:00
Derek McGowan
45172bbf23 Move api/server/router/swarm to daemon/server/router/swarm
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-27 09:16:15 -07:00
Derek McGowan
f6ba5a5241 Move api/server/router/session to daemon/server/router/session
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-27 09:16:00 -07:00
Derek McGowan
3eb5fe0277 Move api/server/router/plugin to daemon/server/router/plugin
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-27 09:15:44 -07:00
Derek McGowan
baa58ddc6a Move api/server/router/network to daemon/server/router/network
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-27 09:15:28 -07:00
Derek McGowan
0cbb4ac8e6 Move api/server/router/image to daemon/server/router/image
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-27 09:15:13 -07:00
Derek McGowan
a063389af7 Move api/server/router/grpc to daemon/server/router/grpc
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-27 09:14:58 -07:00
Derek McGowan
9ff489863c Move api/server/router/distribution to daemon/server/router/distribution
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-27 09:14:42 -07:00
Derek McGowan
ced7798ed8 Move api/server/router/debug to daemon/server/router/debug
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-27 09:14:26 -07:00
Derek McGowan
3a9db5fbd6 Move api/server/router/container to daemon/server/router/container
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-27 09:14:11 -07:00
Sebastiaan van Stijn
fcf3ff1b2f client: remove getDockerOS utility in favor of "Ostype" header
This utility was added in 83b5729f64 to
replace httputils.ParseServerHeader, which was added to print a warning
on Windows in 126529c6d0. At the time, the
only available option to detect the daemon's OS was to parse the `Server`
header, which contained the version of Docker as well as the OS.

However, 7199522ea2 introduced an `OSType`
("Ostype") header that's included on all responses, and a later commit
e9dac5ef5e changed that to also be included
when producing an error for unsupported API versions.

Note that the casing in the midddleware was changed from `OSType` to
`Ostype` (normalized form) in 76a5ca1d4d,
but headers are case-insensitive, and `header.Get()` should handle either
case in the response.

In short; every API response contains an "Ostype" header, which already
contains the OS ("windows" or "linux") that doesn't require any parsing,
so let's put that header to use.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-27 18:14:04 +02:00
Derek McGowan
d6136b660f Move api/server/router/checkpoint to daemon/server/router/checkpoint
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-27 09:13:55 -07:00
Derek McGowan
31b6886eb1 Move api/server/router/build to daemon/server/router/build
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-27 09:13:40 -07:00
Sebastiaan van Stijn
d3dca6e008 Merge pull request #50273 from dmcgowan/api-network-errors
Replace multierror function in network api types
2025-06-27 17:30:06 +02:00
Sebastiaan van Stijn
68ffacf85f Merge pull request #50271 from dmcgowan/client-testutil-dependency
Remove dependency on testutil from client
2025-06-27 13:35:29 +02:00
Sebastiaan van Stijn
fe80dceaa1 Merge pull request #50270 from dmcgowan/client-hijack-test
Remove dependency on httputil for client hijack test
2025-06-27 13:33:01 +02:00
Sebastiaan van Stijn
1c0d381f4e client: client.tryImagePush: accept registry.RequestAuthConfig
Directly accept a privilege-func, and set the auth-header optionally.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-27 13:12:50 +02:00
Sebastiaan van Stijn
ca0afe91b9 client: client.tryImageCreate: accept registry.RequestAuthConfig
Directly accept a privilege-func, and set the auth-header optionally.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-27 13:12:50 +02:00
Sebastiaan van Stijn
79b4e18883 client: add staticAuth utility
Add a small utility to create a "RequestAuthConfig" from
a static value.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-27 13:12:50 +02:00
Sebastiaan van Stijn
871543a8c5 client: Client.ServiceUpdate: don't manually construct header value
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-27 13:12:48 +02:00
Derek McGowan
a824db247f Add progress aux emitter to build backend
Avoid importing structs from the root package in favor of defining an
interface for the functions which are called.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-26 18:20:23 -07:00
Derek McGowan
374fa24a53 Add multierror function to api network
Preserve error formatting without importing internal package from the
root package.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-26 18:07:14 -07:00
Derek McGowan
0964fa01ba Remove dependency on testutil from client
To separate the client into a separate module, it cannot depend on
testutil under the root module.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-26 15:33:40 -07:00
Derek McGowan
58404b0c28 Remove dependency on httputil for client hijack test
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-26 14:16:39 -07:00
Sebastiaan van Stijn
a6be38a4e2 Merge pull request #50269 from crazy-max/fix-winres
cmd: fix winresources and move them out cli package
2025-06-26 20:20:57 +02:00
Sebastiaan van Stijn
00408909c5 Merge pull request #50262 from mmorel-35/revive-0
fix: easiest revive rules
2025-06-26 17:04:44 +02:00
CrazyMax
e7289e7e02 hack: check windows resources are set in the binary
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2025-06-26 17:03:32 +02:00
Kevin Alvarez
44623fb856 cmd: use dockerfile to generate win event messages
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2025-06-26 17:03:32 +02:00
Kevin Alvarez
0ea20c9f72 cmd: fix winresources and move them out cli package
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2025-06-26 15:56:23 +02:00
Matthieu MOREL
6b8afec95b fix redefines-builtin-id from revive
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-06-26 12:07:45 +00:00
Matthieu MOREL
90ab64cbda fix increment-decrement from revive
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-06-26 12:07:38 +00:00
Matthieu MOREL
381d9d0723 fix use-errors-new from revive
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-06-26 12:07:38 +00:00
Matthieu MOREL
f0136d1dba fix superfluous-else from revive
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-06-26 12:07:38 +00:00
Matthieu MOREL
369c8f828e fix var-declaration from revive
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-06-26 12:07:24 +00:00
Paweł Gronowski
ee49437e38 Merge pull request #50010 from dmcgowan/dockerd-command-daemon
Split dockerd main command to package under daemon
2025-06-26 10:19:06 +00:00
Sebastiaan van Stijn
1daa58a4ca Merge pull request #50267 from vvoland/gha-tags-fixcomment
gha/bin-image: update tags comment
2025-06-25 20:31:37 +02:00
Paweł Gronowski
d72f219a11 gha/bin-image: update tags comment
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-06-25 16:50:44 +02:00
Sebastiaan van Stijn
85aa504a8f Merge pull request #50263 from vvoland/gha-tags
gha/bin-image: add major and minor version image tags
2025-06-25 14:47:27 +02:00
Sebastiaan van Stijn
82ca3ccaf3 Merge pull request #50265 from austinvazquez/update-maintainer-info
Update maintainer info for austinvazquez
2025-06-25 08:19:12 +02:00
Matthieu MOREL
b40fe5cb8b pluginrpc-gen: align generator with generated
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-06-25 07:51:37 +02:00
Austin Vazquez
f8fcc20c3b Update maintainer info for austinvazquez
Signed-off-by: Austin Vazquez <austin.vazquez.dev@gmail.com>
2025-06-24 15:09:37 -07:00
Paweł Gronowski
38b98bcf68 gha/bin-image: add major and minor version image tags
Adding image tags that follow the semver major and minor versions (e.g., `28`
and `28.3`) for the moby-bin images.

This makes it easier for users to reference the latest build within a
major or minor version series without having to know the exact
minor/patch version.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-06-24 23:30:58 +02:00
Cory Snider
057e35dd65 libnetwork/d/overlay: ref-count encryption params
The IPsec encryption parameters (Security Association Database and
Security Policy Database entries) for a particular overlay network peer
(VTEP) are shared global state as they have to be programmed into the
root network namespace. The same parameters are used when encrypting
VXLAN traffic to a particular VTEP for all overlay networks. Deleting
the entries for a VTEP will break encryption to that VTEP across all
encrypted overlay networks, therefore the decision of when to delete the
entries must take the state of all overlay networks into account.
Unfortunately this is not the case.

The overlay driver uses local per-network state to decide when to
program and delete the parameters for a VTEP. In practice, the
parameters for all VTEPs participating in an encrypted overlay network
are deleted when the network is deleted. Encryption to that VTEP over
all other active encrypted overlay networks would be broken until some
other incidental peerDB event triggered a re-programming of the
parameters for that VTEP.

Change the setupEncryption and removeEncryption functions to be
reference-counted. The removeEncryption function needs to be called the
same number of times as addEncryption before the parameters are deleted
from the kernel.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-06-24 13:30:13 -04:00
Cory Snider
1c2b744ca2 libnetwork/d/overlay: properly model peer db
The overlay driver assumes that the peer table in NetworkDB will always
converge to a 1:1:1 mapping from peer endpoint IP address to MAC address
to VTEP. While this currently holds true in practice most of the time,
it is not an invariant and there are ways that users can violate this
assumption.

The driver detects whether peer entries conflict with each other by
matching up (IP, MAC) tuples. In the common case this works out fine as
the MAC address for an endpoint is generally derived from the assigned
IP address. If an IP address gets reassigned to a container on another
node the MAC address will follow, so the driver's conflict resolution
logic will behave as intended. However users may explicitly configure
the MAC address for a container's network endpoints. If an IP address
gets reassigned from a container with an auto-generated MAC address to a
container with a manually-configured MAC, or vice versa, the driver
would not detect the conflict as the (IP, MAC) tuples won't match up. It
would attempt to program the kernel's neighbor table with two
conflicting MAC addresses for one IP, which will fail. And since it
does not realize that there is a conflict, the driver won't reprogram
the kernel from the remaining entry when the other entry is deleted.

The assumption that only one IP address may resolve to a given MAC
address is violated if multiple IP addresses are assigned to an
endpoint. This rarely comes up in practice today as the overlay driver
only supports IPv4 single-stack connectivity for endpoints. If multiple
distinct peer entries exist with the same MAC address, the driver will
delete the MAC->VTEP mapping from the kernel's forwarding database when
any entry is deleted, even if other entries remain active. This
limitation is one of the biggest obstacles in the way of supporting IPv6
and dual-stack connectivity for endpoints attached to overlay networks.

Modify the peer db logic to correctly handle the cases where peer
entries have non-unique MAC or VTEP values. Treat any set of entries
with non-unique IP addresses as a conflict, irrespective of the entries'
MAC addresses. Maintain a reference count of forwarding database entries
and only delete the MAC->VTEP mapping from the kernel when there are no
longer any neighbor entries which resolve to that MAC.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-06-24 13:30:11 -04:00
Cory Snider
59437f56f9 libnetwork/d/overlay: refactor peer db impl
The peer db implementation is more complex than it needs to be.
Notably, the peerCRUD / peerCRUDOp function split is a vestige of its
evolution from a worker goroutine receiving commands over a channel.

Refactor the peer db operations to be easier to read, understand and
modify. Factor the kernel-programming operations out into dedicated
addNeighbor and deleteNeighbor functions. Inline the rest of the
peerCRUDOp functions into their respective peerCRUD wrappers.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-06-24 13:28:26 -04:00
Sebastiaan van Stijn
ed1406cb93 Merge pull request #50236 from corhere/libn/overlay-really-delete-neigh
libn/d/overlay: delete FDB entry from AF_BRIDGE
2025-06-24 18:13:54 +02:00
Sebastiaan van Stijn
4bcb850902 Merge pull request #50257 from thaJeztah/TestCreateByImageID_minor_nits
integration/container: TestCreateByImageID: minor improvements
2025-06-24 13:14:40 +02:00
Derek McGowan
33139da522 Split part of dockerd main to command under daemon
Allows using daemon/internal packages when creating dockerd

Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-23 14:45:03 -07:00
Derek McGowan
98047c5190 Move cmd/dockerd/trap to daemon/command/trap
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-23 14:45:03 -07:00
Derek McGowan
ea11b5f3fe Move cmd/dockerd/debug to daemon/command/debug
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-23 14:45:02 -07:00
Albin Kerouanton
a41225dcfd Merge pull request #50091 from corhere/libn/overlay-refactor-checkencryption
libnetwork/d/overlay: simplify the encryption logic
2025-06-23 21:32:02 +02:00
Sebastiaan van Stijn
6edb15c5fc Merge pull request #50255 from crazy-max/update-govulncheck
dockerfile: update govulncheck to v1.1.4
2025-06-23 13:04:31 +02:00
Sebastiaan van Stijn
53475e1adf integration/container: TestCreateByImageID: minor improvements
- Assert that we're not using empty IDs
- stringid.TruncateID already truncates algorithm, so we can just feed
  it the full id
- Fail early on error, and skip asserting the `resp.ID` to reduce some
  noise;

    === FAIL: github.com/docker/docker/integration/container TestCreateByImageID/image_short-ID (60.33s)
        create_test.go:134: assertion failed: resp.ID is ""
        create_test.go:135: assertion failed: error is not nil: error during connect: Post "http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.48/containers/create": EOF

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-23 12:19:44 +02:00
CrazyMax
fcf666f9b0 dockerfile: update govulncheck to v1.1.4
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2025-06-23 10:02:38 +02:00
Paweł Gronowski
4ac341638f Merge pull request #50246 from thaJeztah/simplify_headers
client: Client.addHeaders: remove special handling for api < 1.25
2025-06-20 18:39:39 +00:00
Paweł Gronowski
f8bd49525b Merge pull request #50224 from thaJeztah/faster_trim
daemon: LogContainerEventWithAttributes: minor optimisation
2025-06-20 16:31:32 +00:00
Paweł Gronowski
8d39ec90ac Merge pull request #50245 from vvoland/cut-api
docs: cut api docs for v1.51
2025-06-20 16:17:05 +00:00
Sebastiaan van Stijn
8c067c5223 client: Client.addHeaders: remove special handling for api < 1.25
Commit e98e4a7111 introduced functionality
to hide experimental commands, and hide commands based on API version
negotiation. Before that commit, the user-agent header was used to detect
version-mismatches between the daemon and client based on their binary
version;
3975d648b7/api/server/middleware/user_agent.go (L32-L44)

Because of the above, a check was added to prevent custom headers from
modifying the User-Agent, but given that the user-agent header changed
formatting, and api < 1.25 is long deprecated, it's not very meaningful
to add this check, so let's remove it.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-20 18:10:04 +02:00
Paweł Gronowski
ef50844a0b docs: cut api docs for v1.51
Used by the upcoming 28.3.0 release

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-06-20 18:00:53 +02:00
Paweł Gronowski
dc14a75b24 Merge pull request #50177 from thaJeztah/tweak_timeouts
gha: lower timeouts on "build" and "merge" steps
2025-06-20 14:28:21 +00:00
Sebastiaan van Stijn
6025adfbef Merge pull request #50226 from robmry/driver_api_optional_extconn
libnet: split ProgramExternalConnectivity/RevokeExternalConnectivity out of driverapi
2025-06-20 13:31:18 +02:00
Sebastiaan van Stijn
381699364e Merge pull request #50238 from crazy-max/buildkit-0.23.1
vendor: update buildkit to v0.23.1
2025-06-20 13:23:17 +02:00
Sebastiaan van Stijn
9a465b6ab1 Merge pull request #50231 from thaJeztah/update_cgroups
vendor: github.com/opencontainers/cgroups v0.0.3
2025-06-20 13:00:12 +02:00
Sebastiaan van Stijn
775f50e821 Merge pull request #50233 from thaJeztah/validate_mirrors
daemon/config: Validate: add missing validation for registry mirrors and improve errors
2025-06-20 12:50:48 +02:00
Sebastiaan van Stijn
a0f36cc926 Merge pull request #50220 from thaJeztah/fix_event_ordering
daemon: containerStop: fix ordering of "stop" and "die" events
2025-06-20 12:44:17 +02:00
CrazyMax
5a02e7f4e3 vendor: update buildkit to v0.23.1
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2025-06-20 11:38:08 +02:00
Paweł Gronowski
e124ab621c Merge pull request #50237 from dmcgowan/update-containerd-2.1.3
Update containerd to v2.1.3
2025-06-20 09:27:26 +00:00
Derek McGowan
b466c35da1 Update containerd to v2.1.3
Fixes various issues with pulling from registries

Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-19 15:57:03 -07:00
Cory Snider
7a12bbe5d3 libn/d/overlay: delete FDB entry from AF_BRIDGE
Starting with commit 0d6e7cd983
DeleteNeighbor() needs to be called with the same options as the
AddNeighbor() call that created the neighbor entry. The calls in peerdb
were modified incorrectly, resulting in the deletes failing and leaking
neighbor entries. Fix up the DeleteNeighbor calls so that the FDB entry
is deleted from the FDB instead of the neighbor table, and the neighbor
is deleted from the neighbor table instead of the FDB.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-06-19 17:24:16 -04:00
Sebastiaan van Stijn
1d8545d60c daemon/config: Validate: add missing validation for registry mirrors
Validation of registry mirrors was performed during daemon startup,
but after the config-file was validated. As a result, the `--validate`
option would incorrectly print that the configuration was valid, but
the daemon would fail to start;

    echo '{"registry-mirrors":["example.com"]}' > my-config.json
    dockerd --config-file ./my-config.json --validate
    configuration OK

    dockerd --config-file ./my-config.json
    # ...
    failed to start daemon: invalid mirror: no scheme specified for "example.com": must use either 'https://' or 'http://'

With this patch applied, validation is also performed as part of the
daemon config validation;

    echo '{"registry-mirrors":["example.com"]}' > my-config.json
    dockerd --config-file ./my-config.json --validate
    unable to configure the Docker daemon with file ./my-config.json: merged configuration validation from file and command line flags failed: invalid mirror: no scheme specified for "example.com": must use either 'https://' or 'http://'

    # fix the invalid config
    echo '{"registry-mirrors":["https://example.com"]}' > my-config.json
    dockerd --config-file ./my-config.json --validate
    configuration OK

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-19 14:22:11 +02:00
Sebastiaan van Stijn
307c18598d registry: ValidateMirror: improve validation for missing schemes
Before this patch, a missing scheme would sometimes produce a confusing
error message. If no scheme was specified at all, an empty "" would be
included in the message;

    echo '{"registry-mirrors":["example.com"]}' > my-config.json
    dockerd --config-file ./my-config.json
    # ...
    failed to start daemon: invalid mirror: unsupported scheme "" in "example.com"

If a scheme was missing, but a port was included, the hostname would be
printed as the scheme;

    echo '{"registry-mirrors":["example.com:8080"]}' > my-config.json
    dockerd --config-file ./my-config.json
    # ...
    failed to start daemon: invalid mirror: unsupported scheme "example.com" in "example.com:8080"

With this patch applied, the error messages are slightly more user-friendly;

    echo '{"registry-mirrors":["example.com"]}' > my-config.json
    dockerd --config-file ./my-config.json
    # ...
    failed to start daemon: invalid mirror: no scheme specified for "example.com": must use either 'https://' or 'http://'

    echo '{"registry-mirrors":["example.com:8080"]}' > my-config.json
    dockerd --config-file ./my-config.json
    # ...
    failed to start daemon: invalid mirror: no scheme specified for "example.com:8080": must use either 'https://' or 'http://'

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-19 14:21:58 +02:00
Sebastiaan van Stijn
a90da2edc3 vendor: github.com/opencontainers/cgroups v0.0.3
- ConvertCPUSharesToCgroupV2Value: improve
- Add .github/dependabot.yml
- Remove annotations from Resources (fixes a regression introduced in v0.0.2)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-19 12:38:04 +02:00
Akihiro Suda
bd965df6ae Merge pull request #50207 from thaJeztah/bump_alpine
gha: dco: bump alpine to 3.22
2025-06-19 18:26:10 +09:00
Sebastiaan van Stijn
bb858f3b27 Merge pull request #50229 from corhere/libn/fix-networkdb-dns-update-delete
libnetwork: fix flaky Swarm service DNS
2025-06-19 10:29:43 +02:00
Cory Snider
a7f01d238e libnetwork: fix flaky Swarm service DNS
When libnetwork receives a watch event for a driver table entry from
NetworkDB it passes the event along to the interested driver. This code
contains a subtle bug: update events from NetworkDB are passed along to
the driver as Delete events! This bug was lying dormant as driver-table
entries can only be added by the driver, not updated. Now that NetworkDB
broadcasts an UpdateEvent to watchers if the entry is already known to
the local NetworkDB, irrespective of whether the event received from the
remote peer was a CREATE or UPDATE event, the bug is causing problems.
Whenever a remote node replaces an entry in the overlay_peer_table but
the intermediate delete state was not received by the local node, the
new CREATE event would be translated to an UpdateEvent by NetworkDB and
subsequently handled by the overlay driver as if the entry was deleted!

Bubble table UPDATE events up to the network driver as Update events.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-06-18 17:58:08 -04:00
Sebastiaan van Stijn
062082ec9b daemon: containerStop: fix ordering of "stop" and "die" events
Commit 8e6cd44ce4 added synchronisation to
wait for the container's status to be updated in memory. However, since
952902efbc, a defer was used to produce
the container's "stop" event.

As a result of the sychronisation that was added, the "die" event would
now be produced before the "stop" event.

This patch moves the locking inside the defer to restore the previous
behavior.

Unfortunately the order of events is still not guaranteed, because events
are emited from multiple goroutines that don't have synchronisation between
them; this is something to look at for follow ups. This patch keeps the status
quo and should preserve the old behavior, which was "more" correct in most
cases.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-18 20:42:52 +02:00
Cory Snider
de24c536b0 Merge pull request #50193 from corhere/libn/networkdb-fix-crudtable-flakes-harder
libnetwork/networkdb: prioritize local table broadcasts over event rebroadcasts
2025-06-18 13:34:57 -04:00
Rob Murray
bf002e51a0 Split [Program|Revoke]ExternalConnectivity out of libnet driverapi
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-06-18 17:38:35 +01:00
Rob Murray
4ccbca1efe Add TestRoutedNonGateway
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-06-18 17:21:57 +01:00
Sebastiaan van Stijn
0c56619d79 Merge pull request #50218 from thaJeztah/deprecate_execconfig_detach
api/types/container: deprecate ExecOptions.Detach
2025-06-18 17:52:39 +02:00
Sebastiaan van Stijn
d85513e1a3 daemon: LogContainerEventWithAttributes: minor optimisation
As we're only expecting a single `/` prefix to be trimmed from the
container name, it's better to use `TrimPrefix` than `TrimLeft`, as
`TrimPrefix` takes a cut-set to remove any character in the set.

Benchmarking both;

    BenchmarkTrimLeft-10      535364544    2.204  ns/op    0 B/op    0 allocs/op
    BenchmarkTrimPrefix-10   1000000000    0.3148 ns/op    0 B/op    0 allocs/op

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-18 13:14:43 +02:00
Sebastiaan van Stijn
d31f67f4ea Merge pull request #50209 from thaJeztah/pkg_idtools_deprecate
pkg/idtools: deprecate IdentityMapping, Identity.Chown
2025-06-18 12:23:35 +02:00
Rob Murray
b387526fce Merge pull request #49981 from robmry/drop_inc_rules
Drop DOCKER-ISOLATION rules
2025-06-17 20:22:00 +01:00
Sebastiaan van Stijn
b0d6155e7c Merge pull request #50180 from robmry/test_nftabler
Add TestNftabler
2025-06-17 21:11:30 +02:00
Sebastiaan van Stijn
5b9fa6c07a Merge pull request #50222 from jsternberg/buildkit-update
vendor: github.com/moby/buildkit v0.23.0
2025-06-17 20:36:11 +02:00
Rob Murray
ec185e57cf Test Nftabler params
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-06-17 18:28:20 +01:00
Jonathan A. Sternberg
e43968d7ed vendor: github.com/moby/buildkit v0.23.0
Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com>
2025-06-17 12:17:47 -05:00
Sebastiaan van Stijn
0c182d4d57 api/types/container: deprecate ExecOptions.Detach
This field was added in 5130fe5d38, which
added it for use as intermediate struct when parsing CLI flags (through
`runconfig.ParseExec`) in c786a8ee5e.

Commit 9d9dff3d0d rewrote the CLI to use
Cobra, and as part of this introduced a separate `execOptions` type in
`api/client/container`.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-17 12:38:33 +02:00
Paweł Gronowski
9b4f68d64c Merge pull request #50214 from tonistiigi/update-buildkit-v0.23.0-rc2
vendor: update buildkit to v0.13.0-rc2
2025-06-17 09:57:55 +00:00
Paweł Gronowski
a9c0420463 Merge pull request #50119 from PowerPixel/50118-add-stdcopy-containerexecattach
docs(client/ContainerExecAttach): add a mention to stdcopy.StdCopy
2025-06-17 09:39:19 +00:00
Sebastiaan van Stijn
dde7a4c22f Merge pull request #50212 from corhere/vendor-tagged-swarmkit-v2
vendor: github.com/moby/swarmkit/v2 v2.0.0
2025-06-17 11:22:51 +02:00
Rob Murray
126f99d776 Add a way to undo nftables.Enable(), for unit tests
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-06-17 09:52:48 +01:00
Rob Murray
30aa9a891d Merge pull request #50104 from robmry/outline_nftabler
nftables: add initial/outline nftabler
2025-06-17 09:52:00 +01:00
Tonis Tiigi
1289519b03 vendor: update buildkit to v0.13.0-rc2
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2025-06-16 18:13:02 -07:00
Cory Snider
c3ac979ecf vendor: github.com/moby/swarmkit/v2 v2.0.0
Use the tagged version instead of the v2.0.0-20250613170222-a45be3cac15c
pseudo-version. The referenced commit has not changed.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-06-16 12:54:12 -04:00
Medhy DOHOU
4891396da6 docs(client/ContainerExecAttach): add a mention to stdcopy.StdCopy
Add a mention to stdcopy.StdCopy to the documentation, as the stream returned in the HijackedResponse is multiplexed when tty is disabled.

Signed-off-by: Medhy DOHOU <52136144+PowerPixel@users.noreply.github.com>
2025-06-16 16:53:02 +00:00
Sebastiaan van Stijn
cab4ac834e Merge pull request #50202 from corhere/fix-swarmkit-3200
vendor: github.com/moby/swarmkit/v2 v2.0.0-20250613170222-a45be3cac15c
2025-06-16 17:48:11 +02:00
Sebastiaan van Stijn
b7ef527bdc pkg/idtools: deprecate IdentityMapping, Identity.Chown
The IdentityMapping and Identity types are still used internally, but
should be considered transitional.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-16 17:38:40 +02:00
Sebastiaan van Stijn
66e9cd97f2 remove deprecated pkg/archive, pkg/chrootarchive
These packages were deprecated in 57a042b77c
(v28.1.0), and moved to a separate module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-16 16:41:06 +02:00
Sebastiaan van Stijn
d06c22f27d remove deprecated pkg/reexec
This package was deprecated in 4f5ec9994c
(v28.0.0), and moved to a separate module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-16 16:30:40 +02:00
Sebastiaan van Stijn
98015c21ec remove deprecated pkg/atomicwriter
The atomicwriter utilities were moved to a separate package in commit
7864454792 (v28.0.0), which in its turn was
moved to a separate module in 6422ff2804
(v28.1.0).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-16 16:28:40 +02:00
Sebastiaan van Stijn
cf91441a1b pkg/ioutils: remove deprecated atomicwriter functions
The atomicwriter utilities were moved to a separate package in commit
7864454792 (v28.0.0), which in its turn was
moved to a separate module in 6422ff2804
(v28.1.0).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-16 16:27:54 +02:00
Sebastiaan van Stijn
1f0e9077e4 remove deprecated pkg/parsers
- `ParseKeyValueOpt` was deprecated in 5b18a7914c
  and moved to the graphdriver package.
- `ParseUintListMaximum` and `ParseUintList` were deprecated in commit
  064cdf475c after they were moved internal
  to pkg/sysinfo in 2282279180.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-16 16:21:22 +02:00
Rob Murray
c66abe486b nftabler: add mirrored WSL2 loopback0 workaround
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-06-16 15:19:47 +01:00
Rob Murray
d31956b2f7 Add an outline nftabler
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-06-16 15:19:45 +01:00
Sebastiaan van Stijn
04618dfc0b remove deprecated pkg/platform
This package was deprecated in b034dc41a2,
which moved it internal. That commit was part of v28.0.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-16 16:14:38 +02:00
Sebastiaan van Stijn
f1e93a1770 pkg/system: remove deprecated MkdirAll
This was deprecated in 4472e9b7f8, which
was part of docker v28.0.0, and to be removed in the next major
release.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-16 16:10:47 +02:00
Sebastiaan van Stijn
ce31bf3f0b gha: dco: bump alpine to 3.22
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-16 16:03:17 +02:00
Rob Murray
1ad9599da7 Drop DOCKER-ISOLATION rules
The Inter-Network Communication rules in the iptables chains
DOCKER-ISOLATION-STAGE-1 / DOCKER-ISOLATION-STAGE-2 (which are
called from filter-FORWARD) currently:
- Block access from containers in one bridge network, to ports
  published to host addresses by containers in other bridge
  networks, when the userland-proxy is disabled.
  - But, that access is allowed when the proxy is enabled.
- Block access to all ports on container addresses in gateway
  mode "nat-unprotected" networks.
  - But, those ports can be accessed from anywhere else, including
    other hosts. Just not other bridge networks.
- Allow access from containers in "nat" bridge networks to published
  ports on container addresses in "routed" networks. But, to do that,
  extra INC rules are added for the routed network.

The INC rules are no longer needed to block access from containers
in one network to unpublished ports on container addresses in
other networks. Direct routing to containers in NAT networks is
blocked by the "raw-PREROUTING" rules that block access from
untrusted interfaces (all interfaces apart from the network's
own bridge).

Drop these INC rules to resolve the inconsistencies listed above,
with this change:
- Published ports on host addresses can be accessed from containers
  in other networks (even without the userland-proxy).
- The rules for direct routing between bridge networks are the same
  as the rules for direct routing from outside the Docker host
  (allowed for gw modes "routed" and "nat-unprotected", disallowed
  for "nat").

Fewer rules, so it's simpler, and perhaps slightly faster.

Internal networks (with no access to networks outside the host)
are also implemented using rules in the DOCKER-ISOLATION chains.
This change moves those rules to a new chain, DOCKER-INTERNAL,
and drops the DOCKER-ISOLATION chains.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-06-16 14:54:31 +01:00
Cory Snider
2d60b8eacd vendor: github.com/moby/swarmkit/v2 v2.0.0-20250613170222-a45be3cac15c
- fix task scheduler infinite loop

full diff: 8c19597365...a45be3cac1

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-06-13 17:44:53 -04:00
Cory Snider
6ec6e0991a libnetwork/networkdb: prioritize local broadcasts
A network node is responsible for both broadcasting table events for
entries it owns and for rebroadcasting table events from other nodes it
has received. Table events to be broadcast are added to a single queue
per network, including events for rebroadcasting. As the memberlist
TransmitLimitedQueue is (to a first approximation) LIFO, a flood of
events from other nodes could delay the broadcasting of
locally-generated events indefinitely. Prioritize broadcasting local
events by splitting up the queues and only pulling from the rebroadcast
queue if there is free space in the gossip packet after draining the
local-broadcast queue.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-06-13 17:08:18 -04:00
Cory Snider
e9a7154909 libnetwork/networkdb: improve TestCRUDTableEntries
Log more details when assertions fail to provide a more complete picture
of what went wrong when TestCRUDTableEntries fails. Log the state of
each NetworkDB instance at various points in TestCRUDTableEntries to
provide an even more complete picture.

Increase the global logger verbosity in tests so warnings and debug logs
are printed to the test log.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-06-13 17:08:17 -04:00
Cory Snider
dbb0d88109 libn/networkdb: use distinct type for own networks
NetworkDB uses a muli-dimensional map of struct network to keep track of
network attachments for both remote nodes and the local node. Only a
subset of the struct fields are used for remote nodes' network
attachments. The tableBroadcasts pointer field in particular is
always initialized for network values representing local attachments
(read: nDB.networks[nDB.config.NodeID]) and always nil for remote
attachments. Consequently, unnecessary defensive nil-pointer checks are
peppered throughout the code despite the aforementioned invariant.

Enshrine the invariant that tableBroadcasts is initialized iff the
network attachment is for the local node in the type system. Pare down
struct network to only the fields needed for remote network attachments
and move the local-only fields into a new struct thisNodeNetwork. Elide
the unnecessary nil-checks.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-06-13 17:08:11 -04:00
Cory Snider
51f31826ee libnetwork/networkdb: don't clear queue on rejoin
When joining a network that was previously joined but not yet reaped,
NetworkDB replaces the network struct value with a zeroed-out one with
the entries count copied over. This is also the case when joining a
network that is currently joined! Consequently, joining a network has
the side effect of clearing the broadcast queue. If the queue is cleared
while messages are still pending broadcast, convergence may be delayed
until the next bulk sync cycle.

Make it an error to join a network twice without leaving. Retain the
existing broadcast queue when rejoining a network that has not yet been
reaped.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-06-13 17:08:09 -04:00
Cory Snider
30b27ab6ea libnetwork/networkdb: drop id field from network
The map key for nDB.networks is the network ID. The struct field is not
actually used anywhere in practice.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-06-13 16:25:19 -04:00
Sebastiaan van Stijn
9316396db0 gha: run windows 2025 on PRs, 2022 scheduled
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-12 21:19:03 +02:00
Sebastiaan van Stijn
6f484d0d4c gha: update to windows 2022 / 2025
The hosted Windows 2019 runners reach EOL on June 30;
https://github.com/actions/runner-images/issues/12045

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-12 21:19:00 +02:00
Sebastiaan van Stijn
0a30b98447 gha: lower timeouts on "build" and "merge" steps
We had some runs timeout after 120 minutes; expected duration is much
lower than that, so let's lower the timeout to make actions fail faster.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-12 10:21:43 +02:00
Sebastiaan van Stijn
accbfde61e client: use go-winio.DialPipe directly
The go-connections package implementation is only a shallow wrapper
around go-winio for named pipes; use the go-winio implementation
directly.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-02 14:38:47 +02:00
Cory Snider
df6b405796 libnetwork/d/overlay: drop initEncryption function
The (*driver).Join function does many things to set up overlay
networking. One of the first things it does is call
(*network).joinSandbox, which in turn calls (*driver).initSandboxPeerDB.
The initSandboxPeerDB function iterates through the peer db to add
entries to the VXLAN FDB, neighbor table and IPsec security association
database in the kernel for all known peers on the overlay network.

One of the last things the (*driver).Join function does is call
(*driver).initEncryption. The initEncryption function iterates through
the peer db to add entries to the IPsec security association database in
the kernel for all known peers on the overlay network. But the preceding
initSandboxPeerDB call already did that! The initEncryption function is
redundant and can safely be removed.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-05-29 14:13:13 -04:00
Cory Snider
713f887698 libnetwork/d/overlay: drop checkEncryption function
In addition to being three functions in a trenchcoat, the
checkEncryption function has a very subtle implementation which is
difficult to reason about. That is not a good property for security
relevant code to have.

Replace two of the three calls to checkEncryption with conditional calls
to setupEncryption and removeEncryption, lifting the conditional logic
which was hidden away in checkEncryption into the call sites to make it
easier to reason about the code. Replace the third call with a call to a
new initEncryption function.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-05-29 14:13:13 -04:00
Cory Snider
cb4e7b2f03 libnetwork/d/overlay: make setupEncryption a method
The setupEncryption and removeEncryption functions take several
parameters, but all call sites pass the same values for all the
parameters aside from remoteIP: values taken from fields of the driver
struct. Refactor these functions to be methods of the driver struct and
drop the redundant parameters.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-05-29 14:13:13 -04:00
Cory Snider
0d893252ac libnetwork/d/overlay: checkEncryption: drop isLocal param
Since it is not meaningful to add or remove encryption between the local
node and itself, the isLocal parameter is redundant. Setting up
encryption for all network peers is now invoked by calling

    checkEncryption(nid, netip.Addr{}, true)

Calling checkEncryption with isLocal=true, add=false is now more
explicitly a no-op. It always was effectively a no-op, but that was not
easy to spot by inspection. In the world with the isLocal flag,
calls to checkEncryption where isLocal=true and add=false would have rIP
set to d.advertiseAddr. In other words, it was a request to remove
encryption parameters between the local peer and itself if peerDB had no
remote-peer entries for the network. So either the call would do
nothing, or it would remove encryption parameters that aren't used for
anything. Now the equivalent call always does nothing.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-05-29 14:13:13 -04:00
Cory Snider
4b1c1236b9 libnetwork/d/overlay: peerdb: drop isLocal param
Drop the isLocal boolean parameters from the peerDB functions. Local
peers have vtep == netip.Addr{}.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-05-29 14:13:13 -04:00
Cory Snider
48e0b24ff7 libnetwork/d/overlay: elide vtep for local peers
The VTEP value for a peer in peerDB is only accurate for a remote peer.
The VTEP for a local peer would be the driver's advertise address, which
is not necessarily constant for the lifetime of the driver instance.
The VTEP values persisted in the peerDB entries for local peers could be
stale or missing if not kept in sync with the advertise address. And the
peerDB could get polluted with duplicate entries for local peers if the
advertise address was to change, as entries which differ only by VTEP
are considered distinct by SetMatrix. Persisting the advertise address
as the VTEP for local peers creates lots of problems that are not easy
to solve.

Stop persisting the VTEP for local peers in peerDB. Any code that needs
to know the VTEP for local peers can look that up from the source of
truth: the driver's advertise address. Use the lack of a VTEP in peerDB
entries to signify local peers, making the isLocal flag redundant.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-05-29 14:13:13 -04:00
Cory Snider
a9e2d6d06e libnetwork/d/overlay: filter local peers explicitly
The overlay driver's checkEncryption function configures the IPSec
parameters for the VXLAN tunnels to peer nodes. When called with
isLocal=true, it configures encryption for all peer nodes with at least
one peerDB entry. Since the local peers are also included in the peerDB,
it needs to filter those entries out. It does so by filtering out any
peer entries whose VTEP address is equal to the current local advertise
address. Trouble is, the local advertise address is not necessarily
constant. The driver tries to handle this case by calling
peerDBUpdateSelf() when the advertise address changes. This function
iterates through the peerDB and tries to update the VTEP address for all
local peer entries, but it does not actually do anything: it mutates a
temporary copy of the entry which is not persisted back into the peerDB.
(It used to be functional, but was broken when the peerDB was extended
to use SetMatrix.) So there may be cases where local peer entries are
not filtered out properly, resulting in spurious encryption parameters
being programmed into the kernel.

Filter out local peers when walking the peerDB by filtering on whether
the entry has the isLocal flag set. Remove the no-op code which attempts
to update local entries in the peerDB. No other code takes any interest
in the VTEP value for isLocal peer entries.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-05-29 14:13:13 -04:00
4566 changed files with 247342 additions and 137463 deletions

View File

@@ -2,5 +2,5 @@
# build artifacts
/bundles/
/cli/winresources/dockerd/winres.json
/cli/winresources/dockerd/*.syso
/cmd/dockerd/winresources/winres.json
/cmd/dockerd/*.syso

2
.gitattributes vendored
View File

@@ -1,3 +1 @@
Dockerfile* linguist-language=Dockerfile
vendor.mod linguist-language=Go-Module
vendor.sum linguist-language=Go-Checksums

159
.github/labeler.yml vendored Normal file
View File

@@ -0,0 +1,159 @@
module/client:
- changed-files:
- any-glob-to-any-file: 'client/**'
module/api:
- changed-files:
- any-glob-to-any-file: 'api/**'
area/daemon:
- changed-files:
- any-glob-to-any-file: 'daemon/**'
area/builder/buildkit:
- changed-files:
- any-glob-to-any-file:
- '**/*buildkit*'
- 'daemon/internal/builder-next/**'
area/builder/classic-builder:
- changed-files:
- any-glob-to-any-file:
- 'daemon/images/*_build*'
- 'daemon/builder/**'
area/builder:
- labels:
- any-glob-to-any-file:
- '**/*buildkit*'
- 'daemon/internal/builder-next/**'
- 'daemon/images/*_build*'
- 'daemon/builder/**'
area/networking:
- changed-files:
- any-glob-to-any-file:
- 'daemon/network*'
- 'daemon/network/**'
- 'api/types/network/**'
- 'integration/network/**'
- 'integration/networking/**'
area/volumes:
- changed-files:
- any-glob-to-any-file:
- 'daemon/volume/**'
- 'api/types/volume/**'
- 'integration/volume/**'
area/swarm:
- changed-files:
- any-glob-to-any-file:
- 'daemon/cluster/**'
- 'api/types/swarm/**'
area/images:
- changed-files:
- any-glob-to-any-file:
- 'daemon/images/**'
- 'api/types/image/**'
- 'integration/image/**'
area/logging:
- changed-files:
- any-glob-to-any-file:
- 'daemon/logger/**'
- '**/*log*'
area/security:
- changed-files:
- any-glob-to-any-file:
- '**/*seccomp*'
- '**/*apparmor*'
- '**/*selinux*'
area/security/apparmor:
- changed-files:
- any-glob-to-any-file:
- '**/*apparmor*'
- 'contrib/apparmor/**'
area/security/selinux:
- changed-files:
- any-glob-to-any-file:
- '**/*selinux*'
- 'contrib/selinux/**'
area/security/seccomp:
- changed-files:
- any-glob-to-any-file: '**/*seccomp*'
area/systemd:
- changed-files:
- any-glob-to-any-file:
- '**/*systemd*'
- 'contrib/init/systemd/**'
area/contrib:
- changed-files:
- any-glob-to-any-file: 'contrib/**'
area/packaging:
- changed-files:
- any-glob-to-any-file:
# files used in packaging
- 'contrib/dockerd-rootless.sh'
- 'contrib/dockerd-rootless-setuptool.sh'
- 'contrib/init/systemd/**'
containerd-integration:
- changed-files:
- any-glob-to-any-file: 'daemon/containerd/**'
area/rootless:
- changed-files:
- any-glob-to-any-file:
- '**/*rootless*'
- 'contrib/dockerd-rootless*'
area/testing:
- changed-files:
- any-glob-to-all-files:
- 'integration/**'
- 'integration-cli/**'
- '**/*_test.go'
- 'internal/test*'
- 'internal/testutil/**'
area/docs:
- changed-files:
- any-glob-to-any-file:
- 'api/docs/*.yaml'
- 'docs/**'
- '**/*.md'
- 'man/**'
area/dependencies:
- all:
- changed-files:
- any-glob-to-any-file:
- 'go.mod'
- 'go.sum'
- 'vendor/**'
- all-globs-to-all-files:
- '!client/**'
- '!api/**'
area/ci:
- changed-files:
- any-glob-to-any-file: '.github/**'
platform/windows:
- changed-files:
- any-glob-to-any-file:
- '**/*_windows.go'
- 'Dockerfile.windows'
impact/changelog:
- changed-files:
- any-glob-to-any-file: 'api/docs/CHANGELOG.md'

View File

@@ -16,7 +16,7 @@ on:
workflow_call:
env:
ALPINE_VERSION: "3.21"
ALPINE_VERSION: "3.22"
jobs:
run:

View File

@@ -1,45 +0,0 @@
# reusable workflow
name: .test-prepare
# TODO: hide reusable workflow from the UI. Tracked in https://github.com/community/community/discussions/12025
# Default to 'contents: read', which grants actions to read commits.
#
# If any permission is set, any permission not included in the list is
# implicitly set to "none".
#
# see https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions
permissions:
contents: read
on:
workflow_call:
outputs:
matrix:
description: Test matrix
value: ${{ jobs.run.outputs.matrix }}
jobs:
run:
runs-on: ubuntu-24.04
timeout-minutes: 120 # guardrails timeout for the whole job
outputs:
matrix: ${{ steps.set.outputs.matrix }}
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Create matrix
id: set
uses: actions/github-script@v7
with:
script: |
let matrix = ['graphdriver'];
if ("${{ contains(github.event.pull_request.labels.*.name, 'containerd-integration') || github.event_name != 'pull_request' }}" == "true") {
matrix.push('snapshotter');
}
await core.group(`Set matrix`, async () => {
core.info(`matrix: ${JSON.stringify(matrix)}`);
core.setOutput('matrix', JSON.stringify(matrix));
});

View File

@@ -16,7 +16,7 @@ on:
workflow_call:
env:
GO_VERSION: "1.24.4"
GO_VERSION: "1.25.3"
GOTESTLIST_VERSION: v0.3.1
TESTSTAT_VERSION: v0.1.25
SETUP_BUILDX_VERSION: edge
@@ -106,7 +106,7 @@ jobs:
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache-dependency-path: vendor.sum
cache: false
-
name: Download reports
uses: actions/download-artifact@v4

View File

@@ -21,13 +21,13 @@ on:
default: "graphdriver"
env:
GO_VERSION: "1.24.4"
GO_VERSION: "1.25.3"
GOTESTLIST_VERSION: v0.3.1
TESTSTAT_VERSION: v0.1.25
ITG_CLI_MATRIX_SIZE: 6
DOCKER_EXPERIMENTAL: 1
DOCKER_GRAPHDRIVER: ${{ inputs.storage == 'snapshotter' && 'overlayfs' || 'overlay2' }}
TEST_INTEGRATION_USE_SNAPSHOTTER: ${{ inputs.storage == 'snapshotter' && '1' || '' }}
TEST_INTEGRATION_USE_GRAPHDRIVER: ${{ inputs.storage == 'graphdriver' && '1' || '' }}
SETUP_BUILDX_VERSION: edge
SETUP_BUILDKIT_IMAGE: moby/buildkit:latest
@@ -144,7 +144,9 @@ jobs:
// { os: 'ubuntu-24.04', mode: 'rootless-systemd' }, // FIXME: https://github.com/moby/moby/issues/44084
];
if ("${{ inputs.storage }}" == "snapshotter") {
includes.push({ os: 'ubuntu-24.04', mode: 'firewalld' });
includes.push({ os: 'ubuntu-24.04', mode: 'iptables+firewalld' });
includes.push({ os: 'ubuntu-24.04', mode: 'nftables' });
includes.push({ os: 'ubuntu-24.04', mode: 'nftables+firewalld' });
}
await core.group(`Set matrix`, async () => {
core.info(`matrix: ${JSON.stringify(includes)}`);
@@ -190,6 +192,9 @@ jobs:
echo "FIREWALLD=true" >> $GITHUB_ENV
CACHE_DEV_SCOPE="${CACHE_DEV_SCOPE}firewalld"
fi
if [[ "${{ matrix.mode }}" == *"nftables"* ]]; then
echo "DOCKER_FIREWALL_BACKEND=nftables" >> $GITHUB_ENV
fi
echo "CACHE_DEV_SCOPE=${CACHE_DEV_SCOPE}" >> $GITHUB_ENV
-
name: Set up Docker Buildx
@@ -265,7 +270,7 @@ jobs:
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache-dependency-path: vendor.sum
cache: false
-
name: Download reports
uses: actions/download-artifact@v4
@@ -297,7 +302,7 @@ jobs:
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache-dependency-path: vendor.sum
cache: false
-
name: Install gotestlist
run:
@@ -328,19 +333,43 @@ jobs:
// 'include' with other matrix variables that aren't part of the
// include items.
// Moreover, since the goal is to run only relevant tests with
// firewalld enabled to minimize the number of CI jobs, we
// firewalld/nftables enabled to minimize the number of CI jobs, we
// statically define the list of test suites that we want to run.
if ("${{ inputs.storage }}" == "snapshotter") {
matrix.include.push({
'mode': 'firewalld',
'mode': 'iptables+firewalld',
'test': 'DockerCLINetworkSuite|DockerCLIPortSuite|DockerDaemonSuite'
});
matrix.include.push({
'mode': 'firewalld',
'mode': 'iptables+firewalld',
'test': 'DockerSwarmSuite'
});
matrix.include.push({
'mode': 'firewalld',
'mode': 'iptables+firewalld',
'test': 'DockerNetworkSuite'
});
matrix.include.push({
'mode': 'nftables',
'test': 'DockerCLINetworkSuite|DockerCLIPortSuite|DockerDaemonSuite'
});
matrix.include.push({
'mode': 'nftables',
'test': 'DockerSwarmSuite'
});
matrix.include.push({
'mode': 'nftables',
'test': 'DockerNetworkSuite'
});
matrix.include.push({
'mode': 'nftables+firewalld',
'test': 'DockerCLINetworkSuite|DockerCLIPortSuite|DockerDaemonSuite'
});
matrix.include.push({
'mode': 'nftables+firewalld',
'test': 'DockerSwarmSuite'
});
matrix.include.push({
'mode': 'nftables+firewalld',
'test': 'DockerNetworkSuite'
});
}
@@ -380,6 +409,9 @@ jobs:
echo "FIREWALLD=true" >> $GITHUB_ENV
CACHE_DEV_SCOPE="${CACHE_DEV_SCOPE}firewalld"
fi
if [[ "${{ matrix.mode }}" == *"nftables"* ]]; then
echo "DOCKER_FIREWALL_BACKEND=nftables" >> $GITHUB_ENV
fi
echo "CACHE_DEV_SCOPE=${CACHE_DEV_SCOPE}" >> $GITHUB_ENV
-
name: Set up Docker Buildx
@@ -437,7 +469,7 @@ jobs:
if: always()
uses: actions/upload-artifact@v4
with:
name: test-reports-integration-cli-${{ inputs.storage }}-${{ env.TESTREPORTS_NAME }}
name: test-reports-integration-cli-${{ inputs.storage }}-${{ matrix.mode }}-${{ env.TESTREPORTS_NAME }}
path: /tmp/reports/*
retention-days: 1
@@ -454,13 +486,13 @@ jobs:
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache-dependency-path: vendor.sum
cache: false
-
name: Download reports
uses: actions/download-artifact@v4
with:
path: /tmp/reports
pattern: test-reports-integration-cli-${{ inputs.storage }}-*
pattern: test-reports-integration-cli-${{ inputs.storage }}-${{ matrix.mode }}-*
merge-multiple: true
-
name: Install teststat

205
.github/workflows/.vm.yml vendored Normal file
View File

@@ -0,0 +1,205 @@
# reusable workflow
name: .vm
# TODO: hide reusable workflow from the UI. Tracked in https://github.com/community/community/discussions/12025
# Default to 'contents: read', which grants actions to read commits.
#
# If any permission is set, any permission not included in the list is
# implicitly set to "none".
#
# see https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions
permissions:
contents: read
on:
workflow_call:
inputs:
template:
required: true
type: string
env:
GO_VERSION: "1.25.3"
TESTSTAT_VERSION: v0.1.25
jobs:
integration:
runs-on: ubuntu-24.04
timeout-minutes: 60
continue-on-error: ${{ github.event_name != 'pull_request' }}
if: ${{ github.event_name != 'pull_request' || !contains(github.event.pull_request.labels.*.name, 'ci/validate-only') }}
strategy:
fail-fast: false
matrix:
mode:
- ""
- rootless
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Set up Lima
uses: lima-vm/lima-actions/setup@03b96d61959e83b2c737e44162c3088e81de0886 # v1.0.1
id: lima-actions-setup
-
name: Cache ~/.cache/lima
uses: actions/cache@v4
with:
path: ~/.cache/lima
key: lima-${{ steps.lima-actions-setup.outputs.version }}-${{ inputs.template }}
-
name: Start the guest VM
run: |
# --plain is set because the built-in containerd support conflicts with Docker
limactl start \
--name=default \
--cpus=4 \
--memory=12 \
--plain \
${{ inputs.template }}
-
name: Load kernel modules in the guest VM
run: |
set -eux -o pipefail
cat <<-EOF | lima sudo tee /etc/modules-load.d/docker.conf
br_netfilter
bridge
ip6_tables
ip6table_filter
ip6table_nat
ip_tables
ip_vs
iptable_filter
iptable_nat
nf_tables
overlay
tap
tun
veth
x_tables
xt_addrtype
xt_comment
xt_conntrack
xt_mark
xt_multiport
xt_nat
xt_tcpudp
EOF
lima sudo systemctl restart systemd-modules-load.service
-
name: Install dockerd in the guest VM
run: |
set -eux -o pipefail
lima sudo mkdir -p /etc/systemd/system/docker.socket.d
cat <<-EOF | lima sudo tee /etc/systemd/system/docker.socket.d/override.conf
[Socket]
SocketUser=$(whoami)
EOF
# TODO: use native packages for AlmaLinux: https://github.com/docker/packaging/pull/138
lima sudo dnf config-manager --add-repo=https://download.docker.com/linux/rhel/docker-ce.repo
lima sudo dnf -q -y install --nobest docker-ce make
lima sudo systemctl enable --now docker
lima docker info
-
name: Copy the current directory
run: |
set -eux -o pipefail
limactl cp -r . default:/tmp/docker
-
name: Test
run: |
set -eux -o pipefail
DOCKER_ROOTLESS=
DOCKER_GRAPHDRIVER=overlay2
if [[ "${{ matrix.mode }}" == *"rootless"* ]]; then
DOCKER_ROOTLESS=1
if lima grep -q "AlmaLinux release 8" /etc/system-release; then
# kernel prior to 5.11 needs fuse-overlayfs
DOCKER_GRAPHDRIVER=fuse-overlayfs
fi
fi
DOCKER_IGNORE_BR_NETFILTER_ERROR=
if lima grep -q "AlmaLinux release 8" /etc/system-release; then
# DOCKER_IGNORE_BR_NETFILTER_ERROR=1 is set because /proc/sys/net/bridge does not appear in
# a container when the kernel is older than 5.3.
# https://web.archive.org/web/20201123224428/github.com/lxc/lxd/issues/3306#issuecomment-502857864
DOCKER_IGNORE_BR_NETFILTER_ERROR=1
fi
# TODO: just propagate the env from the host: https://github.com/lima-vm/lima/issues/3430
# TODO: enable GHA cache?
LIMA_WORKDIR=/tmp/docker lima \
TEST_SKIP_INTEGRATION_CLI=1 \
TEST_INTEGRATION_USE_GRAPHDRIVER=1 \
DOCKER_ROOTLESS=${DOCKER_ROOTLESS} \
DOCKER_GRAPHDRIVER=${DOCKER_GRAPHDRIVER} \
DOCKER_IGNORE_BR_NETFILTER_ERROR=${DOCKER_IGNORE_BR_NETFILTER_ERROR} \
make test-integration
-
name: Prepare reports
if: always()
run: |
set -eux -o pipefail
limactl cp -v -r default:/tmp/docker/bundles . || true
reportsName="$(basename ${{ inputs.template }})"
if [ -n "${{ matrix.mode }}" ]; then
reportsName="$reportsName-${{ matrix.mode }}"
fi
reportsPath="/tmp/reports/$reportsName"
echo "TESTREPORTS_NAME=$reportsName" >> $GITHUB_ENV
mkdir -p bundles $reportsPath
find bundles -path '*/root/*overlay2' -prune -o -type f \( -name '*-report.json' -o -name '*.log' -o -name '*.out' -o -name '*.prof' -o -name '*-report.xml' \) -print | xargs sudo tar -czf /tmp/reports.tar.gz
tar -xzf /tmp/reports.tar.gz -C $reportsPath
sudo chown -R $(id -u):$(id -g) $reportsPath
tree -nh $reportsPath
-
name: Test daemon logs
if: always()
run: |
cat bundles/test-integration/docker.log
-
name: Upload reports
if: always()
uses: actions/upload-artifact@v4
with:
name: test-reports-integration-${{ env.TESTREPORTS_NAME }}
path: /tmp/reports/*
retention-days: 1
integration-report:
runs-on: ubuntu-24.04
timeout-minutes: 10
continue-on-error: ${{ github.event_name != 'pull_request' }}
if: always() && (github.event_name != 'pull_request' || !contains(github.event.pull_request.labels.*.name, 'ci/validate-only'))
needs:
- integration
steps:
-
name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache: false
-
name: Prepare reports
run: echo "TESTREPORTS_NAME=$(basename ${{ inputs.template }})*" >> $GITHUB_ENV
-
name: Download reports
uses: actions/download-artifact@v4
with:
path: /tmp/reports
pattern: test-reports-integration-${{ env.TESTREPORTS_NAME }}
merge-multiple: true
-
name: Install teststat
run: |
go install github.com/vearutop/teststat@${{ env.TESTSTAT_VERSION }}
-
name: Create summary
run: |
find /tmp/reports -type f -name '*-go-test-report.json' -exec teststat -markdown {} \+ >> $GITHUB_STEP_SUMMARY

View File

@@ -28,12 +28,12 @@ on:
default: false
env:
GO_VERSION: "1.24.4"
GO_VERSION: "1.25.3"
GOTESTLIST_VERSION: v0.3.1
TESTSTAT_VERSION: v0.1.25
WINDOWS_BASE_IMAGE: mcr.microsoft.com/windows/servercore
WINDOWS_BASE_TAG_2019: ltsc2019
WINDOWS_BASE_TAG_2022: ltsc2022
WINDOWS_BASE_TAG_2025: ltsc2025
TEST_IMAGE_NAME: moby:test
TEST_CTN_NAME: moby
DOCKER_BUILDKIT: 0
@@ -65,23 +65,11 @@ jobs:
run: |
New-Item -ItemType "directory" -Path "${{ github.workspace }}\go-build"
New-Item -ItemType "directory" -Path "${{ github.workspace }}\go\pkg\mod"
If ("${{ inputs.os }}" -eq "windows-2019") {
echo "WINDOWS_BASE_IMAGE_TAG=${{ env.WINDOWS_BASE_TAG_2019 }}" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
If ("${{ inputs.os }}" -eq "windows-2025") {
echo "WINDOWS_BASE_IMAGE_TAG=${{ env.WINDOWS_BASE_TAG_2025 }}" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
} ElseIf ("${{ inputs.os }}" -eq "windows-2022") {
echo "WINDOWS_BASE_IMAGE_TAG=${{ env.WINDOWS_BASE_TAG_2022 }}" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
}
-
name: Cache
uses: actions/cache@v4
with:
path: |
~\AppData\Local\go-build
~\go\pkg\mod
${{ github.workspace }}\go-build
${{ env.GOPATH }}\pkg\mod
key: ${{ inputs.os }}-${{ github.job }}-${{ hashFiles('**/vendor.sum') }}
restore-keys: |
${{ inputs.os }}-${{ github.job }}-
-
name: Docker info
run: |
@@ -92,15 +80,12 @@ jobs:
& docker build `
--build-arg WINDOWS_BASE_IMAGE `
--build-arg WINDOWS_BASE_IMAGE_TAG `
--build-arg GO_VERSION `
-t ${{ env.TEST_IMAGE_NAME }} `
-f Dockerfile.windows .
-
name: Build binaries
run: |
& docker run --name ${{ env.TEST_CTN_NAME }} -e "DOCKER_GITCOMMIT=${{ github.sha }}" `
-v "${{ github.workspace }}\go-build:C:\Users\ContainerAdministrator\AppData\Local\go-build" `
-v "${{ github.workspace }}\go\pkg\mod:C:\gopath\pkg\mod" `
${{ env.TEST_IMAGE_NAME }} hack\make.ps1 -Daemon -Client
-
name: Copy artifacts
@@ -145,23 +130,11 @@ jobs:
New-Item -ItemType "directory" -Path "${{ github.workspace }}\go-build"
New-Item -ItemType "directory" -Path "${{ github.workspace }}\go\pkg\mod"
New-Item -ItemType "directory" -Path "bundles"
If ("${{ inputs.os }}" -eq "windows-2019") {
echo "WINDOWS_BASE_IMAGE_TAG=${{ env.WINDOWS_BASE_TAG_2019 }}" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
If ("${{ inputs.os }}" -eq "windows-2025") {
echo "WINDOWS_BASE_IMAGE_TAG=${{ env.WINDOWS_BASE_TAG_2025 }}" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
} ElseIf ("${{ inputs.os }}" -eq "windows-2022") {
echo "WINDOWS_BASE_IMAGE_TAG=${{ env.WINDOWS_BASE_TAG_2022 }}" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
}
-
name: Cache
uses: actions/cache@v4
with:
path: |
~\AppData\Local\go-build
~\go\pkg\mod
${{ github.workspace }}\go-build
${{ env.GOPATH }}\pkg\mod
key: ${{ inputs.os }}-${{ github.job }}-${{ hashFiles('**/vendor.sum') }}
restore-keys: |
${{ inputs.os }}-${{ github.job }}-
-
name: Docker info
run: |
@@ -172,15 +145,12 @@ jobs:
& docker build `
--build-arg WINDOWS_BASE_IMAGE `
--build-arg WINDOWS_BASE_IMAGE_TAG `
--build-arg GO_VERSION `
-t ${{ env.TEST_IMAGE_NAME }} `
-f Dockerfile.windows .
-
name: Test
run: |
& docker run --name ${{ env.TEST_CTN_NAME }} -e "DOCKER_GITCOMMIT=${{ github.sha }}" `
-v "${{ github.workspace }}\go-build:C:\Users\ContainerAdministrator\AppData\Local\go-build" `
-v "${{ github.workspace }}\go\pkg\mod:C:\gopath\pkg\mod" `
-v "${{ env.GOPATH }}\src\github.com\docker\docker\bundles:C:\gopath\src\github.com\docker\docker\bundles" `
${{ env.TEST_IMAGE_NAME }} hack\make.ps1 -TestUnit
-
@@ -214,7 +184,7 @@ jobs:
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache-dependency-path: vendor.sum
cache: false
-
name: Download artifacts
uses: actions/download-artifact@v4
@@ -244,7 +214,7 @@ jobs:
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache-dependency-path: vendor.sum
cache: false
-
name: Install gotestlist
run:
@@ -297,6 +267,12 @@ jobs:
uses: actions/checkout@v4
with:
path: ${{ env.GOPATH }}/src/github.com/docker/docker
-
name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache: false
-
name: Set up Jaeger
run: |
@@ -321,8 +297,8 @@ jobs:
name: Init
run: |
New-Item -ItemType "directory" -Path "bundles"
If ("${{ inputs.os }}" -eq "windows-2019") {
echo "WINDOWS_BASE_IMAGE_TAG=${{ env.WINDOWS_BASE_TAG_2019 }}" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
If ("${{ inputs.os }}" -eq "windows-2025") {
echo "WINDOWS_BASE_IMAGE_TAG=${{ env.WINDOWS_BASE_TAG_2025 }}" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
} ElseIf ("${{ inputs.os }}" -eq "windows-2022") {
echo "WINDOWS_BASE_IMAGE_TAG=${{ env.WINDOWS_BASE_TAG_2022 }}" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
}
@@ -366,10 +342,13 @@ jobs:
"--exec-root=$env:TEMP\moby-exec", `
"--pidfile=$env:TEMP\docker.pid", `
"--register-service"
If ("${{ inputs.storage }}" -eq "snapshotter") {
If ("${{ inputs.storage }}" -eq "graphdriver") {
# Make the env-var visible to the service-managed dockerd, as there's no CLI flag for this option.
& reg add "HKLM\SYSTEM\CurrentControlSet\Services\docker" /v Environment /t REG_MULTI_SZ /s '@' /d TEST_INTEGRATION_USE_SNAPSHOTTER=1
echo "TEST_INTEGRATION_USE_SNAPSHOTTER=1" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
& reg add "HKLM\SYSTEM\CurrentControlSet\Services\docker" /v Environment /t REG_MULTI_SZ /s '@' /d "DOCKER_MIN_API_VERSION=1.24@TEST_INTEGRATION_USE_GRAPHDRIVER=1"
echo "TEST_INTEGRATION_USE_GRAPHDRIVER=1" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
} Else {
# Make the env-var visible to the service-managed dockerd, as there's no CLI flag for this option.
& reg add "HKLM\SYSTEM\CurrentControlSet\Services\docker" /v Environment /t REG_MULTI_SZ /s '@' /d DOCKER_MIN_API_VERSION=1.24
}
Write-Host "Starting service"
Start-Service -Name docker
@@ -428,12 +407,6 @@ jobs:
& "${{ env.BIN_OUT }}\docker" images
env:
DOCKER_HOST: npipe:////./pipe/docker_engine
-
name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache-dependency-path: vendor.sum
-
name: Test integration
if: matrix.test == './...'
@@ -441,7 +414,6 @@ jobs:
.\hack\make.ps1 -TestIntegration
env:
DOCKER_HOST: npipe:////./pipe/docker_engine
GO111MODULE: "off"
TEST_CLIENT_BINARY: ${{ env.BIN_OUT }}\docker
-
name: Test integration-cli
@@ -450,7 +422,6 @@ jobs:
.\hack\make.ps1 -TestIntegrationCli
env:
DOCKER_HOST: npipe:////./pipe/docker_engine
GO111MODULE: "off"
TEST_CLIENT_BINARY: ${{ env.BIN_OUT }}\docker
INTEGRATION_TESTRUN: ${{ matrix.test }}
-
@@ -527,7 +498,7 @@ jobs:
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache-dependency-path: vendor.sum
cache: false
-
name: Download reports
uses: actions/download-artifact@v4

View File

@@ -23,7 +23,7 @@ on:
pull_request:
env:
GO_VERSION: "1.24.4"
GO_VERSION: "1.25.3"
TESTSTAT_VERSION: v0.1.25
DESTDIR: ./build
SETUP_BUILDX_VERSION: edge
@@ -37,6 +37,7 @@ jobs:
build:
runs-on: ubuntu-24.04-arm
timeout-minutes: 20 # guardrails timeout for the whole job
if: ${{ github.event_name != 'pull_request' || !contains(github.event.pull_request.labels.*.name, 'ci/validate-only') }}
needs:
- validate-dco
strategy:
@@ -70,6 +71,7 @@ jobs:
build-dev:
runs-on: ubuntu-24.04-arm
timeout-minutes: 120 # guardrails timeout for the whole job
if: ${{ github.event_name != 'pull_request' || !contains(github.event.pull_request.labels.*.name, 'ci/validate-only') }}
needs:
- validate-dco
steps:
@@ -87,12 +89,13 @@ jobs:
targets: dev
set: |
*.cache-from=type=gha,scope=dev-arm64
*.cache-to=type=gha,scope=dev-arm64,mode=max
*.cache-to=type=gha,scope=dev-arm64
*.output=type=cacheonly
test-unit:
runs-on: ubuntu-24.04-arm
timeout-minutes: 120 # guardrails timeout for the whole job
if: ${{ github.event_name != 'pull_request' || !contains(github.event.pull_request.labels.*.name, 'ci/validate-only') }}
needs:
- build-dev
steps:
@@ -109,6 +112,9 @@ jobs:
version: ${{ env.SETUP_BUILDX_VERSION }}
driver-opts: image=${{ env.SETUP_BUILDKIT_IMAGE }}
buildkitd-flags: --debug
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Build dev image
uses: docker/bake-action@v6
@@ -150,7 +156,7 @@ jobs:
runs-on: ubuntu-24.04
timeout-minutes: 10
continue-on-error: ${{ github.event_name != 'pull_request' }}
if: always()
if: always() && (github.event_name != 'pull_request' || !contains(github.event.pull_request.labels.*.name, 'ci/validate-only'))
needs:
- test-unit
steps:
@@ -159,7 +165,7 @@ jobs:
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache-dependency-path: vendor.sum
cache: false
-
name: Download reports
uses: actions/download-artifact@v4
@@ -179,6 +185,7 @@ jobs:
runs-on: ubuntu-24.04-arm
timeout-minutes: 120 # guardrails timeout for the whole job
continue-on-error: ${{ github.event_name != 'pull_request' }}
if: ${{ github.event_name != 'pull_request' || !contains(github.event.pull_request.labels.*.name, 'ci/validate-only') }}
needs:
- build-dev
steps:
@@ -198,6 +205,9 @@ jobs:
version: ${{ env.SETUP_BUILDX_VERSION }}
driver-opts: image=${{ env.SETUP_BUILDKIT_IMAGE }}
buildkitd-flags: --debug
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Build dev image
uses: docker/bake-action@v6
@@ -249,7 +259,7 @@ jobs:
runs-on: ubuntu-24.04
timeout-minutes: 10
continue-on-error: ${{ github.event_name != 'pull_request' }}
if: always()
if: always() && (github.event_name != 'pull_request' || !contains(github.event.pull_request.labels.*.name, 'ci/validate-only'))
needs:
- test-integration
steps:
@@ -258,7 +268,7 @@ jobs:
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache-dependency-path: vendor.sum
cache: false
-
name: Download reports
uses: actions/download-artifact@v4

View File

@@ -22,6 +22,7 @@ on:
- '[0-9]+.x'
tags:
- 'v*'
- 'docker-v*'
pull_request:
env:
@@ -42,6 +43,7 @@ jobs:
prepare:
runs-on: ubuntu-24.04
timeout-minutes: 20 # guardrails timeout for the whole job
if: ${{ github.event_name != 'pull_request' || !contains(github.event.pull_request.labels.*.name, 'ci/validate-only') }}
outputs:
platforms: ${{ steps.platforms.outputs.matrix }}
steps:
@@ -58,17 +60,21 @@ jobs:
### versioning strategy
## push semver tag v23.0.0
# moby/moby-bin:23.0.0
# moby/moby-bin:23.0
# moby/moby-bin:23
# moby/moby-bin:latest
## push semver prerelease tag v23.0.0-beta.1
# moby/moby-bin:23.0.0-beta.1
## push on master
# moby/moby-bin:master
## push on 23.0 branch
# moby/moby-bin:23.0
## push on 28.x branch
# moby/moby-bin:28.x
tags: |
type=semver,pattern={{version}}
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}},match=docker-(.*)
type=semver,pattern={{major}}.{{minor}},match=docker-(.*)
type=semver,pattern={{major}},match=docker-(.*)
-
name: Rename meta bake definition file
# see https://github.com/docker/metadata-action/issues/381#issuecomment-1918607161
@@ -91,11 +97,11 @@ jobs:
build:
runs-on: ubuntu-24.04
timeout-minutes: 120 # guardrails timeout for the whole job
timeout-minutes: 20 # guardrails timeout for the whole job
if: ${{ always() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') && (github.event_name != 'pull_request' || !contains(github.event.pull_request.labels.*.name, 'ci/validate-only')) }}
needs:
- validate-dco
- prepare
if: always() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled')
strategy:
fail-fast: false
matrix:
@@ -167,10 +173,10 @@ jobs:
merge:
runs-on: ubuntu-24.04
timeout-minutes: 120 # guardrails timeout for the whole job
timeout-minutes: 40 # guardrails timeout for the whole job
if: ${{ always() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') && github.event_name != 'pull_request' && github.repository == 'moby/moby' }}
needs:
- build
if: always() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') && github.event_name != 'pull_request' && github.repository == 'moby/moby'
steps:
-
name: Download meta bake definition

View File

@@ -23,7 +23,7 @@ on:
pull_request:
env:
GO_VERSION: "1.24.4"
GO_VERSION: "1.25.3"
DESTDIR: ./build
SETUP_BUILDX_VERSION: edge
SETUP_BUILDKIT_IMAGE: moby/buildkit:latest
@@ -35,6 +35,7 @@ jobs:
build-linux:
runs-on: ubuntu-24.04
timeout-minutes: 120 # guardrails timeout for the whole job
if: ${{ github.event_name != 'pull_request' || !contains(github.event.pull_request.labels.*.name, 'ci/validate-only') }}
needs:
- validate-dco
steps:
@@ -62,6 +63,7 @@ jobs:
test-linux:
runs-on: ubuntu-24.04
timeout-minutes: 120 # guardrails timeout for the whole job
if: ${{ github.event_name != 'pull_request' || !contains(github.event.pull_request.labels.*.name, 'ci/validate-only') }}
needs:
- build-linux
env:
@@ -106,7 +108,7 @@ jobs:
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache-dependency-path: vendor.sum
cache: false
-
name: BuildKit ref
run: |
@@ -166,6 +168,7 @@ jobs:
build-windows:
runs-on: windows-2022
timeout-minutes: 120
if: ${{ github.event_name != 'pull_request' || !contains(github.event.pull_request.labels.*.name, 'ci/validate-only') }}
needs:
- validate-dco
env:
@@ -188,6 +191,7 @@ jobs:
- name: Env
run: |
Get-ChildItem Env: | Out-String
- name: Moby - Init
run: |
New-Item -ItemType "directory" -Path "${{ github.workspace }}\go-build"
@@ -198,18 +202,7 @@ jobs:
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache-dependency-path: vendor.sum
- name: Cache
uses: actions/cache@v4
with:
path: |
~\AppData\Local\go-build
~\go\pkg\mod
${{ github.workspace }}\go-build
${{ env.GOPATH }}\pkg\mod
key: ${{ inputs.os }}-${{ github.job }}-${{ hashFiles('**/vendor.sum') }}
restore-keys: |
${{ inputs.os }}-${{ github.job }}-
cache: false
- name: Docker info
run: |
@@ -220,7 +213,6 @@ jobs:
& docker build `
--build-arg WINDOWS_BASE_IMAGE `
--build-arg WINDOWS_BASE_IMAGE_TAG `
--build-arg GO_VERSION `
-t ${{ env.TEST_IMAGE_NAME }} `
-f Dockerfile.windows .
@@ -266,6 +258,7 @@ jobs:
test-windows:
runs-on: windows-2022
timeout-minutes: 120 # guardrails timeout for the whole job
if: ${{ github.event_name != 'pull_request' || !contains(github.event.pull_request.labels.*.name, 'ci/validate-only') }}
needs:
- build-windows
env:
@@ -309,22 +302,27 @@ jobs:
disabledFeatures="${disabledFeatures},merge_diff"
fi
echo "BUILDKIT_TEST_DISABLE_FEATURES=${disabledFeatures}" >> $GITHUB_ENV
- name: Expose GitHub Runtime
uses: crazy-max/ghaction-github-runtime@v3
- name: Checkout
uses: actions/checkout@v4
with:
path: moby
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache-dependency-path: vendor.sum
cache: false
- name: BuildKit ref
shell: bash
run: |
echo "$(./hack/buildkit-ref)" >> $GITHUB_ENV
working-directory: moby
- name: Checkout BuildKit ${{ env.BUILDKIT_REF }}
uses: actions/checkout@v4
with:
@@ -359,6 +357,7 @@ jobs:
testFlags="${testFlags} --run=TestIntegration/$testSliceOffset.*/worker=${{ matrix.worker }}"
fi
echo "TESTFLAGS=${testFlags}" >> $GITHUB_ENV
- name: Test
shell: bash
run: |

View File

@@ -67,6 +67,7 @@ jobs:
prepare-cross:
runs-on: ubuntu-24.04
timeout-minutes: 20 # guardrails timeout for the whole job
if: ${{ github.event_name != 'pull_request' || !contains(github.event.pull_request.labels.*.name, 'ci/validate-only') }}
needs:
- validate-dco
outputs:
@@ -89,6 +90,7 @@ jobs:
cross:
runs-on: ubuntu-24.04
timeout-minutes: 20 # guardrails timeout for the whole job
if: ${{ github.event_name != 'pull_request' || !contains(github.event.pull_request.labels.*.name, 'ci/validate-only') }}
needs:
- validate-dco
- prepare-cross
@@ -128,6 +130,7 @@ jobs:
govulncheck:
runs-on: ubuntu-24.04
timeout-minutes: 120 # guardrails timeout for the whole job
# Always run security checks, even with 'ci/validate-only' label
permissions:
# required to write sarif report
security-events: write
@@ -157,6 +160,7 @@ jobs:
build-dind:
runs-on: ubuntu-24.04
if: ${{ github.event_name != 'pull_request' || !contains(github.event.pull_request.labels.*.name, 'ci/validate-only') }}
needs:
- validate-dco
steps:

View File

@@ -17,6 +17,7 @@ on:
- '[0-9]+.x'
tags:
- 'v*'
- 'docker-v*'
pull_request:
# The branches below must be a subset of the branches above
branches: ["master"]
@@ -32,6 +33,9 @@ on:
# * * * * *
- cron: '0 9 * * 4'
env:
GO_VERSION: "1.25.3"
jobs:
codeql:
runs-on: ubuntu-24.04
@@ -46,19 +50,11 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 2
# CodeQL 2.16.4's auto-build added support for multi-module repositories,
# and is trying to be smart by searching for modules in every directory,
# including vendor directories. If no module is found, it's creating one
# which is ... not what we want, so let's give it a "go.mod".
# see: https://github.com/docker/cli/pull/4944#issuecomment-2002034698
- name: Create go.mod
run: |
ln -s vendor.mod go.mod
ln -s vendor.sum go.sum
- name: Update Go
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.24.4"
go-version: ${{ env.GO_VERSION }}
cache: false
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:

18
.github/workflows/labeler.yml vendored Normal file
View File

@@ -0,0 +1,18 @@
name: "Labeler"
on:
pull_request_target:
permissions:
contents: read
jobs:
labeler:
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: Labels
uses: actions/labeler@v6
with:
sync-labels: false

View File

@@ -23,7 +23,7 @@ on:
pull_request:
env:
GO_VERSION: "1.24.4"
GO_VERSION: "1.25.3"
GIT_PAGER: "cat"
PAGER: "cat"
SETUP_BUILDX_VERSION: edge
@@ -44,6 +44,7 @@ jobs:
mode:
- ""
- systemd
- firewalld
steps:
-
name: Prepare
@@ -65,10 +66,11 @@ jobs:
targets: dev
set: |
*.cache-from=type=gha,scope=dev${{ matrix.mode }}
*.cache-to=type=gha,scope=dev${{ matrix.mode }},mode=max
*.cache-to=type=gha,scope=dev${{ matrix.mode }}
*.output=type=cacheonly
test:
if: ${{ github.event_name != 'pull_request' || !contains(github.event.pull_request.labels.*.name, 'ci/validate-only') }}
needs:
- build-dev
- validate-dco
@@ -84,6 +86,7 @@ jobs:
storage: ${{ matrix.storage }}
test-unit:
if: ${{ github.event_name != 'pull_request' || !contains(github.event.pull_request.labels.*.name, 'ci/validate-only') }}
needs:
- build-dev
- validate-dco
@@ -153,6 +156,7 @@ jobs:
smoke-prepare:
runs-on: ubuntu-24.04
timeout-minutes: 10 # guardrails timeout for the whole job
if: ${{ github.event_name != 'pull_request' || !contains(github.event.pull_request.labels.*.name, 'ci/validate-only') }}
needs:
- validate-dco
outputs:
@@ -175,6 +179,7 @@ jobs:
smoke:
runs-on: ubuntu-24.04
timeout-minutes: 20 # guardrails timeout for the whole job
if: ${{ github.event_name != 'pull_request' || !contains(github.event.pull_request.labels.*.name, 'ci/validate-only') }}
needs:
- smoke-prepare
strategy:

View File

@@ -14,15 +14,20 @@ on:
types: [opened, edited, labeled, unlabeled, synchronize]
jobs:
check-area-label:
check-labels:
runs-on: ubuntu-24.04
timeout-minutes: 120 # guardrails timeout for the whole job
steps:
- name: Missing `area/` label
if: contains(join(github.event.pull_request.labels.*.name, ','), 'impact/') && !contains(join(github.event.pull_request.labels.*.name, ','), 'area/')
if: always() && contains(join(github.event.pull_request.labels.*.name, ','), 'impact/') && !contains(join(github.event.pull_request.labels.*.name, ','), 'area/')
run: |
echo "::error::Every PR with an 'impact/*' label should also have an 'area/*' label"
exit 1
- name: Missing `kind/` label
if: always() && contains(join(github.event.pull_request.labels.*.name, ','), 'impact/') && !contains(join(github.event.pull_request.labels.*.name, ','), 'kind/')
run: |
echo "::error::Every PR with an 'impact/*' label should also have a 'kind/*' label"
exit 1
- name: OK
run: exit 0

46
.github/workflows/vm.yml vendored Normal file
View File

@@ -0,0 +1,46 @@
name: vm
# Default to 'contents: read', which grants actions to read commits.
#
# If any permission is set, any permission not included in the list is
# implicitly set to "none".
#
# see https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
workflow_dispatch:
push:
branches:
- 'master'
- '[0-9]+.[0-9]+'
- '[0-9]+.x'
pull_request:
jobs:
validate-dco:
uses: ./.github/workflows/.dco.yml
vm:
needs:
- validate-dco
uses: ./.github/workflows/.vm.yml
strategy:
fail-fast: false
matrix:
template:
# EL 8 is used for running the tests with cgroup v1.
# Do not upgrade this to EL 9 until formally deprecating the cgroup v1 support.
#
# FIXME: use almalinux-8, then probably no need to keep oraclelinux-8 here.
# On almalinux-8, port forwarding tests are failing:
# https://github.com/moby/moby/pull/49819#issuecomment-2815676000
- template://oraclelinux-8 # Oracle's kernel 5.15
# - template://almalinux-8 # kernel 4.18
with:
template: ${{ matrix.template }}

View File

@@ -1,42 +0,0 @@
name: windows-2019
# Default to 'contents: read', which grants actions to read commits.
#
# If any permission is set, any permission not included in the list is
# implicitly set to "none".
#
# see https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
schedule:
- cron: '0 10 * * *'
workflow_dispatch:
jobs:
validate-dco:
uses: ./.github/workflows/.dco.yml
test-prepare:
uses: ./.github/workflows/.test-prepare.yml
needs:
- validate-dco
run:
needs:
- test-prepare
uses: ./.github/workflows/.windows.yml
secrets: inherit
strategy:
fail-fast: false
matrix:
storage: ${{ fromJson(needs.test-prepare.outputs.matrix) }}
with:
os: windows-2019
storage: ${{ matrix.storage }}
send_coverage: false

View File

@@ -14,32 +14,25 @@ concurrency:
cancel-in-progress: true
on:
schedule:
- cron: '0 10 * * *'
workflow_dispatch:
push:
branches:
- 'master'
- '[0-9]+.[0-9]+'
- '[0-9]+.x'
pull_request:
jobs:
validate-dco:
uses: ./.github/workflows/.dco.yml
test-prepare:
uses: ./.github/workflows/.test-prepare.yml
needs:
- validate-dco
run:
needs:
- test-prepare
needs: validate-dco
if: ${{ github.event_name != 'pull_request' || !contains(github.event.pull_request.labels.*.name, 'ci/validate-only') }}
uses: ./.github/workflows/.windows.yml
secrets: inherit
strategy:
fail-fast: false
matrix:
storage: ${{ fromJson(needs.test-prepare.outputs.matrix) }}
storage:
- graphdriver
- snapshotter
with:
os: windows-2022
storage: ${{ matrix.storage }}

43
.github/workflows/windows-2025.yml vendored Normal file
View File

@@ -0,0 +1,43 @@
name: windows-2025
# Default to 'contents: read', which grants actions to read commits.
#
# If any permission is set, any permission not included in the list is
# implicitly set to "none".
#
# see https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
workflow_dispatch:
push:
branches:
- 'master'
- '[0-9]+.[0-9]+'
- '[0-9]+.x'
pull_request:
jobs:
validate-dco:
uses: ./.github/workflows/.dco.yml
run:
needs: validate-dco
if: ${{ github.event_name != 'pull_request' || !contains(github.event.pull_request.labels.*.name, 'ci/validate-only') }}
uses: ./.github/workflows/.windows.yml
secrets: inherit
strategy:
fail-fast: false
matrix:
storage:
- graphdriver
- snapshotter
with:
os: windows-2025
storage: ${{ matrix.storage }}
send_coverage: false

4
.gitignore vendored
View File

@@ -15,8 +15,8 @@ thumbs.db
# build artifacts
/bundles/
/cli/winresources/dockerd/*.syso
/cli/winresources/dockerd/winres.json
/cmd/dockerd/winresources/winres.json
/cmd/dockerd/*.syso
# ci artifacts
*.exe

View File

@@ -3,7 +3,7 @@ version: "2"
run:
# prevent golangci-lint from deducting the go version to lint for through go.mod,
# which causes it to fallback to go1.17 semantics.
go: "1.24.4"
go: "1.25.3"
concurrency: 2
# Only supported with go modules enabled (build flag -mod=vendor only valid when using modules)
# modules-download-mode: vendor
@@ -69,6 +69,8 @@ linters:
desc: Use github.com/moby/sys/userns instead.
- pkg: "github.com/tonistiigi/fsutil"
desc: The fsutil module does not have a stable API, so we should not have a direct dependency unless necessary.
- pkg: "github.com/hashicorp/go-multierror"
desc: "Use errors.Join instead"
dupword:
ignore:
@@ -103,11 +105,11 @@ linters:
msg: Go 1.19 atomic types should be used instead.
- pkg: ^regexp$
pattern: ^regexp\.MustCompile
msg: Use internal/lazyregexp.New instead.
msg: Use daemon/internal/lazyregexp.New instead.
- pkg: github.com/vishvananda/netlink$
pattern: ^netlink\.(Handle\.)?(AddrList|BridgeVlanList|ChainList|ClassList|ConntrackTableList|ConntrackDeleteFilter$|ConntrackDeleteFilters|DevLinkGetDeviceList|DevLinkGetAllPortList|DevlinkGetDeviceParams|FilterList|FouList|GenlFamilyList|GTPPDPList|LinkByName|LinkByAlias|LinkList|LinkSubscribeWithOptions|NeighList$|NeighProxyList|NeighListExecute|NeighSubscribeWithOptions|LinkGetProtinfo|QdiscList|RdmaLinkList|RdmaLinkByName|RdmaLinkDel|RouteList|RouteListFilteredIter|RuleListFiltered$|RouteSubscribeWithOptions|RuleList$|RuleListFiltered|SocketGet|SocketDiagTCPInfo|SocketDiagTCP|SocketDiagUDPInfo|SocketDiagUDP|UnixSocketDiagInfo|UnixSocketDiag|VDPAGetDevConfigList|VDPAGetDevList|VDPAGetMGMTDevList|XfrmPolicyList|XfrmStateList)
msg: Use internal nlwrap package for EINTR handling.
- pkg: github.com/docker/docker/internal/nlwrap$
- pkg: github.com/moby/moby/v2/internal/nlwrap$
pattern: ^nlwrap.Handle.(BridgeVlanList|ChainList|ClassList|ConntrackDeleteFilter$|DevLinkGetDeviceList|DevLinkGetAllPortList|DevlinkGetDeviceParams|FilterList|FouList|GenlFamilyList|GTPPDPList|LinkByAlias|LinkSubscribeWithOptions|NeighList$|NeighProxyList|NeighListExecute|NeighSubscribeWithOptions|LinkGetProtinfo|QdiscList|RdmaLinkList|RdmaLinkByName|RdmaLinkDel|RouteListFilteredIter|RuleListFiltered$|RouteSubscribeWithOptions|RuleList$|RuleListFiltered|SocketGet|SocketDiagTCPInfo|SocketDiagTCP|SocketDiagUDPInfo|SocketDiagUDP|UnixSocketDiagInfo|UnixSocketDiag|VDPAGetDevConfigList|VDPAGetDevList|VDPAGetMGMTDevList)
msg: Add a wrapper to nlwrap.Handle for EINTR handling and update the list in .golangci.yml.
analyze-types: true
@@ -192,6 +194,8 @@ linters:
alias: c8dimages
- pkg: github.com/opencontainers/image-spec/specs-go/v1
alias: ocispec
- pkg: github.com/moby/docker-image-spec/specs-go/v1
alias: dockerspec
- pkg: go.etcd.io/bbolt
alias: bolt
# Enforce that gotest.tools/v3/assert/cmp is always aliased as "is"
@@ -204,10 +208,20 @@ linters:
max-func-lines: 0
revive:
# Only listed rules are applied
# https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md
rules:
- name: increment-decrement
# FIXME make sure all packages have a description. Currently, there's many packages without.
- name: package-comments
disabled: true
- name: redefines-builtin-id
- name: superfluous-else
arguments:
- preserve-scope
- name: use-any
- name: use-errors-new
- name: var-declaration
staticcheck:
checks:
@@ -255,9 +269,6 @@ linters:
http-status-code: true
exclusions:
paths:
- volume/drivers/proxy.go # TODO: this is a generated file but with an invalid header, see https://github.com/moby/moby/pull/46274
rules:
# We prefer to use an "linters.exclusions.rules" so that new "default" exclusions are not
# automatically inherited. We can decide whether or not to follow upstream
@@ -303,11 +314,6 @@ linters:
linters:
- staticcheck
# FIXME(thaJeztah): ignoring these transitional utilities until BuildKit is vendored with https://github.com/moby/moby/pull/49743
- text: "SA1019: idtools\\.(ToUserIdentityMapping|FromUserIdentityMapping) is deprecated"
linters:
- staticcheck
# Ignore "nested context in function literal (fatcontext)" as we intentionally set up tracing on a base-context for tests.
# FIXME(thaJeztah): see if there's a more iodiomatic way to do this.
- text: 'nested context in function literal'
@@ -327,13 +333,21 @@ linters:
linters:
- forbidigo
- text: 'use of `regexp.MustCompile` forbidden'
path: "internal/lazyregexp"
path: "daemon/internal/lazyregexp"
linters:
- forbidigo
- text: 'use of `regexp.MustCompile` forbidden'
path: "internal/testutils"
linters:
- forbidigo
- text: 'use of `regexp.MustCompile` forbidden'
path: "libnetwork/cmd/networkdb-test/dbclient"
linters:
- forbidigo
- text: 'use of `regexp.MustCompile` forbidden'
path: "registry/"
linters:
- forbidigo
# Log a warning if an exclusion rule is unused.
# Default: false

View File

@@ -97,6 +97,7 @@ Artur Meyster <arthurfbi@yahoo.com>
Austin Vazquez <austin.vazquez.dev@gmail.com>
Austin Vazquez <austin.vazquez.dev@gmail.com> <55906459+austinvazquez@users.noreply.github.com>
Austin Vazquez <austin.vazquez.dev@gmail.com> <macedonv@amazon.com>
Austin Vazquez <austin.vazquez.dev@gmail.com> <austin.vazquez@docker.com>
Avi Miller <avi.miller@oracle.com> <avi.miller@gmail.com>
Ben Bonnefoy <frenchben@docker.com>
Ben Golub <ben.golub@dotcloud.com>

20
AUTHORS
View File

@@ -23,6 +23,7 @@ Abhishek Chanda <abhishek.becs@gmail.com>
Abhishek Sharma <abhishek@asharma.me>
Abin Shahab <ashahab@altiscale.com>
Abirdcfly <fp544037857@gmail.com>
Abubacarr Ceesay <abubacarr671@gmail.com>
Ada Mancini <ada@docker.com>
Adam Avilla <aavilla@yp.com>
Adam Dobrawy <naczelnik@jawnosc.tk>
@@ -49,6 +50,7 @@ Adrian Mouat <adrian.mouat@gmail.com>
Adrian Oprea <adrian@codesi.nz>
Adrien Folie <folie.adrien@gmail.com>
Adrien Gallouët <adrien@gallouet.fr>
Adrien Pompée <adrien.pompee@atmosphere.aero>
Ahmed Kamal <email.ahmedkamal@googlemail.com>
Ahmet Alp Balkan <ahmetb@microsoft.com>
Aidan Feldman <aidan.feldman@gmail.com>
@@ -81,6 +83,7 @@ Aleksandrs Fadins <aleks@s-ko.net>
Alena Prokharchyk <alena@rancher.com>
Alessandro Boch <aboch@tetrationanalytics.com>
Alessio Biancalana <dottorblaster@gmail.com>
Alessio Perugini <alessio@perugini.xyz>
Alex Chan <alex@alexwlchan.net>
Alex Chen <alexchenunix@gmail.com>
Alex Coventry <alx@empirical.com>
@@ -171,6 +174,7 @@ Andrew Po <absourd.noise@gmail.com>
Andrew Weiss <andrew.weiss@docker.com>
Andrew Williams <williams.andrew@gmail.com>
Andrews Medina <andrewsmedina@gmail.com>
Andrey Epifanov <aepifanov@mirantis.com>
Andrey Kolomentsev <andrey.kolomentsev@docker.com>
Andrey Petrov <andrey.petrov@shazow.net>
Andrey Stolbovsky <andrey.stolbovsky@gmail.com>
@@ -200,6 +204,7 @@ Anthon van der Neut <anthon@mnt.org>
Anthony Baire <Anthony.Baire@irisa.fr>
Anthony Bishopric <git@anthonybishopric.com>
Anthony Dahanne <anthony.dahanne@gmail.com>
Anthony Nandaa <profnandaa@gmail.com>
Anthony Sottile <asottile@umich.edu>
Anton Löfgren <anton.lofgren@gmail.com>
Anton Nikitin <anton.k.nikitin@gmail.com>
@@ -345,6 +350,7 @@ Carlos Alexandro Becker <caarlos0@gmail.com>
Carlos de Paula <me@carlosedp.com>
Carlos Sanchez <carlos@apache.org>
Carol Fager-Higgins <carol.fager-higgins@docker.com>
carsontham <carsontham@outlook.com>
Cary <caryhartline@users.noreply.github.com>
Casey Bisson <casey.bisson@joyent.com>
Catalin Pirvu <pirvu.catalin94@gmail.com>
@@ -871,6 +877,7 @@ haining.cao <haining.cao@daocloud.io>
Hakan Özler <hakan.ozler@kodcu.com>
Hamish Hutchings <moredhel@aoeu.me>
Hannes Ljungberg <hannes@5monkeys.se>
Hannes Ortmeier <ortmeier.hannes@gmail.com>
Hans Kristian Flaatten <hans@starefossen.com>
Hans Rødtang <hansrodtang@gmail.com>
Hao Shu Wei <haoshuwei24@gmail.com>
@@ -890,6 +897,7 @@ heartlock <21521209@zju.edu.cn>
Hector Castro <hectcastro@gmail.com>
Helen Xie <chenjg@harmonycloud.cn>
Henning Sprang <henning.sprang@gmail.com>
Henry Wang <henwang@amazon.com>
Hiroshi Hatake <hatake@clear-code.com>
Hiroyuki Sasagawa <hs19870702@gmail.com>
Hobofan <goisser94@gmail.com>
@@ -1089,6 +1097,7 @@ Jintao Zhang <zhangjintao9020@gmail.com>
Jiri Appl <jiria@microsoft.com>
Jiri Popelka <jpopelka@redhat.com>
Jiuyue Ma <majiuyue@huawei.com>
Jiří Moravčík <jiri.moravcik@gmail.com>
Jiří Župka <jzupka@redhat.com>
jjimbo137 <115816493+jjimbo137@users.noreply.github.com>
Joakim Roubert <joakim.roubert@axis.com>
@@ -1320,6 +1329,7 @@ Leandro Motta Barros <lmb@stackedboxes.org>
Leandro Siqueira <leandro.siqueira@gmail.com>
Lee Calcote <leecalcote@gmail.com>
Lee Chao <932819864@qq.com>
Lee Gaines <leetgaines@gmail.com>
Lee, Meng-Han <sunrisedm4@gmail.com>
Lei Gong <lgong@alauda.io>
Lei Jitang <leijitang@huawei.com>
@@ -1407,6 +1417,7 @@ Manuel Meurer <manuel@krautcomputing.com>
Manuel Rüger <manuel@rueg.eu>
Manuel Woelker <github@manuel.woelker.org>
mapk0y <mapk0y@gmail.com>
Marat Abrarov <abrarov@gmail.com>
Marat Radchenko <marat@slonopotamus.org>
Marc Abramowitz <marc@marc-abramowitz.com>
Marc Kuo <kuomarc2@gmail.com>
@@ -1421,6 +1432,7 @@ Marcus Linke <marcus.linke@gmx.de>
Marcus Martins <marcus@docker.com>
Marcus Ramberg <marcus@nordaaker.com>
Marek Goldmann <marek.goldmann@gmail.com>
Maria Glushenok <glushenokm@gmail.com>
Marian Marinov <mm@yuhu.biz>
Marianna Tessel <mtesselh@gmail.com>
Mario Loriedo <mario.loriedo@gmail.com>
@@ -1504,6 +1516,7 @@ Maxime Petazzoni <max@signalfuse.com>
Maximiliano Maccanti <maccanti@amazon.com>
Maxwell <csuhp007@gmail.com>
Meaglith Ma <genedna@gmail.com>
Medhy DOHOU <52136144+PowerPixel@users.noreply.github.com>
meejah <meejah@meejah.ca>
Megan Kostick <mkostick@us.ibm.com>
Mehul Kar <mehul.kar@gmail.com>
@@ -1604,6 +1617,7 @@ Moysés Borges <moysesb@gmail.com>
mrfly <mr.wrfly@gmail.com>
Mrunal Patel <mrunalp@gmail.com>
Muayyad Alsadi <alsadi@gmail.com>
Muhammad Daffa Dinaya <muhammaddaffadinaya@gmail.com>
Muhammad Zohaib Aslam <zohaibse011@gmail.com>
Mustafa Akın <mustafa91@gmail.com>
Muthukumar R <muthur@gmail.com>
@@ -2023,12 +2037,14 @@ Sergey Alekseev <sergey.alekseev.minsk@gmail.com>
Sergey Evstifeev <sergey.evstifeev@gmail.com>
Sergii Kabashniuk <skabashnyuk@codenvy.com>
Sergio Lopez <slp@redhat.com>
Serhan Tutar <randomnoise@users.noreply.github.com>
Serhat Gülçiçek <serhat25@gmail.com>
Serhii Nakon <serhii.n@thescimus.com>
SeungUkLee <lsy931106@gmail.com>
Sevki Hasirci <s@sevki.org>
Shane Canon <scanon@lbl.gov>
Shane da Silva <shane@dasilva.io>
Shang Mu <smu@princeton.edu>
Shaun Kaasten <shaunk@gmail.com>
Shaun Thompson <shaun.thompson@docker.com>
shaunol <shaunol@gmail.com>
@@ -2120,6 +2136,7 @@ Stéphane Este-Gracias <sestegra@gmail.com>
Stig Larsson <stig@larsson.dev>
Su Wang <su.wang@docker.com>
Subhajit Ghosh <isubuz.g@gmail.com>
Sudheendra Gopinath <sudheendra.gopinath@amd.com>
Sujith Haridasan <sujith.h@gmail.com>
Sun Gengze <690388648@qq.com>
Sun Jianbo <wonderflow.sun@gmail.com>
@@ -2176,6 +2193,7 @@ Thomas Tanaka <thomas.tanaka@oracle.com>
Thomas Texier <sharkone@en-mousse.org>
Ti Zhou <tizhou1986@gmail.com>
Tiago Seabra <tlgs@users.noreply.github.com>
Tiago Teixeira <tiago.teixeira@ecorobotix.com>
Tianon Gravi <admwiggin@gmail.com>
Tianyi Wang <capkurmagati@gmail.com>
Tibor Vass <teabee89@gmail.com>
@@ -2276,6 +2294,7 @@ Valentin Kulesh <valentin.kulesh@virtuozzo.com>
vanderliang <lansheng@meili-inc.com>
Velko Ivanov <vivanov@deeperplane.com>
Veres Lajos <vlajos@gmail.com>
Viacheslav Gagara <viacheslavg@gmail.com>
Victor Algaze <valgaze@gmail.com>
Victor Coisne <victor.coisne@dotcloud.com>
Victor Costan <costan@gmail.com>
@@ -2492,5 +2511,6 @@ Zunayed Ali <zunayed@gmail.com>
徐俊杰 <paco.xu@daocloud.io>
慕陶 <jihui.xjh@alibaba-inc.com>
搏通 <yufeng.pyf@alibaba-inc.com>
纯真 <38834411+chunzhennn@users.noreply.github.com>
黄艳红00139573 <huang.yanhong@zte.com.cn>
정재영 <jjy600901@gmail.com>

View File

@@ -1,27 +1,30 @@
# syntax=docker/dockerfile:1
ARG GO_VERSION=1.24.4
ARG GO_VERSION=1.25.3
ARG BASE_DEBIAN_DISTRO="bookworm"
ARG GOLANG_IMAGE="golang:${GO_VERSION}-${BASE_DEBIAN_DISTRO}"
ARG XX_VERSION=1.6.1
# XX_VERSION specifies the version of the xx utility to use.
# It must be a valid tag in the docker.io/tonistiigi/xx image repository.
ARG XX_VERSION=1.7.0
# VPNKIT_VERSION is the version of the vpnkit binary which is used as a fallback
# network driver for rootless.
ARG VPNKIT_VERSION=0.6.0
# DOCKERCLI_VERSION is the version of the CLI to install in the dev-container.
ARG DOCKERCLI_VERSION=v28.2.2
ARG DOCKERCLI_VERSION=v28.5.0
ARG DOCKERCLI_REPOSITORY="https://github.com/docker/cli.git"
# cli version used for integration-cli tests
ARG DOCKERCLI_INTEGRATION_REPOSITORY="https://github.com/docker/cli.git"
ARG DOCKERCLI_INTEGRATION_VERSION=v18.06.3-ce
ARG DOCKERCLI_INTEGRATION_VERSION=v25.0.5
# BUILDX_VERSION is the version of buildx to install in the dev container.
ARG BUILDX_VERSION=0.24.0
ARG BUILDX_VERSION=0.29.1
# COMPOSE_VERSION is the version of compose to install in the dev container.
ARG COMPOSE_VERSION=v2.36.2
ARG COMPOSE_VERSION=v2.40.0
ARG SYSTEMD="false"
ARG FIREWALLD="false"
@@ -34,8 +37,8 @@ ARG DOCKER_STATIC=1
ARG REGISTRY_VERSION=3.0.0
# delve is currently only supported on linux/amd64 and linux/arm64;
# https://github.com/go-delve/delve/blob/v1.24.1/pkg/proc/native/support_sentinel.go#L1
# https://github.com/go-delve/delve/blob/v1.24.1/pkg/proc/native/support_sentinel_linux.go#L1
# https://github.com/go-delve/delve/blob/v1.25.0/pkg/proc/native/support_sentinel.go#L1
# https://github.com/go-delve/delve/blob/v1.25.0/pkg/proc/native/support_sentinel_linux.go#L1
#
# ppc64le support was added in v1.21.1, but is still experimental, and requires
# the "-tags exp.linuxppc64le" build-tag to be set:
@@ -64,7 +67,6 @@ COPY --from=xx / /
RUN go telemetry off && [ "$(go telemetry)" = "off" ] || { echo "Failed to disable Go telemetry"; exit 1; }
RUN echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache
RUN apt-get update && apt-get install --no-install-recommends -y file
ENV GO111MODULE=off
ENV GOTOOLCHAIN=local
FROM base AS criu
@@ -82,25 +84,18 @@ FROM distribution/distribution:$REGISTRY_VERSION AS registry
RUN mkdir /build && mv /bin/registry /build/registry
# go-swagger
FROM base AS swagger-src
WORKDIR /usr/src/swagger
# Currently uses a fork from https://github.com/kolyshkin/go-swagger/tree/golang-1.13-fix
# TODO: move to under moby/ or fix upstream go-swagger to work for us.
RUN git init . && git remote add origin "https://github.com/kolyshkin/go-swagger.git"
# GO_SWAGGER_COMMIT specifies the version of the go-swagger binary to build and
# install. Go-swagger is used in CI for validating swagger.yaml in hack/validate/swagger-gen
ARG GO_SWAGGER_COMMIT=c56166c036004ba7a3a321e5951ba472b9ae298c
RUN git fetch -q --depth 1 origin "${GO_SWAGGER_COMMIT}" && git checkout -q FETCH_HEAD
FROM base AS swagger
WORKDIR /go/src/github.com/go-swagger/go-swagger
ARG TARGETPLATFORM
RUN --mount=from=swagger-src,src=/usr/src/swagger,rw \
--mount=type=cache,target=/root/.cache/go-build,id=swagger-build-$TARGETPLATFORM \
# GO_SWAGGER_VERSION specifies the version of the go-swagger binary to install.
# Go-swagger is used in CI for generating types from swagger.yaml in
# hack/validate/swagger-gen
ARG GO_SWAGGER_VERSION=v0.33.1
RUN --mount=type=cache,target=/root/.cache/go-build,id=swagger-build-$TARGETPLATFORM \
--mount=type=cache,target=/go/pkg/mod \
--mount=type=tmpfs,target=/go/src/ <<EOT
set -e
xx-go build -o /build/swagger ./cmd/swagger
GOBIN=/build CGO_ENABLED=0 xx-go install "github.com/go-swagger/go-swagger/cmd/swagger@${GO_SWAGGER_VERSION}"
xx-verify /build/swagger
EOT
@@ -121,7 +116,7 @@ ARG TARGETVARIANT
RUN /download-frozen-image-v2.sh /build \
busybox:latest@sha256:95cf004f559831017cdf4628aaf1bb30133677be8702a8c5f2994629f637a209 \
busybox:glibc@sha256:1f81263701cddf6402afe9f33fca0266d9fff379e59b1748f33d3072da71ee85 \
debian:bookworm-slim@sha256:2bc5c236e9b262645a323e9088dfa3bb1ecb16cc75811daf40a23a824d665be9 \
debian:trixie-slim@sha256:c85a2732e97694ea77237c61304b3bb410e0e961dd6ee945997a06c788c545bb \
hello-world:latest@sha256:d58e752213a51785838f9eed2b7a498ffa1cb3aa7f946dda11af39286c3db9a9 \
arm32v7/hello-world:latest@sha256:50b8560ad574c779908da71f7ce370c0a2471c098d44d1c8f6b513c5a55eeeb1 \
hello-world:amd64@sha256:90659bf80b44ce6be8234e6ff90a1ac34acbeb826903b02cfa0da11c82cbc042 \
@@ -135,7 +130,7 @@ RUN git init . && git remote add origin "https://github.com/go-delve/delve.git"
# from the https://github.com/go-delve/delve repository.
# It can be used to run Docker with a possibility of
# attaching debugger to it.
ARG DELVE_VERSION=v1.24.1
ARG DELVE_VERSION=v1.25.2
RUN git fetch -q --depth 1 origin "${DELVE_VERSION}" +refs/tags/*:refs/tags/* && git checkout -q FETCH_HEAD
FROM base AS delve-supported
@@ -145,7 +140,7 @@ RUN --mount=from=delve-src,src=/usr/src/delve,rw \
--mount=type=cache,target=/root/.cache/go-build,id=delve-build-$TARGETPLATFORM \
--mount=type=cache,target=/go/pkg/mod <<EOT
set -e
GO111MODULE=on xx-go build -o /build/dlv ./cmd/dlv
xx-go build -o /build/dlv ./cmd/dlv
xx-verify /build/dlv
EOT
@@ -157,7 +152,7 @@ FROM base AS gowinres
ARG GOWINRES_VERSION=v0.3.1
RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg/mod \
GOBIN=/build/ GO111MODULE=on go install "github.com/tc-hib/go-winres@${GOWINRES_VERSION}" \
GOBIN=/build CGO_ENABLED=0 go install "github.com/tc-hib/go-winres@${GOWINRES_VERSION}" \
&& /build/go-winres --help
# containerd
@@ -167,11 +162,8 @@ RUN git init . && git remote add origin "https://github.com/containerd/container
# CONTAINERD_VERSION is used to build containerd binaries, and used for the
# integration tests. The distributed docker .deb and .rpm packages depend on a
# separate (containerd.io) package, which may be a different version as is
# specified here. The containerd golang package is also pinned in vendor.mod.
# When updating the binary version you may also need to update the vendor
# version to pick up bug fixes or new APIs, however, usually the Go packages
# are built from a commit from the master branch.
ARG CONTAINERD_VERSION=v1.7.27
# specified here.
ARG CONTAINERD_VERSION=v2.1.4
RUN git fetch -q --depth 1 origin "${CONTAINERD_VERSION}" +refs/tags/*:refs/tags/* && git checkout -q FETCH_HEAD
FROM base AS containerd-build
@@ -205,27 +197,28 @@ FROM base AS golangci_lint
ARG GOLANGCI_LINT_VERSION=v2.1.5
RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg/mod \
GOBIN=/build/ GO111MODULE=on go install "github.com/golangci/golangci-lint/v2/cmd/golangci-lint@${GOLANGCI_LINT_VERSION}" \
GOBIN=/build CGO_ENABLED=0 go install "github.com/golangci/golangci-lint/v2/cmd/golangci-lint@${GOLANGCI_LINT_VERSION}" \
&& /build/golangci-lint --version
FROM base AS gotestsum
ARG GOTESTSUM_VERSION=v1.12.0
# GOTESTSUM_VERSION is the version of gotest.tools/gotestsum to install.
ARG GOTESTSUM_VERSION=v1.13.0
RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg/mod \
GOBIN=/build/ GO111MODULE=on go install "gotest.tools/gotestsum@${GOTESTSUM_VERSION}" \
GOBIN=/build CGO_ENABLED=0 go install "gotest.tools/gotestsum@${GOTESTSUM_VERSION}" \
&& /build/gotestsum --version
FROM base AS shfmt
ARG SHFMT_VERSION=v3.8.0
RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg/mod \
GOBIN=/build/ GO111MODULE=on go install "mvdan.cc/sh/v3/cmd/shfmt@${SHFMT_VERSION}" \
GOBIN=/build CGO_ENABLED=0 go install "mvdan.cc/sh/v3/cmd/shfmt@${SHFMT_VERSION}" \
&& /build/shfmt --version
FROM base AS gopls
RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg/mod \
GOBIN=/build/ GO111MODULE=on go install "golang.org/x/tools/gopls@latest" \
GOBIN=/build CGO_ENABLED=0 go install "golang.org/x/tools/gopls@latest" \
&& /build/gopls version
FROM base AS dockercli
@@ -257,11 +250,11 @@ RUN --mount=source=hack/dockerfile/cli.sh,target=/download-or-build-cli.sh \
FROM base AS runc-src
WORKDIR /usr/src/runc
RUN git init . && git remote add origin "https://github.com/opencontainers/runc.git"
# RUNC_VERSION should match the version that is used by the containerd version
# RUNC_VERSION sets the version of runc to install in the dev-container.
# This version should usually match the version that is used by the containerd version
# that is used. If you need to update runc, open a pull request in the containerd
# project first, and update both after that is merged. When updating RUNC_VERSION,
# consider updating runc in vendor.mod accordingly.
ARG RUNC_VERSION=v1.2.6
# project first, and update both after that is merged.
ARG RUNC_VERSION=v1.3.2
RUN git fetch -q --depth 1 origin "${RUNC_VERSION}" +refs/tags/*:refs/tags/* && git checkout -q FETCH_HEAD
FROM base AS runc-build
@@ -328,8 +321,8 @@ FROM tini-${TARGETOS} AS tini
FROM base AS rootlesskit-src
WORKDIR /usr/src/rootlesskit
RUN git init . && git remote add origin "https://github.com/rootless-containers/rootlesskit.git"
# When updating, also update vendor.mod and hack/dockerfile/install/rootlesskit.installer accordingly.
ARG ROOTLESSKIT_VERSION=v2.3.4
# When updating, also update go.mod and hack/dockerfile/install/rootlesskit.installer accordingly.
ARG ROOTLESSKIT_VERSION=v2.3.5
RUN git fetch -q --depth 1 origin "${ROOTLESSKIT_VERSION}" +refs/tags/*:refs/tags/* && git checkout -q FETCH_HEAD
FROM base AS rootlesskit-build
@@ -341,7 +334,6 @@ RUN --mount=type=cache,sharing=locked,id=moby-rootlesskit-aptlib,target=/var/lib
gcc \
libc6-dev \
pkg-config
ENV GO111MODULE=on
ARG DOCKER_STATIC
RUN --mount=from=rootlesskit-src,src=/usr/src/rootlesskit,rw \
--mount=type=cache,target=/go/pkg/mod \
@@ -502,6 +494,7 @@ RUN --mount=type=cache,sharing=locked,id=moby-dev-aptlib,target=/var/lib/apt \
apparmor \
bash-completion \
bzip2 \
fuse-overlayfs \
inetutils-ping \
iproute2 \
iptables \
@@ -509,6 +502,7 @@ RUN --mount=type=cache,sharing=locked,id=moby-dev-aptlib,target=/var/lib/apt \
jq \
libcap2-bin \
libnet1 \
libnftables-dev \
libnl-3-200 \
libprotobuf-c1 \
libyajl2 \
@@ -542,20 +536,21 @@ COPY --link --from=dockercli-integration /build/ /usr/local/cli-integration
FROM base AS build
COPY --from=gowinres /build/ /usr/local/bin/
WORKDIR /go/src/github.com/docker/docker
ENV GO111MODULE=off
ENV CGO_ENABLED=1
RUN --mount=type=cache,sharing=locked,id=moby-build-aptlib,target=/var/lib/apt \
--mount=type=cache,sharing=locked,id=moby-build-aptcache,target=/var/cache/apt \
apt-get update && apt-get install --no-install-recommends -y \
clang \
lld \
llvm
llvm \
icoutils
ARG TARGETPLATFORM
RUN --mount=type=cache,sharing=locked,id=moby-build-aptlib,target=/var/lib/apt \
--mount=type=cache,sharing=locked,id=moby-build-aptcache,target=/var/cache/apt \
xx-apt-get install --no-install-recommends -y \
gcc \
libc6-dev \
libnftables-dev \
libseccomp-dev \
libsystemd-dev \
pkg-config
@@ -579,7 +574,6 @@ RUN <<EOT
fi
EOT
RUN --mount=type=bind,target=.,rw \
--mount=type=tmpfs,target=cli/winresources/dockerd \
--mount=type=cache,target=/root/.cache/go-build,id=moby-build-$TARGETPLATFORM <<EOT
set -e
target=$([ "$DOCKER_STATIC" = "1" ] && echo "binary" || echo "dynbinary")

View File

@@ -5,18 +5,17 @@
# This represents the bare minimum required to build and test Docker.
ARG GO_VERSION=1.24.4
ARG GO_VERSION=1.25.3
ARG BASE_DEBIAN_DISTRO="bookworm"
ARG GOLANG_IMAGE="golang:${GO_VERSION}-${BASE_DEBIAN_DISTRO}"
FROM ${GOLANG_IMAGE}
ENV GO111MODULE=off
ENV GOTOOLCHAIN=local
# Compile and runtime deps
# https://github.com/docker/docker/blob/master/project/PACKAGERS.md#build-dependencies
# https://github.com/docker/docker/blob/master/project/PACKAGERS.md#runtime-dependencies
# https://github.com/moby/moby/blob/master/project/PACKAGERS.md#build-dependencies
# https://github.com/moby/moby/blob/master/project/PACKAGERS.md#runtime-dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
curl \

View File

@@ -161,12 +161,17 @@ FROM ${WINDOWS_BASE_IMAGE}:${WINDOWS_BASE_IMAGE_TAG}
# Use PowerShell as the default shell
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
ARG GO_VERSION=1.24.4
ARG GOTESTSUM_VERSION=v1.12.0
ARG GO_VERSION=1.25.3
# GOTESTSUM_VERSION is the version of gotest.tools/gotestsum to install.
ARG GOTESTSUM_VERSION=v1.13.0
# GOWINRES_VERSION is the version of go-winres to install.
ARG GOWINRES_VERSION=v0.3.3
ARG CONTAINERD_VERSION=v1.7.27
# TODO: Update containerd version to match Linux version once
# https://github.com/microsoft/hcsshim/issues/2488 is resolved.
ARG CONTAINERD_VERSION=v2.0.6
# Environment variable notes:
# - GO_VERSION must be consistent with 'Dockerfile' used by Linux.
@@ -176,7 +181,6 @@ ENV GO_VERSION=${GO_VERSION} `
CONTAINERD_VERSION=${CONTAINERD_VERSION} `
GIT_VERSION=2.11.1 `
GOPATH=C:\gopath `
GO111MODULE=off `
GOTOOLCHAIN=local `
FROM_DOCKERFILE=1 `
GOTESTSUM_VERSION=${GOTESTSUM_VERSION} `
@@ -257,14 +261,11 @@ RUN `
Remove-Item C:\gitsetup.zip; `
`
Write-Host INFO: Downloading containerd; `
Install-Package -Force 7Zip4PowerShell; `
$location='https://github.com/containerd/containerd/releases/download/'+$Env:CONTAINERD_VERSION+'/containerd-'+$Env:CONTAINERD_VERSION.TrimStart('v')+'-windows-amd64.tar.gz'; `
Download-File $location C:\containerd.tar.gz; `
New-Item -Path C:\containerd -ItemType Directory; `
Expand-7Zip C:\containerd.tar.gz C:\; `
Expand-7Zip C:\containerd.tar C:\containerd; `
tar -xzf C:\containerd.tar.gz -C C:\containerd; `
Remove-Item C:\containerd.tar.gz; `
Remove-Item C:\containerd.tar; `
`
# Ensure all directories exist that we will require below....
$srcDir = """$Env:GOPATH`\src\github.com\docker\docker\bundles"""; `
@@ -276,13 +277,11 @@ RUN `
RUN `
Function Install-GoTestSum() { `
$Env:GO111MODULE = 'on'; `
$tmpGobin = "${Env:GOBIN_TMP}"; `
$Env:GOBIN = """${Env:GOPATH}`\bin"""; `
Write-Host "INFO: Installing gotestsum version $Env:GOTESTSUM_VERSION in $Env:GOBIN"; `
&go install "gotest.tools/gotestsum@${Env:GOTESTSUM_VERSION}"; `
$Env:GOBIN = "${tmpGobin}"; `
$Env:GO111MODULE = 'off'; `
if ($LASTEXITCODE -ne 0) { `
Throw '"gotestsum install failed..."'; `
} `
@@ -292,13 +291,11 @@ RUN `
RUN `
Function Install-GoWinres() { `
$Env:GO111MODULE = 'on'; `
$tmpGobin = "${Env:GOBIN_TMP}"; `
$Env:GOBIN = """${Env:GOPATH}`\bin"""; `
Write-Host "INFO: Installing go-winres version $Env:GOWINRES_VERSION in $Env:GOBIN"; `
&go install "github.com/tc-hib/go-winres@${Env:GOWINRES_VERSION}"; `
$Env:GOBIN = "${tmpGobin}"; `
$Env:GO111MODULE = 'off'; `
if ($LASTEXITCODE -ne 0) { `
Throw '"go-winres install failed..."'; `
} `

View File

@@ -6,7 +6,7 @@
# GitHub ID, Name, Email address, GPG fingerprint
"akerouanton","Albin Kerouanton","albinker@gmail.com"
"AkihiroSuda","Akihiro Suda","akihiro.suda.cz@hco.ntt.co.jp"
"austinvazquez","Austin Vazquez","macedonv@amazon.com"
"austinvazquez","Austin Vazquez","austin.vazquez.dev@gmail.com"
"corhere","Cory Snider","csnider@mirantis.com"
"cpuguy83","Brian Goff","cpuguy83@gmail.com"
"robmry","Rob Murray","rob.murray@docker.com"

View File

@@ -38,8 +38,10 @@ DOCKER_ENVS := \
-e DOCKERCLI_INTEGRATION_REPOSITORY \
-e DOCKER_DEBUG \
-e DOCKER_EXPERIMENTAL \
-e DOCKER_FIREWALL_BACKEND \
-e DOCKER_GITCOMMIT \
-e DOCKER_GRAPHDRIVER \
-e DOCKER_IGNORE_BR_NETFILTER_ERROR \
-e DOCKER_LDFLAGS \
-e DOCKER_PORT \
-e DOCKER_REMAP_ROOT \
@@ -53,7 +55,7 @@ DOCKER_ENVS := \
-e GITHUB_ACTIONS \
-e TEST_FORCE_VALIDATE \
-e TEST_INTEGRATION_DIR \
-e TEST_INTEGRATION_USE_SNAPSHOTTER \
-e TEST_INTEGRATION_USE_GRAPHDRIVER \
-e TEST_INTEGRATION_FAIL_FAST \
-e TEST_SKIP_INTEGRATION \
-e TEST_SKIP_INTEGRATION_CLI \

View File

@@ -1,9 +1,11 @@
The Moby Project
================
[![PkgGoDev](https://pkg.go.dev/badge/github.com/docker/docker)](https://pkg.go.dev/github.com/docker/docker)
[![Go Report Card](https://goreportcard.com/badge/github.com/docker/docker)](https://goreportcard.com/report/github.com/docker/docker)
[![PkgGoDev](https://pkg.go.dev/badge/github.com/moby/moby/v2)](https://pkg.go.dev/github.com/moby/moby/v2)
![GitHub License](https://img.shields.io/github/license/moby/moby)
[![Go Report Card](https://goreportcard.com/badge/github.com/moby/moby/v2)](https://goreportcard.com/report/github.com/moby/moby/v2)
[![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/moby/moby/badge)](https://scorecard.dev/viewer/?uri=github.com/moby/moby)
[![OpenSSF Best Practices](https://www.bestpractices.dev/projects/10989/badge)](https://www.bestpractices.dev/projects/10989)
![Moby Project logo](docs/static_files/moby-project-logo.png "The Moby Project")

View File

@@ -113,5 +113,5 @@ We see gRPC as the natural communication layer between decoupled components.
In addition to pushing out large components into other projects, much of the
internal code structure, and in particular the
["Daemon"](https://godoc.org/github.com/docker/docker/daemon#Daemon) object,
["Daemon"](https://pkg.go.dev/github.com/moby/moby/v2/daemon#Daemon) object,
should be split into smaller, more manageable, and more testable components.

View File

@@ -8,11 +8,11 @@ questions you may have as an aspiring Moby contributor.
Moby has two test suites (and one legacy test suite):
* Unit tests - use standard `go test` and
[gotest.tools/assert](https://godoc.org/gotest.tools/assert) assertions. They are located in
[gotest.tools/v3/assert](https://pkg.go.dev/gotest.tools/v3/assert) assertions. They are located in
the package they test. Unit tests should be fast and test only their own
package.
* API integration tests - use standard `go test` and
[gotest.tools/assert](https://godoc.org/gotest.tools/assert) assertions. They are located in
[gotest.tools/v3/assert](https://pkg.go.dev/gotest.tools/v3/assert) assertions. They are located in
`./integration/<component>` directories, where `component` is: container,
image, volume, etc. These tests perform HTTP requests to an API endpoint and
check the HTTP response and daemon state after the call.
@@ -57,17 +57,28 @@ Instead, implement new tests under `integration/`.
### Integration tests environment considerations
When adding new tests or modifying existing tests under `integration/`, testing
environment should be properly considered. `skip.If` from
[gotest.tools/skip](https://godoc.org/gotest.tools/skip) can be used to make the
environment should be properly considered. [`skip.If`](https://pkg.go.dev/gotest.tools/v3/skip#If) from
[gotest.tools/v3/skip](https://pkg.go.dev/gotest.tools/v3/skip) can be used to make the
test run conditionally. Full testing environment conditions can be found at
[environment.go](https://github.com/moby/moby/blob/6b6eeed03b963a27085ea670f40cd5ff8a61f32e/testutil/environment/environment.go)
[environment.go](https://github.com/moby/moby/blob/311b2c87e125c6d4198014369e313135cf928a8a/testutil/environment/environment.go)
Here is a quick example. If the test needs to interact with a docker daemon on
the same host, the following condition should be checked within the test code
```go
skip.If(t, testEnv.IsRemoteDaemon())
// your integration test code
package example
import (
"testing"
"gotest.tools/v3/skip"
)
func TestSomething(t *testing.T) {
skip.If(t, testEnv.IsRemoteDaemon(), "test requires a local daemon")
// your integration test code
}
```
If a remote daemon is detected, the test will be skipped.
@@ -78,11 +89,11 @@ If a remote daemon is detected, the test will be skipped.
To run the unit test suite:
```
```bash
make test-unit
```
or `hack/test/unit` from inside a `BINDDIR=. make shell` container or properly
or `hack/test/unit` from inside a `make shell` container or properly
configured environment.
The following environment variables may be used to run a subset of tests:
@@ -95,7 +106,7 @@ The following environment variables may be used to run a subset of tests:
To run the integration test suite:
```
```bash
make test-integration
```
@@ -121,6 +132,6 @@ automatically set the other above mentioned environment variables accordingly.
You can change a version of golang used for building stuff that is being tested
by setting `GO_VERSION` variable, for example:
```
make GO_VERSION=1.12.8 test
```bash
make GO_VERSION=1.24.8 test
```

View File

@@ -1,46 +0,0 @@
# Vendoring policies
This document outlines recommended Vendoring policies for Docker repositories.
(Example, libnetwork is a Docker repo and logrus is not.)
## Vendoring using tags
Commit ID based vendoring provides little/no information about the updates
vendored. To fix this, vendors will now require that repositories use annotated
tags along with commit ids to snapshot commits. Annotated tags by themselves
are not sufficient, since the same tag can be force updated to reference
different commits.
Each tag should:
- Follow Semantic Versioning rules (refer to section on "Semantic Versioning")
- Have a corresponding entry in the change tracking document.
Each repo should:
- Have a change tracking document between tags/releases. Ex: CHANGELOG.md,
github releases file.
The goal here is for consuming repos to be able to use the tag version and
changelog updates to determine whether the vendoring will cause any breaking or
backward incompatible changes. This also means that repos can specify having
dependency on a package of a specific version or greater up to the next major
release, without encountering breaking changes.
## Semantic Versioning
Annotated version tags should follow [Semantic Versioning](http://semver.org) policies:
"Given a version number MAJOR.MINOR.PATCH, increment the:
1. MAJOR version when you make incompatible API changes,
2. MINOR version when you add functionality in a backwards-compatible manner, and
3. PATCH version when you make backwards-compatible bug fixes.
Additional labels for pre-release and build metadata are available as extensions
to the MAJOR.MINOR.PATCH format."
## Vendoring cadence
In order to avoid huge vendoring changes, it is recommended to have a regular
cadence for vendoring updates. e.g. monthly.
## Pre-merge vendoring tests
All related repos will be vendored into docker/docker.
CI on docker/docker should catch any breaking changes involving multiple repos.

View File

@@ -1,12 +1,18 @@
# Working on the Engine API
# Engine API
[![PkgGoDev](https://pkg.go.dev/badge/github.com/moby/moby/api)](https://pkg.go.dev/github.com/moby/moby/api)
![GitHub License](https://img.shields.io/github/license/moby/moby)
[![Go Report Card](https://goreportcard.com/badge/github.com/moby/moby/api)](https://goreportcard.com/report/github.com/moby/moby/api)
[![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/moby/moby/badge)](https://scorecard.dev/viewer/?uri=github.com/moby/moby)
[![OpenSSF Best Practices](https://www.bestpractices.dev/projects/10989/badge)](https://www.bestpractices.dev/projects/10989)
The Engine API is an HTTP API used by the command-line client to communicate with the daemon. It can also be used by third-party software to control the daemon.
It consists of various components in this repository:
- `api/swagger.yaml` A Swagger definition of the API.
- `api/types/` Types shared by both the client and server, representing various objects, options, responses, etc. Most are written manually, but some are automatically generated from the Swagger definition. See [#27919](https://github.com/docker/docker/issues/27919) for progress on this.
- `cli/` The command-line client.
- `api/types/` Types shared by both the client and server, representing various objects, options, responses, etc. Most are written manually, but some are automatically generated from the Swagger definition. See [#27919](https://github.com/moby/moby/issues/27919) for progress on this.
- `client/` The Go client used by the command-line client. It can also be used by third-party Go programs.
- `daemon/` The daemon, which serves the API.
@@ -21,6 +27,7 @@ The API is defined by the [Swagger](http://swagger.io/specification/) definition
## Updating the API documentation
The API documentation is generated entirely from `api/swagger.yaml`. If you make updates to the API, edit this file to represent the change in the documentation.
Documentation for each API version can be found in the [docs directory](docs/README.md), which also provides a [CHANGELOG.md](docs/CHANGELOG.md).
The file is split into two main sections:
@@ -29,7 +36,7 @@ The file is split into two main sections:
To make an edit, first look for the endpoint you want to edit under `paths`, then make the required edits. Endpoints may reference reusable objects with `$ref`, which can be found in the `definitions` section.
There is hopefully enough example material in the file for you to copy a similar pattern from elsewhere in the file (e.g. adding new fields or endpoints), but for the full reference, see the [Swagger specification](https://github.com/docker/docker/issues/27919).
There is hopefully enough example material in the file for you to copy a similar pattern from elsewhere in the file (e.g. adding new fields or endpoints), but for the full reference, see the [Swagger specification](https://github.com/moby/moby/issues/27919).
`swagger.yaml` is validated by `hack/validate/swagger` to ensure it is a valid Swagger definition. This is useful when making edits to ensure you are doing the right thing.
@@ -39,4 +46,4 @@ When you make edits to `swagger.yaml`, you may want to check the generated API d
Run `make swagger-docs` and a preview will be running at `http://localhost:9000`. Some of the styling may be incorrect, but you'll be able to ensure that it is generating the correct documentation.
The production documentation is generated by vendoring `swagger.yaml` into [docker/docker.github.io](https://github.com/docker/docker.github.io).
The production documentation is generated by vendoring `swagger.yaml` into [docker/docs](https://github.com/docker/docs).

View File

@@ -1,20 +0,0 @@
package api
// Common constants for daemon and client.
const (
// DefaultVersion of the current REST API.
DefaultVersion = "1.51"
// MinSupportedAPIVersion is the minimum API version that can be supported
// by the API server, specified as "major.minor". Note that the daemon
// may be configured with a different minimum API version, as returned
// in [github.com/docker/docker/api/types.Version.MinAPIVersion].
//
// API requests for API versions lower than the configured version produce
// an error.
MinSupportedAPIVersion = "1.24"
// NoBaseImageSpecifier is the symbol used by the FROM
// command to specify that no base image is to be used.
NoBaseImageSpecifier = "scratch"
)

1100
api/docs/CHANGELOG.md Normal file

File diff suppressed because it is too large Load Diff

26
api/docs/README.md Normal file
View File

@@ -0,0 +1,26 @@
# API Documentation
This directory contains versioned documents for each version of the API
specification supported by this module. While this module provides support
for older API versions, support should be considered "best-effort", especially
for very old versions. Users are recommended to use the latest API versions,
and only rely on older API versions for compatibility with older clients.
Newer API versions tend to be backward-compatible with older versions,
with some exceptions where features were deprecated. For an overview
of changes for each version, refer to [CHANGELOG.md](CHANGELOG.md).
The latest version of the API specification can be found [at the root directory
of this module](../swagger.yaml) which may contain unreleased changes.
For API version v1.24, documentation is only available in markdown
format, for later versions [Swagger (OpenAPI) v2.0](https://swagger.io/specification/v2/)
specifications can be found in this directory. The Moby project itself
primarily uses these swagger files to produce the API documentation;
while we attempt to make these files match the actual implementation,
the OpenAPI 2.0 specification has limitations that prevent us from
expressing all options provided. There may be discrepancies (for which
we welcome contributions). If you find bugs, or discrepancies, please
open a ticket (or pull request).

View File

@@ -310,7 +310,6 @@ Create a container
"Memory": 0,
"MemorySwap": 0,
"MemoryReservation": 0,
"KernelMemory": 0,
"CpuPercent": 80,
"CpuShares": 512,
"CpuPeriod": 100000,
@@ -438,7 +437,6 @@ Create a container
- **MemorySwap** - Total memory limit (memory + swap); set `-1` to enable unlimited swap.
You must use this with `memory` and make the swap value larger than `memory`.
- **MemoryReservation** - Memory soft limit in bytes.
- **KernelMemory** - Kernel memory limit in bytes.
- **CpuPercent** - An integer value containing the usable percentage of the available CPUs. (Windows daemon only)
- **CpuShares** - An integer value containing the container's CPU Shares
(ie. the relative weight vs other containers).
@@ -627,7 +625,6 @@ Return low-level information on the container `id`
"Memory": 0,
"MemorySwap": 0,
"MemoryReservation": 0,
"KernelMemory": 0,
"OomKillDisable": false,
"OomScoreAdj": 500,
"NetworkMode": "bridge",
@@ -1197,7 +1194,6 @@ Update configuration of one or more containers.
"Memory": 314572800,
"MemorySwap": 514288000,
"MemoryReservation": 209715200,
"KernelMemory": 52428800,
"RestartPolicy": {
"MaximumRetryCount": 4,
"Name": "on-failure"
@@ -1830,8 +1826,7 @@ a base64-encoded AuthConfig object.
```
{
"username": "jdoe",
"password": "secret",
"email": "jdoe@acme.com"
"password": "secret"
}
```
@@ -2066,8 +2061,7 @@ The push is cancelled if the HTTP connection is closed.
```
{
"username": "jdoe",
"password": "secret",
"email": "jdoe@acme.com",
"password": "secret"
}
```
@@ -2498,8 +2492,6 @@ Docker daemon report the following event:
Transfer-Encoding: chunked
{
"status": "pull",
"id": "alpine:latest",
"Type": "image",
"Action": "pull",
"Actor": {
@@ -2512,9 +2504,6 @@ Docker daemon report the following event:
"timeNano": 1461943101301854122
}
{
"status": "create",
"id": "ede54ee1afda366ab42f824e8a5ffd195155d853ceaec74a927f249ea270c743",
"from": "alpine",
"Type": "container",
"Action": "create",
"Actor": {
@@ -2529,9 +2518,6 @@ Docker daemon report the following event:
"timeNano": 1461943101381709551
}
{
"status": "attach",
"id": "ede54ee1afda366ab42f824e8a5ffd195155d853ceaec74a927f249ea270c743",
"from": "alpine",
"Type": "container",
"Action": "attach",
"Actor": {
@@ -2560,9 +2546,6 @@ Docker daemon report the following event:
"timeNano": 1461943101394865557
}
{
"status": "start",
"id": "ede54ee1afda366ab42f824e8a5ffd195155d853ceaec74a927f249ea270c743",
"from": "alpine",
"Type": "container",
"Action": "start",
"Actor": {
@@ -2577,9 +2560,6 @@ Docker daemon report the following event:
"timeNano": 1461943101607533796
}
{
"status": "resize",
"id": "ede54ee1afda366ab42f824e8a5ffd195155d853ceaec74a927f249ea270c743",
"from": "alpine",
"Type": "container",
"Action": "resize",
"Actor": {
@@ -2596,9 +2576,6 @@ Docker daemon report the following event:
"timeNano": 1461943101610269268
}
{
"status": "die",
"id": "ede54ee1afda366ab42f824e8a5ffd195155d853ceaec74a927f249ea270c743",
"from": "alpine",
"Type": "container",
"Action": "die",
"Actor": {
@@ -2628,9 +2605,6 @@ Docker daemon report the following event:
"timeNano": 1461943105230860245
}
{
"status": "destroy",
"id": "ede54ee1afda366ab42f824e8a5ffd195155d853ceaec74a927f249ea270c743",
"from": "alpine",
"Type": "container",
"Action": "destroy",
"Actor": {

View File

@@ -60,7 +60,6 @@ info:
{
"username": "string",
"password": "string",
"email": "string",
"serveraddress": "string"
}
```
@@ -432,10 +431,6 @@ definitions:
description: "Disk limit (in bytes)."
type: "integer"
format: "int64"
KernelMemory:
description: "Kernel memory limit in bytes."
type: "integer"
format: "int64"
MemoryReservation:
description: "Memory soft limit in bytes."
type: "integer"
@@ -984,6 +979,10 @@ definitions:
password:
type: "string"
email:
description: |
Email is an optional value associated with the username.
> **Deprecated**: This field is deprecated since docker 1.11 (API v1.23) and will be removed in a future release.
type: "string"
serveraddress:
type: "string"
@@ -1975,6 +1974,7 @@ definitions:
ForceUpdate:
description: "A counter that triggers an update even if no relevant parameters have been changed."
type: "integer"
format: "uint64"
Networks:
type: "array"
items:
@@ -2712,7 +2712,6 @@ paths:
Memory: 0
MemorySwap: 0
MemoryReservation: 0
KernelMemory: 0
NanoCpus: 500000
CpuPercent: 80
CpuShares: 512
@@ -3012,7 +3011,6 @@ paths:
Memory: 0
MemorySwap: 0
MemoryReservation: 0
KernelMemory: 0
OomKillDisable: false
OomScoreAdj: 500
NetworkMode: "bridge"
@@ -3693,7 +3691,6 @@ paths:
Memory: 314572800
MemorySwap: 514288000
MemoryReservation: 209715200
KernelMemory: 52428800
RestartPolicy:
MaximumRetryCount: 4
Name: "on-failure"
@@ -5100,7 +5097,6 @@ paths:
IndexServerAddress: "https://index.docker.io/v1/"
InitPath: "/usr/bin/docker"
InitSha1: ""
KernelMemory: true
KernelVersion: "3.12.0-1-amd64"
Labels:
- "storage=ssd"

View File

@@ -60,7 +60,6 @@ info:
{
"username": "string",
"password": "string",
"email": "string",
"serveraddress": "string"
}
```
@@ -432,10 +431,6 @@ definitions:
description: "Disk limit (in bytes)."
type: "integer"
format: "int64"
KernelMemory:
description: "Kernel memory limit in bytes."
type: "integer"
format: "int64"
MemoryReservation:
description: "Memory soft limit in bytes."
type: "integer"
@@ -984,6 +979,10 @@ definitions:
password:
type: "string"
email:
description: |
Email is an optional value associated with the username.
> **Deprecated**: This field is deprecated since docker 1.11 (API v1.23) and will be removed in a future release.
type: "string"
serveraddress:
type: "string"
@@ -1979,6 +1978,7 @@ definitions:
ForceUpdate:
description: "A counter that triggers an update even if no relevant parameters have been changed."
type: "integer"
format: "uint64"
Networks:
type: "array"
items:
@@ -2716,7 +2716,6 @@ paths:
Memory: 0
MemorySwap: 0
MemoryReservation: 0
KernelMemory: 0
NanoCpus: 500000
CpuPercent: 80
CpuShares: 512

View File

@@ -60,7 +60,6 @@ info:
{
"username": "string",
"password": "string",
"email": "string",
"serveraddress": "string"
}
```
@@ -434,10 +433,6 @@ definitions:
description: "Disk limit (in bytes)."
type: "integer"
format: "int64"
KernelMemory:
description: "Kernel memory limit in bytes."
type: "integer"
format: "int64"
MemoryReservation:
description: "Memory soft limit in bytes."
type: "integer"
@@ -989,6 +984,10 @@ definitions:
password:
type: "string"
email:
description: |
Email is an optional value associated with the username.
> **Deprecated**: This field is deprecated since docker 1.11 (API v1.23) and will be removed in a future release.
type: "string"
serveraddress:
type: "string"
@@ -2051,6 +2050,7 @@ definitions:
ForceUpdate:
description: "A counter that triggers an update even if no relevant parameters have been changed."
type: "integer"
format: "uint64"
Networks:
type: "array"
items:
@@ -2775,7 +2775,6 @@ paths:
Memory: 0
MemorySwap: 0
MemoryReservation: 0
KernelMemory: 0
NanoCpus: 500000
CpuPercent: 80
CpuShares: 512
@@ -3075,7 +3074,6 @@ paths:
Memory: 0
MemorySwap: 0
MemoryReservation: 0
KernelMemory: 0
OomKillDisable: false
OomScoreAdj: 500
NetworkMode: "bridge"

View File

@@ -60,7 +60,6 @@ info:
{
"username": "string",
"password": "string",
"email": "string",
"serveraddress": "string"
}
```
@@ -440,10 +439,6 @@ definitions:
description: "Disk limit (in bytes)."
type: "integer"
format: "int64"
KernelMemory:
description: "Kernel memory limit in bytes."
type: "integer"
format: "int64"
MemoryReservation:
description: "Memory soft limit in bytes."
type: "integer"
@@ -1027,6 +1022,10 @@ definitions:
password:
type: "string"
email:
description: |
Email is an optional value associated with the username.
> **Deprecated**: This field is deprecated since docker 1.11 (API v1.23) and will be removed in a future release.
type: "string"
serveraddress:
type: "string"
@@ -2104,6 +2103,7 @@ definitions:
ForceUpdate:
description: "A counter that triggers an update even if no relevant parameters have been changed."
type: "integer"
format: "uint64"
Networks:
type: "array"
items:
@@ -2864,7 +2864,6 @@ paths:
Memory: 0
MemorySwap: 0
MemoryReservation: 0
KernelMemory: 0
NanoCpus: 500000
CpuPercent: 80
CpuShares: 512
@@ -3164,7 +3163,6 @@ paths:
Memory: 0
MemorySwap: 0
MemoryReservation: 0
KernelMemory: 0
OomKillDisable: false
OomScoreAdj: 500
NetworkMode: "bridge"
@@ -3855,7 +3853,6 @@ paths:
Memory: 314572800
MemorySwap: 514288000
MemoryReservation: 209715200
KernelMemory: 52428800
RestartPolicy:
MaximumRetryCount: 4
Name: "on-failure"
@@ -5287,7 +5284,6 @@ paths:
IndexServerAddress: "https://index.docker.io/v1/"
InitPath: "/usr/bin/docker"
InitSha1: ""
KernelMemory: true
KernelVersion: "3.12.0-1-amd64"
Labels:
- "storage=ssd"

View File

@@ -60,7 +60,6 @@ info:
{
"username": "string",
"password": "string",
"email": "string",
"serveraddress": "string"
}
```
@@ -443,10 +442,6 @@ definitions:
description: "Disk limit (in bytes)."
type: "integer"
format: "int64"
KernelMemory:
description: "Kernel memory limit in bytes."
type: "integer"
format: "int64"
MemoryReservation:
description: "Memory soft limit in bytes."
type: "integer"
@@ -1033,6 +1028,10 @@ definitions:
password:
type: "string"
email:
description: |
Email is an optional value associated with the username.
> **Deprecated**: This field is deprecated since docker 1.11 (API v1.23) and will be removed in a future release.
type: "string"
serveraddress:
type: "string"
@@ -2125,6 +2124,7 @@ definitions:
ForceUpdate:
description: "A counter that triggers an update even if no relevant parameters have been changed."
type: "integer"
format: "uint64"
Networks:
type: "array"
items:
@@ -2897,7 +2897,6 @@ paths:
Memory: 0
MemorySwap: 0
MemoryReservation: 0
KernelMemory: 0
NanoCpus: 500000
CpuPercent: 80
CpuShares: 512
@@ -3197,7 +3196,6 @@ paths:
Memory: 0
MemorySwap: 0
MemoryReservation: 0
KernelMemory: 0
OomKillDisable: false
OomScoreAdj: 500
NetworkMode: "bridge"
@@ -3888,7 +3886,6 @@ paths:
Memory: 314572800
MemorySwap: 514288000
MemoryReservation: 209715200
KernelMemory: 52428800
RestartPolicy:
MaximumRetryCount: 4
Name: "on-failure"
@@ -5320,7 +5317,6 @@ paths:
IndexServerAddress: "https://index.docker.io/v1/"
InitPath: "/usr/bin/docker"
InitSha1: ""
KernelMemory: true
KernelVersion: "3.12.0-1-amd64"
Labels:
- "storage=ssd"

View File

@@ -60,7 +60,6 @@ info:
{
"username": "string",
"password": "string",
"email": "string",
"serveraddress": "string"
}
```
@@ -445,10 +444,6 @@ definitions:
description: "Disk limit (in bytes)."
type: "integer"
format: "int64"
KernelMemory:
description: "Kernel memory limit in bytes."
type: "integer"
format: "int64"
MemoryReservation:
description: "Memory soft limit in bytes."
type: "integer"
@@ -1043,6 +1038,10 @@ definitions:
password:
type: "string"
email:
description: |
Email is an optional value associated with the username.
> **Deprecated**: This field is deprecated since docker 1.11 (API v1.23) and will be removed in a future release.
type: "string"
serveraddress:
type: "string"
@@ -2303,6 +2302,7 @@ definitions:
ForceUpdate:
description: "A counter that triggers an update even if no relevant parameters have been changed."
type: "integer"
format: "uint64"
Runtime:
description: "Runtime is the type of runtime specified for the task executor."
type: "string"
@@ -3110,7 +3110,6 @@ paths:
Memory: 0
MemorySwap: 0
MemoryReservation: 0
KernelMemory: 0
NanoCpus: 500000
CpuPercent: 80
CpuShares: 512

View File

@@ -60,7 +60,6 @@ info:
{
"username": "string",
"password": "string",
"email": "string",
"serveraddress": "string"
}
```
@@ -445,10 +444,6 @@ definitions:
description: "Disk limit (in bytes)."
type: "integer"
format: "int64"
KernelMemory:
description: "Kernel memory limit in bytes."
type: "integer"
format: "int64"
MemoryReservation:
description: "Memory soft limit in bytes."
type: "integer"
@@ -1049,6 +1044,10 @@ definitions:
password:
type: "string"
email:
description: |
Email is an optional value associated with the username.
> **Deprecated**: This field is deprecated since docker 1.11 (API v1.23) and will be removed in a future release.
type: "string"
serveraddress:
type: "string"
@@ -2332,6 +2331,7 @@ definitions:
ForceUpdate:
description: "A counter that triggers an update even if no relevant parameters have been changed."
type: "integer"
format: "uint64"
Runtime:
description: "Runtime is the type of runtime specified for the task executor."
type: "string"
@@ -2861,7 +2861,7 @@ definitions:
([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5)) string.
It must be empty if the Driver field is set, in which case the data is
loaded from an external secret store. The maximum allowed size is 500KB,
as defined in [MaxSecretSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0-20250103191802-8c1959736554/api/validation#MaxSecretSize).
as defined in [MaxSecretSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0/api/validation#MaxSecretSize).
This field is only used to _create_ a secret, and is not returned by
other endpoints.
@@ -3183,7 +3183,6 @@ paths:
Memory: 0
MemorySwap: 0
MemoryReservation: 0
KernelMemory: 0
NanoCpus: 500000
CpuPercent: 80
CpuShares: 512

View File

@@ -60,7 +60,6 @@ info:
{
"username": "string",
"password": "string",
"email": "string",
"serveraddress": "string"
}
```
@@ -449,10 +448,6 @@ definitions:
description: "Disk limit (in bytes)."
type: "integer"
format: "int64"
KernelMemory:
description: "Kernel memory limit in bytes."
type: "integer"
format: "int64"
MemoryReservation:
description: "Memory soft limit in bytes."
type: "integer"
@@ -1308,6 +1303,10 @@ definitions:
password:
type: "string"
email:
description: |
Email is an optional value associated with the username.
> **Deprecated**: This field is deprecated since docker 1.11 (API v1.23) and will be removed in a future release.
type: "string"
serveraddress:
type: "string"
@@ -2783,6 +2782,7 @@ definitions:
ForceUpdate:
description: "A counter that triggers an update even if no relevant parameters have been changed."
type: "integer"
format: "uint64"
Runtime:
description: "Runtime is the type of runtime specified for the task executor."
type: "string"
@@ -3333,7 +3333,7 @@ definitions:
([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5)) string.
It must be empty if the Driver field is set, in which case the data is
loaded from an external secret store. The maximum allowed size is 500KB,
as defined in [MaxSecretSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0-20250103191802-8c1959736554/api/validation#MaxSecretSize).
as defined in [MaxSecretSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0/api/validation#MaxSecretSize).
This field is only used to _create_ a secret, and is not returned by
other endpoints.
@@ -3518,10 +3518,6 @@ definitions:
description: "Indicates if the host has memory swap limit support enabled."
type: "boolean"
example: true
KernelMemory:
description: "Indicates if the host has kernel memory limit support enabled."
type: "boolean"
example: true
CpuCfsPeriod:
description: "Indicates if CPU CFS(Completely Fair Scheduler) period is supported by the host."
type: "boolean"
@@ -4395,7 +4391,6 @@ paths:
Memory: 0
MemorySwap: 0
MemoryReservation: 0
KernelMemory: 0
NanoCpus: 500000
CpuPercent: 80
CpuShares: 512
@@ -4703,7 +4698,6 @@ paths:
Memory: 0
MemorySwap: 0
MemoryReservation: 0
KernelMemory: 0
OomKillDisable: false
OomScoreAdj: 500
NetworkMode: "bridge"
@@ -5392,7 +5386,6 @@ paths:
Memory: 314572800
MemorySwap: 514288000
MemoryReservation: 209715200
KernelMemory: 52428800
RestartPolicy:
MaximumRetryCount: 4
Name: "on-failure"

View File

@@ -60,7 +60,6 @@ info:
{
"username": "string",
"password": "string",
"email": "string",
"serveraddress": "string"
}
```
@@ -453,10 +452,6 @@ definitions:
description: "Disk limit (in bytes)."
type: "integer"
format: "int64"
KernelMemory:
description: "Kernel memory limit in bytes."
type: "integer"
format: "int64"
MemoryReservation:
description: "Memory soft limit in bytes."
type: "integer"
@@ -1312,6 +1307,10 @@ definitions:
password:
type: "string"
email:
description: |
Email is an optional value associated with the username.
> **Deprecated**: This field is deprecated since docker 1.11 (API v1.23) and will be removed in a future release.
type: "string"
serveraddress:
type: "string"
@@ -2787,6 +2786,7 @@ definitions:
ForceUpdate:
description: "A counter that triggers an update even if no relevant parameters have been changed."
type: "integer"
format: "uint64"
Runtime:
description: "Runtime is the type of runtime specified for the task executor."
type: "string"
@@ -3337,7 +3337,7 @@ definitions:
([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5)) string.
It must be empty if the Driver field is set, in which case the data is
loaded from an external secret store. The maximum allowed size is 500KB,
as defined in [MaxSecretSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0-20250103191802-8c1959736554/api/validation#MaxSecretSize).
as defined in [MaxSecretSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0/api/validation#MaxSecretSize).
This field is only used to _create_ a secret, and is not returned by
other endpoints.
@@ -3522,10 +3522,6 @@ definitions:
description: "Indicates if the host has memory swap limit support enabled."
type: "boolean"
example: true
KernelMemory:
description: "Indicates if the host has kernel memory limit support enabled."
type: "boolean"
example: true
CpuCfsPeriod:
description: "Indicates if CPU CFS(Completely Fair Scheduler) period is supported by the host."
type: "boolean"
@@ -4399,7 +4395,6 @@ paths:
Memory: 0
MemorySwap: 0
MemoryReservation: 0
KernelMemory: 0
NanoCpus: 500000
CpuPercent: 80
CpuShares: 512
@@ -4707,7 +4702,6 @@ paths:
Memory: 0
MemorySwap: 0
MemoryReservation: 0
KernelMemory: 0
OomKillDisable: false
OomScoreAdj: 500
NetworkMode: "bridge"
@@ -5396,7 +5390,6 @@ paths:
Memory: 314572800
MemorySwap: 514288000
MemoryReservation: 209715200
KernelMemory: 52428800
RestartPolicy:
MaximumRetryCount: 4
Name: "on-failure"

View File

@@ -62,7 +62,6 @@ info:
{
"username": "string",
"password": "string",
"email": "string",
"serveraddress": "string"
}
```
@@ -455,10 +454,6 @@ definitions:
description: "Disk limit (in bytes)."
type: "integer"
format: "int64"
KernelMemory:
description: "Kernel memory limit in bytes."
type: "integer"
format: "int64"
MemoryReservation:
description: "Memory soft limit in bytes."
type: "integer"
@@ -1322,6 +1317,10 @@ definitions:
password:
type: "string"
email:
description: |
Email is an optional value associated with the username.
> **Deprecated**: This field is deprecated since docker 1.11 (API v1.23) and will be removed in a future release.
type: "string"
serveraddress:
type: "string"
@@ -2797,6 +2796,7 @@ definitions:
ForceUpdate:
description: "A counter that triggers an update even if no relevant parameters have been changed."
type: "integer"
format: "uint64"
Runtime:
description: "Runtime is the type of runtime specified for the task executor."
type: "string"
@@ -3365,7 +3365,7 @@ definitions:
([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5)) string.
It must be empty if the Driver field is set, in which case the data is
loaded from an external secret store. The maximum allowed size is 500KB,
as defined in [MaxSecretSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0-20250103191802-8c1959736554/api/validation#MaxSecretSize).
as defined in [MaxSecretSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0/api/validation#MaxSecretSize).
This field is only used to _create_ a secret, and is not returned by
other endpoints.
@@ -3550,10 +3550,6 @@ definitions:
description: "Indicates if the host has memory swap limit support enabled."
type: "boolean"
example: true
KernelMemory:
description: "Indicates if the host has kernel memory limit support enabled."
type: "boolean"
example: true
CpuCfsPeriod:
description: "Indicates if CPU CFS(Completely Fair Scheduler) period is supported by the host."
type: "boolean"
@@ -4427,7 +4423,6 @@ paths:
Memory: 0
MemorySwap: 0
MemoryReservation: 0
KernelMemory: 0
NanoCpus: 500000
CpuPercent: 80
CpuShares: 512
@@ -4735,7 +4730,6 @@ paths:
Memory: 0
MemorySwap: 0
MemoryReservation: 0
KernelMemory: 0
OomKillDisable: false
OomScoreAdj: 500
NetworkMode: "bridge"
@@ -5424,7 +5418,6 @@ paths:
Memory: 314572800
MemorySwap: 514288000
MemoryReservation: 209715200
KernelMemory: 52428800
RestartPolicy:
MaximumRetryCount: 4
Name: "on-failure"

View File

@@ -71,7 +71,6 @@ info:
{
"username": "string",
"password": "string",
"email": "string",
"serveraddress": "string"
}
```
@@ -466,10 +465,6 @@ definitions:
description: "Disk limit (in bytes)."
type: "integer"
format: "int64"
KernelMemory:
description: "Kernel memory limit in bytes."
type: "integer"
format: "int64"
MemoryReservation:
description: "Memory soft limit in bytes."
type: "integer"
@@ -1319,6 +1314,10 @@ definitions:
password:
type: "string"
email:
description: |
Email is an optional value associated with the username.
> **Deprecated**: This field is deprecated since docker 1.11 (API v1.23) and will be removed in a future release.
type: "string"
serveraddress:
type: "string"
@@ -2801,6 +2800,7 @@ definitions:
ForceUpdate:
description: "A counter that triggers an update even if no relevant parameters have been changed."
type: "integer"
format: "uint64"
Runtime:
description: "Runtime is the type of runtime specified for the task executor."
type: "string"
@@ -3369,7 +3369,7 @@ definitions:
([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5)) string.
It must be empty if the Driver field is set, in which case the data is
loaded from an external secret store. The maximum allowed size is 500KB,
as defined in [MaxSecretSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0-20250103191802-8c1959736554/api/validation#MaxSecretSize).
as defined in [MaxSecretSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0/api/validation#MaxSecretSize).
This field is only used to _create_ a secret, and is not returned by
other endpoints.
@@ -3554,10 +3554,6 @@ definitions:
description: "Indicates if the host has memory swap limit support enabled."
type: "boolean"
example: true
KernelMemory:
description: "Indicates if the host has kernel memory limit support enabled."
type: "boolean"
example: true
CpuCfsPeriod:
description: "Indicates if CPU CFS(Completely Fair Scheduler) period is supported by the host."
type: "boolean"
@@ -4431,7 +4427,6 @@ paths:
Memory: 0
MemorySwap: 0
MemoryReservation: 0
KernelMemory: 0
NanoCpus: 500000
CpuPercent: 80
CpuShares: 512
@@ -4739,7 +4734,6 @@ paths:
Memory: 0
MemorySwap: 0
MemoryReservation: 0
KernelMemory: 0
OomKillDisable: false
OomScoreAdj: 500
NetworkMode: "bridge"
@@ -5433,7 +5427,6 @@ paths:
Memory: 314572800
MemorySwap: 514288000
MemoryReservation: 209715200
KernelMemory: 52428800
RestartPolicy:
MaximumRetryCount: 4
Name: "on-failure"

View File

@@ -71,7 +71,6 @@ info:
{
"username": "string",
"password": "string",
"email": "string",
"serveraddress": "string"
}
```
@@ -1319,6 +1318,10 @@ definitions:
password:
type: "string"
email:
description: |
Email is an optional value associated with the username.
> **Deprecated**: This field is deprecated since docker 1.11 (API v1.23) and will be removed in a future release.
type: "string"
serveraddress:
type: "string"
@@ -2814,6 +2817,7 @@ definitions:
ForceUpdate:
description: "A counter that triggers an update even if no relevant parameters have been changed."
type: "integer"
format: "uint64"
Runtime:
description: "Runtime is the type of runtime specified for the task executor."
type: "string"
@@ -3382,7 +3386,7 @@ definitions:
([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5)) string.
It must be empty if the Driver field is set, in which case the data is
loaded from an external secret store. The maximum allowed size is 500KB,
as defined in [MaxSecretSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0-20250103191802-8c1959736554/api/validation#MaxSecretSize).
as defined in [MaxSecretSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0/api/validation#MaxSecretSize).
This field is only used to _create_ a secret, and is not returned by
other endpoints.

View File

@@ -71,7 +71,6 @@ info:
{
"username": "string",
"password": "string",
"email": "string",
"serveraddress": "string"
}
```
@@ -1322,6 +1321,10 @@ definitions:
password:
type: "string"
email:
description: |
Email is an optional value associated with the username.
> **Deprecated**: This field is deprecated since docker 1.11 (API v1.23) and will be removed in a future release.
type: "string"
serveraddress:
type: "string"
@@ -2817,6 +2820,7 @@ definitions:
ForceUpdate:
description: "A counter that triggers an update even if no relevant parameters have been changed."
type: "integer"
format: "uint64"
Runtime:
description: "Runtime is the type of runtime specified for the task executor."
type: "string"
@@ -3388,7 +3392,7 @@ definitions:
([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5)) string.
It must be empty if the Driver field is set, in which case the data is
loaded from an external secret store. The maximum allowed size is 500KB,
as defined in [MaxSecretSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0-20250103191802-8c1959736554/api/validation#MaxSecretSize).
as defined in [MaxSecretSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0/api/validation#MaxSecretSize).
This field is only used to _create_ a secret, and is not returned by
other endpoints.

View File

@@ -71,7 +71,6 @@ info:
{
"username": "string",
"password": "string",
"email": "string",
"serveraddress": "string"
}
```
@@ -467,10 +466,6 @@ definitions:
description: "Disk limit (in bytes)."
type: "integer"
format: "int64"
KernelMemory:
description: "Kernel memory limit in bytes."
type: "integer"
format: "int64"
MemoryReservation:
description: "Memory soft limit in bytes."
type: "integer"
@@ -1333,6 +1328,10 @@ definitions:
password:
type: "string"
email:
description: |
Email is an optional value associated with the username.
> **Deprecated**: This field is deprecated since docker 1.11 (API v1.23) and will be removed in a future release.
type: "string"
serveraddress:
type: "string"
@@ -2871,6 +2870,7 @@ definitions:
ForceUpdate:
description: "A counter that triggers an update even if no relevant parameters have been changed."
type: "integer"
format: "uint64"
Runtime:
description: "Runtime is the type of runtime specified for the task executor."
type: "string"
@@ -3442,7 +3442,7 @@ definitions:
([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5)) string.
It must be empty if the Driver field is set, in which case the data is
loaded from an external secret store. The maximum allowed size is 500KB,
as defined in [MaxSecretSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0-20250103191802-8c1959736554/api/validation#MaxSecretSize).
as defined in [MaxSecretSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0/api/validation#MaxSecretSize).
This field is only used to _create_ a secret, and is not returned by
other endpoints.
@@ -3641,10 +3641,6 @@ definitions:
description: "Indicates if the host has memory swap limit support enabled."
type: "boolean"
example: true
KernelMemory:
description: "Indicates if the host has kernel memory limit support enabled."
type: "boolean"
example: true
CpuCfsPeriod:
description: "Indicates if CPU CFS(Completely Fair Scheduler) period is supported by the host."
type: "boolean"
@@ -4518,7 +4514,6 @@ paths:
Memory: 0
MemorySwap: 0
MemoryReservation: 0
KernelMemory: 0
NanoCpus: 500000
CpuPercent: 80
CpuShares: 512
@@ -4836,7 +4831,6 @@ paths:
Memory: 0
MemorySwap: 0
MemoryReservation: 0
KernelMemory: 0
OomKillDisable: false
OomScoreAdj: 500
NetworkMode: "bridge"
@@ -5543,7 +5537,6 @@ paths:
Memory: 314572800
MemorySwap: 514288000
MemoryReservation: 209715200
KernelMemory: 52428800
RestartPolicy:
MaximumRetryCount: 4
Name: "on-failure"

View File

@@ -81,7 +81,6 @@ info:
{
"username": "string",
"password": "string",
"email": "string",
"serveraddress": "string"
}
```
@@ -530,11 +529,6 @@ definitions:
description: "Disk limit (in bytes)."
type: "integer"
format: "int64"
KernelMemory:
description: "Kernel memory limit in bytes."
type: "integer"
format: "int64"
example: 209715200
MemoryReservation:
description: "Memory soft limit in bytes."
type: "integer"
@@ -2109,6 +2103,10 @@ definitions:
password:
type: "string"
email:
description: |
Email is an optional value associated with the username.
> **Deprecated**: This field is deprecated since docker 1.11 (API v1.23) and will be removed in a future release.
type: "string"
serveraddress:
type: "string"
@@ -3913,6 +3911,7 @@ definitions:
A counter that triggers an update even if no relevant parameters have
been changed.
type: "integer"
format: "uint64"
Runtime:
description: |
Runtime is the type of runtime specified for the task executor.
@@ -4503,7 +4502,7 @@ definitions:
([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5)) string.
It must be empty if the Driver field is set, in which case the data is
loaded from an external secret store. The maximum allowed size is 500KB,
as defined in [MaxSecretSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0-20250103191802-8c1959736554/api/validation#MaxSecretSize).
as defined in [MaxSecretSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0/api/validation#MaxSecretSize).
This field is only used to _create_ a secret, and is not returned by
other endpoints.
@@ -4889,10 +4888,6 @@ definitions:
description: "Indicates if the host has memory swap limit support enabled."
type: "boolean"
example: true
KernelMemory:
description: "Indicates if the host has kernel memory limit support enabled."
type: "boolean"
example: true
CpuCfsPeriod:
description: |
Indicates if CPU CFS(Completely Fair Scheduler) period is supported by
@@ -5823,7 +5818,6 @@ paths:
Memory: 0
MemorySwap: 0
MemoryReservation: 0
KernelMemory: 0
NanoCpus: 500000
CpuPercent: 80
CpuShares: 512
@@ -6097,7 +6091,6 @@ paths:
Memory: 0
MemorySwap: 0
MemoryReservation: 0
KernelMemory: 0
OomKillDisable: false
OomScoreAdj: 500
NetworkMode: "bridge"
@@ -6835,7 +6828,6 @@ paths:
Memory: 314572800
MemorySwap: 514288000
MemoryReservation: 209715200
KernelMemory: 52428800
RestartPolicy:
MaximumRetryCount: 4
Name: "on-failure"

View File

@@ -81,7 +81,6 @@ info:
{
"username": "string",
"password": "string",
"email": "string",
"serveraddress": "string"
}
```
@@ -2169,6 +2168,10 @@ definitions:
password:
type: "string"
email:
description: |
Email is an optional value associated with the username.
> **Deprecated**: This field is deprecated since docker 1.11 (API v1.23) and will be removed in a future release.
type: "string"
serveraddress:
type: "string"
@@ -4039,6 +4042,7 @@ definitions:
A counter that triggers an update even if no relevant parameters have
been changed.
type: "integer"
format: "uint64"
Runtime:
description: |
Runtime is the type of runtime specified for the task executor.
@@ -4627,7 +4631,7 @@ definitions:
([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5)) string.
It must be empty if the Driver field is set, in which case the data is
loaded from an external secret store. The maximum allowed size is 500KB,
as defined in [MaxSecretSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0-20250103191802-8c1959736554/api/validation#MaxSecretSize).
as defined in [MaxSecretSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0/api/validation#MaxSecretSize).
This field is only used to _create_ a secret, and is not returned by
other endpoints.
@@ -7948,7 +7952,18 @@ paths:
default: ""
- name: "outputs"
in: "query"
description: "BuildKit output configuration"
description: |
BuildKit output configuration in the format of a stringified JSON array of objects.
Each object must have two top-level properties: `Type` and `Attrs`.
The `Type` property must be set to 'moby'.
The `Attrs` property is a map of attributes for the BuildKit output configuration.
See https://docs.docker.com/build/exporters/oci-docker/ for more information.
Example:
```
[{"Type":"moby","Attrs":{"type":"image","force-compression":"true","compression":"zstd"}}]
```
type: "string"
default: ""
- name: "version"

View File

@@ -81,7 +81,6 @@ info:
{
"username": "string",
"password": "string",
"email": "string",
"serveraddress": "string"
}
```
@@ -2200,6 +2199,10 @@ definitions:
password:
type: "string"
email:
description: |
Email is an optional value associated with the username.
> **Deprecated**: This field is deprecated since docker 1.11 (API v1.23) and will be removed in a future release.
type: "string"
serveraddress:
type: "string"
@@ -4204,6 +4207,7 @@ definitions:
A counter that triggers an update even if no relevant parameters have
been changed.
type: "integer"
format: "uint64"
Runtime:
description: |
Runtime is the type of runtime specified for the task executor.
@@ -4876,7 +4880,7 @@ definitions:
([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5)) string.
It must be empty if the Driver field is set, in which case the data is
loaded from an external secret store. The maximum allowed size is 500KB,
as defined in [MaxSecretSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0-20250103191802-8c1959736554/api/validation#MaxSecretSize).
as defined in [MaxSecretSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0/api/validation#MaxSecretSize).
This field is only used to _create_ a secret, and is not returned by
other endpoints.
@@ -8237,7 +8241,18 @@ paths:
default: ""
- name: "outputs"
in: "query"
description: "BuildKit output configuration"
description: |
BuildKit output configuration in the format of a stringified JSON array of objects.
Each object must have two top-level properties: `Type` and `Attrs`.
The `Type` property must be set to 'moby'.
The `Attrs` property is a map of attributes for the BuildKit output configuration.
See https://docs.docker.com/build/exporters/oci-docker/ for more information.
Example:
```
[{"Type":"moby","Attrs":{"type":"image","force-compression":"true","compression":"zstd"}}]
```
type: "string"
default: ""
- name: "version"

View File

@@ -81,7 +81,6 @@ info:
{
"username": "string",
"password": "string",
"email": "string",
"serveraddress": "string"
}
```
@@ -2203,6 +2202,10 @@ definitions:
password:
type: "string"
email:
description: |
Email is an optional value associated with the username.
> **Deprecated**: This field is deprecated since docker 1.11 (API v1.23) and will be removed in a future release.
type: "string"
serveraddress:
type: "string"
@@ -2616,14 +2619,6 @@ definitions:
description: |
Unique ID of the build cache record.
example: "ndlpt0hhvkqcdfkputsk4cq9c"
Parent:
description: |
ID of the parent build cache record.
> **Deprecated**: This field is deprecated, and omitted if empty.
type: "string"
x-nullable: true
example: ""
Parents:
description: |
List of parent build cache record IDs.
@@ -4223,6 +4218,7 @@ definitions:
A counter that triggers an update even if no relevant parameters have
been changed.
type: "integer"
format: "uint64"
Runtime:
description: |
Runtime is the type of runtime specified for the task executor.
@@ -4895,7 +4891,7 @@ definitions:
([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5)) string.
It must be empty if the Driver field is set, in which case the data is
loaded from an external secret store. The maximum allowed size is 500KB,
as defined in [MaxSecretSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0-20250103191802-8c1959736554/api/validation#MaxSecretSize).
as defined in [MaxSecretSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0/api/validation#MaxSecretSize).
This field is only used to _create_ a secret, and is not returned by
other endpoints.
@@ -8487,7 +8483,18 @@ paths:
default: ""
- name: "outputs"
in: "query"
description: "BuildKit output configuration"
description: |
BuildKit output configuration in the format of a stringified JSON array of objects.
Each object must have two top-level properties: `Type` and `Attrs`.
The `Type` property must be set to 'moby'.
The `Attrs` property is a map of attributes for the BuildKit output configuration.
See https://docs.docker.com/build/exporters/oci-docker/ for more information.
Example:
```
[{"Type":"moby","Attrs":{"type":"image","force-compression":"true","compression":"zstd"}}]
```
type: "string"
default: ""
- name: "version"

View File

@@ -81,7 +81,6 @@ info:
{
"username": "string",
"password": "string",
"email": "string",
"serveraddress": "string"
}
```
@@ -2234,6 +2233,10 @@ definitions:
password:
type: "string"
email:
description: |
Email is an optional value associated with the username.
> **Deprecated**: This field is deprecated since docker 1.11 (API v1.23) and will be removed in a future release.
type: "string"
serveraddress:
type: "string"
@@ -2647,14 +2650,6 @@ definitions:
description: |
Unique ID of the build cache record.
example: "ndlpt0hhvkqcdfkputsk4cq9c"
Parent:
description: |
ID of the parent build cache record.
> **Deprecated**: This field is deprecated, and omitted if empty.
type: "string"
x-nullable: true
example: ""
Parents:
description: |
List of parent build cache record IDs.
@@ -4254,6 +4249,7 @@ definitions:
A counter that triggers an update even if no relevant parameters have
been changed.
type: "integer"
format: "uint64"
Runtime:
description: |
Runtime is the type of runtime specified for the task executor.
@@ -4926,7 +4922,7 @@ definitions:
([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5)) string.
It must be empty if the Driver field is set, in which case the data is
loaded from an external secret store. The maximum allowed size is 500KB,
as defined in [MaxSecretSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0-20250103191802-8c1959736554/api/validation#MaxSecretSize).
as defined in [MaxSecretSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0/api/validation#MaxSecretSize).
This field is only used to _create_ a secret, and is not returned by
other endpoints.
@@ -8505,7 +8501,18 @@ paths:
default: ""
- name: "outputs"
in: "query"
description: "BuildKit output configuration"
description: |
BuildKit output configuration in the format of a stringified JSON array of objects.
Each object must have two top-level properties: `Type` and `Attrs`.
The `Type` property must be set to 'moby'.
The `Attrs` property is a map of attributes for the BuildKit output configuration.
See https://docs.docker.com/build/exporters/oci-docker/ for more information.
Example:
```
[{"Type":"moby","Attrs":{"type":"image","force-compression":"true","compression":"zstd"}}]
```
type: "string"
default: ""
- name: "version"

View File

@@ -81,7 +81,6 @@ info:
{
"username": "string",
"password": "string",
"email": "string",
"serveraddress": "string"
}
```
@@ -2086,14 +2085,6 @@ definitions:
format: "int64"
x-nullable: false
example: 1239828
VirtualSize:
description: |
Total size of the image including all layers it is composed of.
Deprecated: this field is omitted in API v1.44, but kept for backward compatibility. Use Size instead.
type: "integer"
format: "int64"
example: 1239828
GraphDriver:
$ref: "#/definitions/GraphDriverData"
RootFS:
@@ -2225,14 +2216,6 @@ definitions:
format: "int64"
x-nullable: false
example: 1239828
VirtualSize:
description: |-
Total size of the image including all layers it is composed of.
Deprecated: this field is omitted in API v1.44, but kept for backward compatibility. Use Size instead.
type: "integer"
format: "int64"
example: 172064416
Labels:
description: "User-defined key/value metadata."
type: "object"
@@ -2261,6 +2244,10 @@ definitions:
password:
type: "string"
email:
description: |
Email is an optional value associated with the username.
> **Deprecated**: This field is deprecated since docker 1.11 (API v1.23) and will be removed in a future release.
type: "string"
serveraddress:
type: "string"
@@ -2674,14 +2661,6 @@ definitions:
description: |
Unique ID of the build cache record.
example: "ndlpt0hhvkqcdfkputsk4cq9c"
Parent:
description: |
ID of the parent build cache record.
> **Deprecated**: This field is deprecated, and omitted if empty.
type: "string"
x-nullable: true
example: ""
Parents:
description: |
List of parent build cache record IDs.
@@ -4322,6 +4301,7 @@ definitions:
A counter that triggers an update even if no relevant parameters have
been changed.
type: "integer"
format: "uint64"
Runtime:
description: |
Runtime is the type of runtime specified for the task executor.
@@ -5041,7 +5021,7 @@ definitions:
([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5)) string.
It must be empty if the Driver field is set, in which case the data is
loaded from an external secret store. The maximum allowed size is 500KB,
as defined in [MaxSecretSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0-20250103191802-8c1959736554/api/validation#MaxSecretSize).
as defined in [MaxSecretSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0/api/validation#MaxSecretSize).
This field is only used to _create_ a secret, and is not returned by
other endpoints.
@@ -8662,7 +8642,18 @@ paths:
default: ""
- name: "outputs"
in: "query"
description: "BuildKit output configuration"
description: |
BuildKit output configuration in the format of a stringified JSON array of objects.
Each object must have two top-level properties: `Type` and `Attrs`.
The `Type` property must be set to 'moby'.
The `Attrs` property is a map of attributes for the BuildKit output configuration.
See https://docs.docker.com/build/exporters/oci-docker/ for more information.
Example:
```
[{"Type":"moby","Attrs":{"type":"image","force-compression":"true","compression":"zstd"}}]
```
type: "string"
default: ""
- name: "version"

View File

@@ -81,7 +81,6 @@ info:
{
"username": "string",
"password": "string",
"email": "string",
"serveraddress": "string"
}
```
@@ -2072,14 +2071,6 @@ definitions:
format: "int64"
x-nullable: false
example: 1239828
VirtualSize:
description: |
Total size of the image including all layers it is composed of.
Deprecated: this field is omitted in API v1.44, but kept for backward compatibility. Use Size instead.
type: "integer"
format: "int64"
example: 1239828
GraphDriver:
$ref: "#/definitions/GraphDriverData"
RootFS:
@@ -2211,14 +2202,6 @@ definitions:
format: "int64"
x-nullable: false
example: 1239828
VirtualSize:
description: |-
Total size of the image including all layers it is composed of.
Deprecated: this field is omitted in API v1.44, but kept for backward compatibility. Use Size instead.
type: "integer"
format: "int64"
example: 172064416
Labels:
description: "User-defined key/value metadata."
type: "object"
@@ -2247,6 +2230,10 @@ definitions:
password:
type: "string"
email:
description: |
Email is an optional value associated with the username.
> **Deprecated**: This field is deprecated since docker 1.11 (API v1.23) and will be removed in a future release.
type: "string"
serveraddress:
type: "string"
@@ -2660,14 +2647,6 @@ definitions:
description: |
Unique ID of the build cache record.
example: "ndlpt0hhvkqcdfkputsk4cq9c"
Parent:
description: |
ID of the parent build cache record.
> **Deprecated**: This field is deprecated, and omitted if empty.
type: "string"
x-nullable: true
example: ""
Parents:
description: |
List of parent build cache record IDs.
@@ -4308,6 +4287,7 @@ definitions:
A counter that triggers an update even if no relevant parameters have
been changed.
type: "integer"
format: "uint64"
Runtime:
description: |
Runtime is the type of runtime specified for the task executor.
@@ -5027,7 +5007,7 @@ definitions:
([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5)) string.
It must be empty if the Driver field is set, in which case the data is
loaded from an external secret store. The maximum allowed size is 500KB,
as defined in [MaxSecretSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0-20250103191802-8c1959736554/api/validation#MaxSecretSize).
as defined in [MaxSecretSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0/api/validation#MaxSecretSize).
This field is only used to _create_ a secret, and is not returned by
other endpoints.
@@ -8648,7 +8628,18 @@ paths:
default: ""
- name: "outputs"
in: "query"
description: "BuildKit output configuration"
description: |
BuildKit output configuration in the format of a stringified JSON array of objects.
Each object must have two top-level properties: `Type` and `Attrs`.
The `Type` property must be set to 'moby'.
The `Attrs` property is a map of attributes for the BuildKit output configuration.
See https://docs.docker.com/build/exporters/oci-docker/ for more information.
Example:
```
[{"Type":"moby","Attrs":{"type":"image","force-compression":"true","compression":"zstd"}}]
```
type: "string"
default: ""
- name: "version"

View File

@@ -81,7 +81,6 @@ info:
{
"username": "string",
"password": "string",
"email": "string",
"serveraddress": "string"
}
```
@@ -2099,14 +2098,6 @@ definitions:
format: "int64"
x-nullable: false
example: 1239828
VirtualSize:
description: |
Total size of the image including all layers it is composed of.
Deprecated: this field is omitted in API v1.44, but kept for backward compatibility. Use Size instead.
type: "integer"
format: "int64"
example: 1239828
GraphDriver:
$ref: "#/definitions/GraphDriverData"
RootFS:
@@ -2239,14 +2230,6 @@ definitions:
format: "int64"
x-nullable: false
example: 1239828
VirtualSize:
description: |-
Total size of the image including all layers it is composed of.
Deprecated: this field is omitted in API v1.44, but kept for backward compatibility. Use Size instead.
type: "integer"
format: "int64"
example: 172064416
Labels:
description: "User-defined key/value metadata."
type: "object"
@@ -2275,6 +2258,10 @@ definitions:
password:
type: "string"
email:
description: |
Email is an optional value associated with the username.
> **Deprecated**: This field is deprecated since docker 1.11 (API v1.23) and will be removed in a future release.
type: "string"
serveraddress:
type: "string"
@@ -2706,14 +2693,6 @@ definitions:
description: |
Unique ID of the build cache record.
example: "ndlpt0hhvkqcdfkputsk4cq9c"
Parent:
description: |
ID of the parent build cache record.
> **Deprecated**: This field is deprecated, and omitted if empty.
type: "string"
x-nullable: true
example: ""
Parents:
description: |
List of parent build cache record IDs.
@@ -4361,6 +4340,7 @@ definitions:
A counter that triggers an update even if no relevant parameters have
been changed.
type: "integer"
format: "uint64"
Runtime:
description: |
Runtime is the type of runtime specified for the task executor.
@@ -5086,7 +5066,7 @@ definitions:
([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5)) string.
It must be empty if the Driver field is set, in which case the data is
loaded from an external secret store. The maximum allowed size is 500KB,
as defined in [MaxSecretSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0-20250103191802-8c1959736554/api/validation#MaxSecretSize).
as defined in [MaxSecretSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0/api/validation#MaxSecretSize).
This field is only used to _create_ a secret, and is not returned by
other endpoints.
@@ -8769,7 +8749,18 @@ paths:
default: ""
- name: "outputs"
in: "query"
description: "BuildKit output configuration"
description: |
BuildKit output configuration in the format of a stringified JSON array of objects.
Each object must have two top-level properties: `Type` and `Attrs`.
The `Type` property must be set to 'moby'.
The `Attrs` property is a map of attributes for the BuildKit output configuration.
See https://docs.docker.com/build/exporters/oci-docker/ for more information.
Example:
```
[{"Type":"moby","Attrs":{"type":"image","force-compression":"true","compression":"zstd"}}]
```
type: "string"
default: ""
- name: "version"

View File

@@ -81,7 +81,6 @@ info:
{
"username": "string",
"password": "string",
"email": "string",
"serveraddress": "string"
}
```
@@ -2099,14 +2098,6 @@ definitions:
format: "int64"
x-nullable: false
example: 1239828
VirtualSize:
description: |
Total size of the image including all layers it is composed of.
Deprecated: this field is omitted in API v1.44, but kept for backward compatibility. Use Size instead.
type: "integer"
format: "int64"
example: 1239828
GraphDriver:
$ref: "#/definitions/DriverData"
RootFS:
@@ -2239,14 +2230,6 @@ definitions:
format: "int64"
x-nullable: false
example: 1239828
VirtualSize:
description: |-
Total size of the image including all layers it is composed of.
Deprecated: this field is omitted in API v1.44, but kept for backward compatibility. Use Size instead.
type: "integer"
format: "int64"
example: 172064416
Labels:
description: "User-defined key/value metadata."
type: "object"
@@ -2288,6 +2271,10 @@ definitions:
password:
type: "string"
email:
description: |
Email is an optional value associated with the username.
> **Deprecated**: This field is deprecated since docker 1.11 (API v1.23) and will be removed in a future release.
type: "string"
serveraddress:
type: "string"
@@ -2724,14 +2711,6 @@ definitions:
description: |
Unique ID of the build cache record.
example: "ndlpt0hhvkqcdfkputsk4cq9c"
Parent:
description: |
ID of the parent build cache record.
> **Deprecated**: This field is deprecated, and omitted if empty.
type: "string"
x-nullable: true
example: ""
Parents:
description: |
List of parent build cache record IDs.
@@ -4379,6 +4358,7 @@ definitions:
A counter that triggers an update even if no relevant parameters have
been changed.
type: "integer"
format: "uint64"
Runtime:
description: |
Runtime is the type of runtime specified for the task executor.
@@ -5104,7 +5084,7 @@ definitions:
([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5)) string.
It must be empty if the Driver field is set, in which case the data is
loaded from an external secret store. The maximum allowed size is 500KB,
as defined in [MaxSecretSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0-20250103191802-8c1959736554/api/validation#MaxSecretSize).
as defined in [MaxSecretSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0/api/validation#MaxSecretSize).
This field is only used to _create_ a secret, and is not returned by
other endpoints.
@@ -8910,7 +8890,18 @@ paths:
default: ""
- name: "outputs"
in: "query"
description: "BuildKit output configuration"
description: |
BuildKit output configuration in the format of a stringified JSON array of objects.
Each object must have two top-level properties: `Type` and `Attrs`.
The `Type` property must be set to 'moby'.
The `Attrs` property is a map of attributes for the BuildKit output configuration.
See https://docs.docker.com/build/exporters/oci-docker/ for more information.
Example:
```
[{"Type":"moby","Attrs":{"type":"image","force-compression":"true","compression":"zstd"}}]
```
type: "string"
default: ""
- name: "version"

View File

@@ -81,7 +81,6 @@ info:
{
"username": "string",
"password": "string",
"email": "string",
"serveraddress": "string"
}
```
@@ -2176,14 +2175,6 @@ definitions:
format: "int64"
x-nullable: false
example: 1239828
VirtualSize:
description: |
Total size of the image including all layers it is composed of.
Deprecated: this field is omitted in API v1.44, but kept for backward compatibility. Use Size instead.
type: "integer"
format: "int64"
example: 1239828
GraphDriver:
$ref: "#/definitions/DriverData"
RootFS:
@@ -2316,14 +2307,6 @@ definitions:
format: "int64"
x-nullable: false
example: 1239828
VirtualSize:
description: |-
Total size of the image including all layers it is composed of.
Deprecated: this field is omitted in API v1.44, but kept for backward compatibility. Use Size instead.
type: "integer"
format: "int64"
example: 172064416
Labels:
description: "User-defined key/value metadata."
type: "object"
@@ -2377,6 +2360,10 @@ definitions:
password:
type: "string"
email:
description: |
Email is an optional value associated with the username.
> **Deprecated**: This field is deprecated since docker 1.11 (API v1.23) and will be removed in a future release.
type: "string"
serveraddress:
type: "string"
@@ -2825,14 +2812,6 @@ definitions:
description: |
Unique ID of the build cache record.
example: "ndlpt0hhvkqcdfkputsk4cq9c"
Parent:
description: |
ID of the parent build cache record.
> **Deprecated**: This field is deprecated, and omitted if empty.
type: "string"
x-nullable: true
example: ""
Parents:
description: |
List of parent build cache record IDs.
@@ -3039,7 +3018,8 @@ definitions:
be used. If multiple endpoints have the same priority, endpoints are
lexicographically sorted based on their network name, and the one
that sorts first is picked.
type: "number"
type: "integer"
format: "int64"
example:
- 10
@@ -4517,6 +4497,7 @@ definitions:
A counter that triggers an update even if no relevant parameters have
been changed.
type: "integer"
format: "uint64"
Runtime:
description: |
Runtime is the type of runtime specified for the task executor.
@@ -5512,7 +5493,7 @@ definitions:
([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5)) string.
It must be empty if the Driver field is set, in which case the data is
loaded from an external secret store. The maximum allowed size is 500KB,
as defined in [MaxSecretSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0-20250103191802-8c1959736554/api/validation#MaxSecretSize).
as defined in [MaxSecretSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0/api/validation#MaxSecretSize).
This field is only used to _create_ a secret, and is not returned by
other endpoints.
@@ -6546,7 +6527,7 @@ definitions:
> **Deprecated**: netfilter module is now loaded on-demand and no longer
> during daemon startup, making this field obsolete. This field is always
> `false` and will be removed in a API v1.49.
> `false` and will be removed in a API v1.50.
type: "boolean"
example: false
BridgeNfIp6tables:
@@ -6557,7 +6538,7 @@ definitions:
> **Deprecated**: netfilter module is now loaded on-demand, and no longer
> during daemon startup, making this field obsolete. This field is always
> `false` and will be removed in a API v1.49.
> `false` and will be removed in a API v1.50.
type: "boolean"
example: false
Debug:
@@ -9454,7 +9435,18 @@ paths:
default: ""
- name: "outputs"
in: "query"
description: "BuildKit output configuration"
description: |
BuildKit output configuration in the format of a stringified JSON array of objects.
Each object must have two top-level properties: `Type` and `Attrs`.
The `Type` property must be set to 'moby'.
The `Attrs` property is a map of attributes for the BuildKit output configuration.
See https://docs.docker.com/build/exporters/oci-docker/ for more information.
Example:
```
[{"Type":"moby","Attrs":{"type":"image","force-compression":"true","compression":"zstd"}}]
```
type: "string"
default: ""
- name: "version"
@@ -9492,7 +9484,7 @@ paths:
Amount of disk space in bytes to keep for cache
> **Deprecated**: This parameter is deprecated and has been renamed to "reserved-space".
> It is kept for backward compatibility and will be removed in API v1.49.
> It is kept for backward compatibility and will be removed in API v1.52.
type: "integer"
format: "int64"
- name: "reserved-space"

View File

@@ -81,7 +81,6 @@ info:
{
"username": "string",
"password": "string",
"email": "string",
"serveraddress": "string"
}
```
@@ -2176,14 +2175,6 @@ definitions:
format: "int64"
x-nullable: false
example: 1239828
VirtualSize:
description: |
Total size of the image including all layers it is composed of.
Deprecated: this field is omitted in API v1.44, but kept for backward compatibility. Use Size instead.
type: "integer"
format: "int64"
example: 1239828
GraphDriver:
$ref: "#/definitions/DriverData"
RootFS:
@@ -2316,14 +2307,6 @@ definitions:
format: "int64"
x-nullable: false
example: 1239828
VirtualSize:
description: |-
Total size of the image including all layers it is composed of.
Deprecated: this field is omitted in API v1.44, but kept for backward compatibility. Use Size instead.
type: "integer"
format: "int64"
example: 172064416
Labels:
description: "User-defined key/value metadata."
type: "object"
@@ -2377,6 +2360,10 @@ definitions:
password:
type: "string"
email:
description: |
Email is an optional value associated with the username.
> **Deprecated**: This field is deprecated since docker 1.11 (API v1.23) and will be removed in a future release.
type: "string"
serveraddress:
type: "string"
@@ -2825,14 +2812,6 @@ definitions:
description: |
Unique ID of the build cache record.
example: "ndlpt0hhvkqcdfkputsk4cq9c"
Parent:
description: |
ID of the parent build cache record.
> **Deprecated**: This field is deprecated, and omitted if empty.
type: "string"
x-nullable: true
example: ""
Parents:
description: |
List of parent build cache record IDs.
@@ -3039,7 +3018,8 @@ definitions:
be used. If multiple endpoints have the same priority, endpoints are
lexicographically sorted based on their network name, and the one
that sorts first is picked.
type: "number"
type: "integer"
format: "int64"
example:
- 10
@@ -4517,6 +4497,7 @@ definitions:
A counter that triggers an update even if no relevant parameters have
been changed.
type: "integer"
format: "uint64"
Runtime:
description: |
Runtime is the type of runtime specified for the task executor.
@@ -5512,7 +5493,7 @@ definitions:
([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5)) string.
It must be empty if the Driver field is set, in which case the data is
loaded from an external secret store. The maximum allowed size is 500KB,
as defined in [MaxSecretSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0-20250103191802-8c1959736554/api/validation#MaxSecretSize).
as defined in [MaxSecretSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0/api/validation#MaxSecretSize).
This field is only used to _create_ a secret, and is not returned by
other endpoints.
@@ -6546,7 +6527,7 @@ definitions:
> **Deprecated**: netfilter module is now loaded on-demand and no longer
> during daemon startup, making this field obsolete. This field is always
> `false` and will be removed in a API v1.49.
> `false` and will be removed in a API v1.50.
type: "boolean"
example: false
BridgeNfIp6tables:
@@ -6557,7 +6538,7 @@ definitions:
> **Deprecated**: netfilter module is now loaded on-demand, and no longer
> during daemon startup, making this field obsolete. This field is always
> `false` and will be removed in a API v1.49.
> `false` and will be removed in a API v1.50.
type: "boolean"
example: false
Debug:
@@ -9454,7 +9435,18 @@ paths:
default: ""
- name: "outputs"
in: "query"
description: "BuildKit output configuration"
description: |
BuildKit output configuration in the format of a stringified JSON array of objects.
Each object must have two top-level properties: `Type` and `Attrs`.
The `Type` property must be set to 'moby'.
The `Attrs` property is a map of attributes for the BuildKit output configuration.
See https://docs.docker.com/build/exporters/oci-docker/ for more information.
Example:
```
[{"Type":"moby","Attrs":{"type":"image","force-compression":"true","compression":"zstd"}}]
```
type: "string"
default: ""
- name: "version"
@@ -9492,7 +9484,7 @@ paths:
Amount of disk space in bytes to keep for cache
> **Deprecated**: This parameter is deprecated and has been renamed to "reserved-space".
> It is kept for backward compatibility and will be removed in API v1.49.
> It is kept for backward compatibility and will be removed in API v1.52.
type: "integer"
format: "int64"
- name: "reserved-space"

View File

@@ -81,7 +81,6 @@ info:
{
"username": "string",
"password": "string",
"email": "string",
"serveraddress": "string"
}
```
@@ -1531,37 +1530,6 @@ definitions:
items:
type: "string"
example: ["/bin/sh", "-c"]
# FIXME(thaJeztah): temporarily using a full example to remove some "omitempty" fields. Remove once the fields are removed.
example:
"User": "web:web"
"ExposedPorts": {
"80/tcp": {},
"443/tcp": {}
}
"Env": ["PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"]
"Cmd": ["/bin/sh"]
"Healthcheck": {
"Test": ["string"],
"Interval": 0,
"Timeout": 0,
"Retries": 0,
"StartPeriod": 0,
"StartInterval": 0
}
"ArgsEscaped": true
"Volumes": {
"/app/data": {},
"/app/config": {}
}
"WorkingDir": "/public/"
"Entrypoint": []
"OnBuild": []
"Labels": {
"com.example.some-label": "some-value",
"com.example.some-other-label": "some-other-value"
}
"StopSignal": "SIGTERM"
"Shell": ["/bin/sh", "-c"]
NetworkingConfig:
description: |
@@ -2034,14 +2002,6 @@ definitions:
format: "int64"
x-nullable: false
example: 1239828
VirtualSize:
description: |
Total size of the image including all layers it is composed of.
Deprecated: this field is omitted in API v1.44, but kept for backward compatibility. Use Size instead.
type: "integer"
format: "int64"
example: 1239828
GraphDriver:
$ref: "#/definitions/DriverData"
RootFS:
@@ -2174,14 +2134,6 @@ definitions:
format: "int64"
x-nullable: false
example: 1239828
VirtualSize:
description: |-
Total size of the image including all layers it is composed of.
Deprecated: this field is omitted in API v1.44, but kept for backward compatibility. Use Size instead.
type: "integer"
format: "int64"
example: 172064416
Labels:
description: "User-defined key/value metadata."
type: "object"
@@ -2235,6 +2187,10 @@ definitions:
password:
type: "string"
email:
description: |
Email is an optional value associated with the username.
> **Deprecated**: This field is deprecated since docker 1.11 (API v1.23) and will be removed in a future release.
type: "string"
serveraddress:
type: "string"
@@ -2683,14 +2639,6 @@ definitions:
description: |
Unique ID of the build cache record.
example: "ndlpt0hhvkqcdfkputsk4cq9c"
Parent:
description: |
ID of the parent build cache record.
> **Deprecated**: This field is deprecated, and omitted if empty.
type: "string"
x-nullable: true
example: ""
Parents:
description: |
List of parent build cache record IDs.
@@ -2914,7 +2862,8 @@ definitions:
be used. If multiple endpoints have the same priority, endpoints are
lexicographically sorted based on their network name, and the one
that sorts first is picked.
type: "number"
type: "integer"
format: "int64"
example:
- 10
@@ -4392,6 +4341,7 @@ definitions:
A counter that triggers an update even if no relevant parameters have
been changed.
type: "integer"
format: "uint64"
Runtime:
description: |
Runtime is the type of runtime specified for the task executor.
@@ -5387,7 +5337,7 @@ definitions:
([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5)) string.
It must be empty if the Driver field is set, in which case the data is
loaded from an external secret store. The maximum allowed size is 500KB,
as defined in [MaxSecretSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0-20250103191802-8c1959736554/api/validation#MaxSecretSize).
as defined in [MaxSecretSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0/api/validation#MaxSecretSize).
This field is only used to _create_ a secret, and is not returned by
other endpoints.
@@ -6412,29 +6362,6 @@ definitions:
description: "Indicates IPv4 forwarding is enabled."
type: "boolean"
example: true
BridgeNfIptables:
description: |
Indicates if `bridge-nf-call-iptables` is available on the host when
the daemon was started.
<p><br /></p>
> **Deprecated**: netfilter module is now loaded on-demand and no longer
> during daemon startup, making this field obsolete. This field is always
> `false` and will be removed in a API v1.49.
type: "boolean"
example: false
BridgeNfIp6tables:
description: |
Indicates if `bridge-nf-call-ip6tables` is available on the host.
<p><br /></p>
> **Deprecated**: netfilter module is now loaded on-demand, and no longer
> during daemon startup, making this field obsolete. This field is always
> `false` and will be removed in a API v1.49.
type: "boolean"
example: false
Debug:
description: |
Indicates if the daemon is running in debug-mode / with debug-level
@@ -9338,7 +9265,18 @@ paths:
default: ""
- name: "outputs"
in: "query"
description: "BuildKit output configuration"
description: |
BuildKit output configuration in the format of a stringified JSON array of objects.
Each object must have two top-level properties: `Type` and `Attrs`.
The `Type` property must be set to 'moby'.
The `Attrs` property is a map of attributes for the BuildKit output configuration.
See https://docs.docker.com/build/exporters/oci-docker/ for more information.
Example:
```
[{"Type":"moby","Attrs":{"type":"image","force-compression":"true","compression":"zstd"}}]
```
type: "string"
default: ""
- name: "version"
@@ -9376,7 +9314,7 @@ paths:
Amount of disk space in bytes to keep for cache
> **Deprecated**: This parameter is deprecated and has been renamed to "reserved-space".
> It is kept for backward compatibility and will be removed in API v1.49.
> It is kept for backward compatibility and will be removed in API v1.52.
type: "integer"
format: "int64"
- name: "reserved-space"

13390
api/docs/v1.51.yaml Normal file

File diff suppressed because it is too large Load Diff

13485
api/docs/v1.52.yaml Normal file

File diff suppressed because it is too large Load Diff

14
api/go.mod Normal file
View File

@@ -0,0 +1,14 @@
module github.com/moby/moby/api
go 1.23.0
require (
github.com/docker/go-units v0.5.0
github.com/moby/docker-image-spec v1.3.1
github.com/opencontainers/go-digest v1.0.0
github.com/opencontainers/image-spec v1.1.1
gotest.tools/v3 v3.5.2
pgregory.net/rapid v1.2.0
)
require github.com/google/go-cmp v0.7.0 // indirect

14
api/go.sum Normal file
View File

@@ -0,0 +1,14 @@
github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4=
github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3Nl2EsFP0=
github.com/moby/docker-image-spec v1.3.1/go.mod h1:eKmb5VW8vQEh/BAr2yvVNvuiJuY6UIocYsFu/DxxRpo=
github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U=
github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM=
github.com/opencontainers/image-spec v1.1.1 h1:y0fUlFfIZhPF1W537XOLg0/fcx6zcHCJwooC2xJA040=
github.com/opencontainers/image-spec v1.1.1/go.mod h1:qpqAh3Dmcf36wStyyWU+kCeDgrGnAve2nCC8+7h8Q0M=
gotest.tools/v3 v3.5.2 h1:7koQfIKdy+I8UTetycgUqXWSDwpgv193Ka+qRsmBY8Q=
gotest.tools/v3 v3.5.2/go.mod h1:LtdLGcnqToBH83WByAAi/wiwSFCArdFIUV/xxN4pcjA=
pgregory.net/rapid v1.2.0 h1:keKAYRcjm+e1F0oAuU5F5+YPAWcyxNNRK2wud503Gnk=
pgregory.net/rapid v1.2.0/go.mod h1:PY5XlDGj0+V1FCq0o192FdRhpKHGTRIWBgqjDBTrq04=

View File

@@ -0,0 +1,92 @@
package authconfig
import (
"bytes"
"encoding/base64"
"encoding/json"
"errors"
"fmt"
"io"
"github.com/moby/moby/api/types/registry"
)
// Encode serializes the auth configuration as a base64url encoded
// ([RFC4648, section 5]) JSON string for sending through the X-Registry-Auth header.
//
// [RFC4648, section 5]: https://tools.ietf.org/html/rfc4648#section-5
func Encode(authConfig registry.AuthConfig) (string, error) {
// Older daemons (or registries) may not handle an empty string,
// which resulted in an "io.EOF" when unmarshaling or decoding.
//
// FIXME(thaJeztah): find exactly what code-paths are impacted by this.
// if authConfig == (AuthConfig{}) { return "", nil }
buf, err := json.Marshal(authConfig)
if err != nil {
return "", errInvalidParameter{err}
}
return base64.URLEncoding.EncodeToString(buf), nil
}
// Decode decodes base64url encoded ([RFC4648, section 5]) JSON
// authentication information as sent through the X-Registry-Auth header.
//
// This function always returns an [AuthConfig], even if an error occurs. It is up
// to the caller to decide if authentication is required, and if the error can
// be ignored.
//
// [RFC4648, section 5]: https://tools.ietf.org/html/rfc4648#section-5
func Decode(authEncoded string) (*registry.AuthConfig, error) {
if authEncoded == "" {
return &registry.AuthConfig{}, nil
}
decoded, err := base64.URLEncoding.DecodeString(authEncoded)
if err != nil {
var e base64.CorruptInputError
if errors.As(err, &e) {
return &registry.AuthConfig{}, invalid(errors.New("must be a valid base64url-encoded string"))
}
return &registry.AuthConfig{}, invalid(err)
}
if bytes.Equal(decoded, []byte("{}")) {
return &registry.AuthConfig{}, nil
}
return decode(bytes.NewReader(decoded))
}
// DecodeRequestBody decodes authentication information as sent as JSON in the
// body of a request. This function is to provide backward compatibility with old
// clients and API versions. Current clients and API versions expect authentication
// to be provided through the X-Registry-Auth header.
//
// Like [Decode], this function always returns an [AuthConfig], even if an
// error occurs. It is up to the caller to decide if authentication is required,
// and if the error can be ignored.
func DecodeRequestBody(r io.ReadCloser) (*registry.AuthConfig, error) {
return decode(r)
}
func decode(r io.Reader) (*registry.AuthConfig, error) {
authConfig := &registry.AuthConfig{}
if err := json.NewDecoder(r).Decode(authConfig); err != nil {
// always return an (empty) AuthConfig to increase compatibility with
// the existing API.
return &registry.AuthConfig{}, invalid(fmt.Errorf("invalid JSON: %w", err))
}
return authConfig, nil
}
func invalid(err error) error {
return errInvalidParameter{fmt.Errorf("invalid X-Registry-Auth header: %w", err)}
}
type errInvalidParameter struct{ error }
func (errInvalidParameter) InvalidParameter() {}
func (e errInvalidParameter) Cause() error { return e.error }
func (e errInvalidParameter) Unwrap() error { return e.error }

View File

@@ -0,0 +1,191 @@
package authconfig
import (
"encoding/base64"
"strings"
"testing"
"github.com/moby/moby/api/types/registry"
"gotest.tools/v3/assert"
is "gotest.tools/v3/assert/cmp"
)
func TestDecodeAuthConfig(t *testing.T) {
tests := []struct {
doc string
input string
inputBase64 string
expected registry.AuthConfig
expectedErr string
}{
{
doc: "empty",
input: ``,
inputBase64: ``,
expected: registry.AuthConfig{},
},
{
doc: "empty JSON",
input: `{}`,
inputBase64: `e30=`,
expected: registry.AuthConfig{},
},
{
doc: "malformed JSON",
input: `{`,
inputBase64: `ew==`,
expected: registry.AuthConfig{},
expectedErr: `invalid X-Registry-Auth header: invalid JSON: unexpected EOF`,
},
{
doc: "test authConfig",
input: `{"username":"testuser","password":"testpassword","serveraddress":"example.com"}`,
inputBase64: `eyJ1c2VybmFtZSI6InRlc3R1c2VyIiwicGFzc3dvcmQiOiJ0ZXN0cGFzc3dvcmQiLCJzZXJ2ZXJhZGRyZXNzIjoiZXhhbXBsZS5jb20ifQ==`,
expected: registry.AuthConfig{
Username: "testuser",
Password: "testpassword",
ServerAddress: "example.com",
},
},
{
// FIXME(thaJeztah): we should not accept multiple JSON documents.
doc: "multiple authConfig",
input: `{"username":"testuser","password":"testpassword","serveraddress":"example.com"}{"username":"testuser2","password":"testpassword2","serveraddress":"example.org"}`,
inputBase64: `eyJ1c2VybmFtZSI6InRlc3R1c2VyIiwicGFzc3dvcmQiOiJ0ZXN0cGFzc3dvcmQiLCJzZXJ2ZXJhZGRyZXNzIjoiZXhhbXBsZS5jb20ifXsidXNlcm5hbWUiOiJ0ZXN0dXNlcjIiLCJwYXNzd29yZCI6InRlc3RwYXNzd29yZDIiLCJzZXJ2ZXJhZGRyZXNzIjoiZXhhbXBsZS5vcmcifQ==`,
expected: registry.AuthConfig{
Username: "testuser",
Password: "testpassword",
ServerAddress: "example.com",
},
},
// We currently only support base64url encoding with padding, so
// un-padded should produce an error.
//
// RFC4648, section 5: https://tools.ietf.org/html/rfc4648#section-5
// RFC4648, section 3.2: https://tools.ietf.org/html/rfc4648#section-3.2
{
doc: "empty JSON no padding",
input: `{}`,
inputBase64: `e30`,
expected: registry.AuthConfig{},
expectedErr: `invalid X-Registry-Auth header: must be a valid base64url-encoded string`,
},
{
doc: "test authConfig",
input: `{"username":"testuser","password":"testpassword","serveraddress":"example.com"}`,
inputBase64: `eyJ1c2VybmFtZSI6InRlc3R1c2VyIiwicGFzc3dvcmQiOiJ0ZXN0cGFzc3dvcmQiLCJzZXJ2ZXJhZGRyZXNzIjoiZXhhbXBsZS5jb20ifQ`,
expected: registry.AuthConfig{},
expectedErr: `invalid X-Registry-Auth header: must be a valid base64url-encoded string`,
},
}
for _, tc := range tests {
t.Run(tc.doc, func(t *testing.T) {
if tc.inputBase64 != "" {
// Sanity check to make sure our fixtures are correct.
b64 := base64.URLEncoding.EncodeToString([]byte(tc.input))
if !strings.HasSuffix(tc.inputBase64, "=") {
b64 = strings.TrimRight(b64, "=")
}
assert.Check(t, is.Equal(b64, tc.inputBase64))
}
out, err := Decode(tc.inputBase64)
if tc.expectedErr != "" {
assert.Check(t, is.ErrorType(err, errInvalidParameter{}))
assert.Check(t, is.Error(err, tc.expectedErr))
} else {
assert.NilError(t, err)
assert.Equal(t, *out, tc.expected)
}
})
}
}
func TestEncodeAuthConfig(t *testing.T) {
tests := []struct {
doc string
input registry.AuthConfig
outBase64 string
outPlain string
}{
{
// Older daemons (or registries) may not handle an empty string,
// which resulted in an "io.EOF" when unmarshaling or decoding.
//
// FIXME(thaJeztah): find exactly what code-paths are impacted by this.
doc: "empty",
input: registry.AuthConfig{},
outBase64: `e30=`,
outPlain: `{}`,
},
{
doc: "test authConfig",
input: registry.AuthConfig{
Username: "testuser",
Password: "testpassword",
ServerAddress: "example.com",
},
outBase64: `eyJ1c2VybmFtZSI6InRlc3R1c2VyIiwicGFzc3dvcmQiOiJ0ZXN0cGFzc3dvcmQiLCJzZXJ2ZXJhZGRyZXNzIjoiZXhhbXBsZS5jb20ifQ==`,
outPlain: `{"username":"testuser","password":"testpassword","serveraddress":"example.com"}`,
},
}
for _, tc := range tests {
// Sanity check to make sure our fixtures are correct.
b64 := base64.URLEncoding.EncodeToString([]byte(tc.outPlain))
assert.Check(t, is.Equal(b64, tc.outBase64))
t.Run(tc.doc, func(t *testing.T) {
out, err := Encode(tc.input)
assert.NilError(t, err)
assert.Equal(t, out, tc.outBase64)
authJSON, err := base64.URLEncoding.DecodeString(out)
assert.NilError(t, err)
assert.Equal(t, string(authJSON), tc.outPlain)
})
}
}
func BenchmarkDecodeAuthConfig(b *testing.B) {
cases := []struct {
doc string
inputBase64 string
invalid bool
}{
{
doc: "empty",
inputBase64: ``,
},
{
doc: "empty JSON",
inputBase64: `e30=`,
},
{
doc: "valid",
inputBase64: base64.URLEncoding.EncodeToString([]byte(`{"username":"testuser","password":"testpassword","serveraddress":"example.com"}`)),
},
{
doc: "invalid base64",
inputBase64: "not-base64",
invalid: true,
},
{
doc: "malformed JSON",
inputBase64: `ew==`,
invalid: true,
},
}
for _, tc := range cases {
b.Run(tc.doc, func(b *testing.B) {
b.ReportAllocs()
for i := 0; i < b.N; i++ {
_, err := Decode(tc.inputBase64)
if !tc.invalid && err != nil {
b.Fatal(err)
}
}
})
}
}

146
api/pkg/stdcopy/stdcopy.go Normal file
View File

@@ -0,0 +1,146 @@
package stdcopy
import (
"encoding/binary"
"errors"
"fmt"
"io"
)
// StdType is the type of standard stream
// a writer can multiplex to.
type StdType byte
const (
Stdin StdType = 0 // Stdin represents standard input stream. It is present for completeness and should NOT be used. When reading the stream with [StdCopy] it is output on [Stdout].
Stdout StdType = 1 // Stdout represents standard output stream.
Stderr StdType = 2 // Stderr represents standard error steam.
Systemerr StdType = 3 // Systemerr represents errors originating from the system. When reading the stream with [StdCopy] it is returned as an error.
)
const (
stdWriterPrefixLen = 8
stdWriterFdIndex = 0
stdWriterSizeIndex = 4
startingBufLen = 32*1024 + stdWriterPrefixLen + 1
)
// StdCopy is a modified version of [io.Copy] to de-multiplex messages
// from "multiplexedSource" and copy them to destination streams
// "destOut" and "destErr".
//
// StdCopy demultiplexes "multiplexedSource", assuming that it contains
// two streams, previously multiplexed using a writer created with
// [NewStdWriter].
//
// As it reads from "multiplexedSource", StdCopy writes [Stdout] messages
// to "destOut", and [Stderr] message to "destErr]. For backward-compatibility,
// [Stdin] messages are output to "destOut". The [Systemerr] stream provides
// errors produced by the daemon. It is returned as an error, and terminates
// processing the stream.
//
// StdCopy it reads until it hits [io.EOF] on "multiplexedSource", after
// which it returns a nil error. In other words: any error returned indicates
// a real underlying error, which may be when an unknown [StdType] stream
// is received.
//
// The "written" return holds the total number of bytes written to "destOut"
// and "destErr" combined.
func StdCopy(destOut, destErr io.Writer, multiplexedSource io.Reader) (written int64, _ error) {
var (
buf = make([]byte, startingBufLen)
bufLen = len(buf)
nr, nw int
err error
out io.Writer
frameSize int
)
for {
// Make sure we have at least a full header
for nr < stdWriterPrefixLen {
var nr2 int
nr2, err = multiplexedSource.Read(buf[nr:])
nr += nr2
if errors.Is(err, io.EOF) {
if nr < stdWriterPrefixLen {
return written, nil
}
break
}
if err != nil {
return 0, err
}
}
// Check the first byte to know where to write
stream := StdType(buf[stdWriterFdIndex])
switch stream {
case Stdin:
fallthrough
case Stdout:
// Write on stdout
out = destOut
case Stderr:
// Write on stderr
out = destErr
case Systemerr:
// If we're on Systemerr, we won't write anywhere.
// NB: if this code changes later, make sure you don't try to write
// to outstream if Systemerr is the stream
out = nil
default:
return 0, fmt.Errorf("unrecognized stream: %d", stream)
}
// Retrieve the size of the frame
frameSize = int(binary.BigEndian.Uint32(buf[stdWriterSizeIndex : stdWriterSizeIndex+4]))
// Check if the buffer is big enough to read the frame.
// Extend it if necessary.
if frameSize+stdWriterPrefixLen > bufLen {
buf = append(buf, make([]byte, frameSize+stdWriterPrefixLen-bufLen+1)...)
bufLen = len(buf)
}
// While the amount of bytes read is less than the size of the frame + header, we keep reading
for nr < frameSize+stdWriterPrefixLen {
var nr2 int
nr2, err = multiplexedSource.Read(buf[nr:])
nr += nr2
if errors.Is(err, io.EOF) {
if nr < frameSize+stdWriterPrefixLen {
return written, nil
}
break
}
if err != nil {
return 0, err
}
}
// we might have an error from the source mixed up in our multiplexed
// stream. if we do, return it.
if stream == Systemerr {
return written, fmt.Errorf("error from daemon in stream: %s", string(buf[stdWriterPrefixLen:frameSize+stdWriterPrefixLen]))
}
// Write the retrieved frame (without header)
nw, err = out.Write(buf[stdWriterPrefixLen : frameSize+stdWriterPrefixLen])
if err != nil {
return 0, err
}
// If the frame has not been fully written: error
if nw != frameSize {
return 0, io.ErrShortWrite
}
written += int64(nw)
// Move the rest of the buffer to the beginning
copy(buf, buf[frameSize+stdWriterPrefixLen:])
// Move the index
nr -= frameSize + stdWriterPrefixLen
}
}

View File

@@ -0,0 +1,17 @@
# commit to be tagged for new release
commit = "HEAD"
project_name = "moby"
github_repo = "moby/moby"
sub_path = "api"
ignore_deps = [ "github.com/moby/moby" ]
# previous release
previous = "v28.2.2"
pre_release = true
preface = """\
The first dedicated release for the Moby API. This release continues the 1.x
line of API compatibility with the 52nd minor release of the 1.x API.
"""

View File

@@ -1,128 +0,0 @@
package build
import (
"context"
"fmt"
"strconv"
"github.com/distribution/reference"
"github.com/docker/docker/api/types/backend"
"github.com/docker/docker/api/types/build"
"github.com/docker/docker/api/types/events"
"github.com/docker/docker/builder"
buildkit "github.com/docker/docker/builder/builder-next"
daemonevents "github.com/docker/docker/daemon/events"
"github.com/docker/docker/image"
"github.com/docker/docker/pkg/stringid"
"github.com/pkg/errors"
"google.golang.org/grpc"
)
// ImageComponent provides an interface for working with images
type ImageComponent interface {
SquashImage(from string, to string) (string, error)
TagImage(context.Context, image.ID, reference.Named) error
}
// Builder defines interface for running a build
type Builder interface {
Build(context.Context, backend.BuildConfig) (*builder.Result, error)
}
// Backend provides build functionality to the API router
type Backend struct {
builder Builder
imageComponent ImageComponent
buildkit *buildkit.Builder
eventsService *daemonevents.Events
}
// NewBackend creates a new build backend from components
func NewBackend(components ImageComponent, builder Builder, buildkit *buildkit.Builder, es *daemonevents.Events) (*Backend, error) {
return &Backend{imageComponent: components, builder: builder, buildkit: buildkit, eventsService: es}, nil
}
// RegisterGRPC registers buildkit controller to the grpc server.
func (b *Backend) RegisterGRPC(s *grpc.Server) {
if b.buildkit != nil {
b.buildkit.RegisterGRPC(s)
}
}
// Build builds an image from a Source
func (b *Backend) Build(ctx context.Context, config backend.BuildConfig) (string, error) {
options := config.Options
useBuildKit := options.Version == build.BuilderBuildKit
tags, err := sanitizeRepoAndTags(options.Tags)
if err != nil {
return "", err
}
var buildResult *builder.Result
if useBuildKit {
buildResult, err = b.buildkit.Build(ctx, config)
if err != nil {
return "", err
}
} else {
buildResult, err = b.builder.Build(ctx, config)
if err != nil {
return "", err
}
}
if buildResult == nil {
return "", nil
}
imageID := buildResult.ImageID
if options.Squash {
if imageID, err = squashBuild(buildResult, b.imageComponent); err != nil {
return "", err
}
if config.ProgressWriter.AuxFormatter != nil {
if err = config.ProgressWriter.AuxFormatter.Emit("moby.image.id", build.Result{ID: imageID}); err != nil {
return "", err
}
}
}
if imageID != "" && !useBuildKit {
stdout := config.ProgressWriter.StdoutFormatter
_, _ = fmt.Fprintf(stdout, "Successfully built %s\n", stringid.TruncateID(imageID))
err = tagImages(ctx, b.imageComponent, config.ProgressWriter.StdoutFormatter, image.ID(imageID), tags)
}
return imageID, err
}
// PruneCache removes all cached build sources
func (b *Backend) PruneCache(ctx context.Context, opts build.CachePruneOptions) (*build.CachePruneReport, error) {
buildCacheSize, cacheIDs, err := b.buildkit.Prune(ctx, opts)
if err != nil {
return nil, errors.Wrap(err, "failed to prune build cache")
}
b.eventsService.Log(events.ActionPrune, events.BuilderEventType, events.Actor{
Attributes: map[string]string{
"reclaimed": strconv.FormatInt(buildCacheSize, 10),
},
})
return &build.CachePruneReport{SpaceReclaimed: uint64(buildCacheSize), CachesDeleted: cacheIDs}, nil
}
// Cancel cancels the build by ID
func (b *Backend) Cancel(ctx context.Context, id string) error {
return b.buildkit.Cancel(ctx, id)
}
func squashBuild(build *builder.Result, imageComponent ImageComponent) (string, error) {
var fromID string
if build.FromImage != nil {
fromID = build.FromImage.ImageID()
}
imageID, err := imageComponent.SquashImage(build.ImageID, fromID)
if err != nil {
return "", errors.Wrap(err, "error squashing image")
}
return imageID, nil
}

View File

@@ -1,15 +0,0 @@
package httputils
import (
"io"
"github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/network"
)
// ContainerDecoder specifies how
// to translate an io.Reader into
// container configuration.
type ContainerDecoder interface {
DecodeConfig(src io.Reader) (*container.Config, *container.HostConfig, *network.NetworkingConfig, error)
}

View File

@@ -1,89 +0,0 @@
package httputils
import (
"context"
"fmt"
"io"
"net/http"
"net/url"
"sort"
"github.com/docker/docker/api/types/backend"
"github.com/docker/docker/api/types/container"
"github.com/docker/docker/pkg/ioutils"
"github.com/docker/docker/pkg/jsonmessage"
"github.com/docker/docker/pkg/stdcopy"
)
// WriteLogStream writes an encoded byte stream of log messages from the
// messages channel, multiplexing them with a stdcopy.Writer if mux is true
func WriteLogStream(_ context.Context, w http.ResponseWriter, msgs <-chan *backend.LogMessage, config *container.LogsOptions, mux bool) {
// See https://github.com/moby/moby/issues/47448
// Trigger headers to be written immediately.
w.WriteHeader(http.StatusOK)
wf := ioutils.NewWriteFlusher(w)
defer wf.Close()
wf.Flush()
outStream := io.Writer(wf)
errStream := outStream
sysErrStream := errStream
if mux {
sysErrStream = stdcopy.NewStdWriter(outStream, stdcopy.Systemerr)
errStream = stdcopy.NewStdWriter(outStream, stdcopy.Stderr)
outStream = stdcopy.NewStdWriter(outStream, stdcopy.Stdout)
}
for {
msg, ok := <-msgs
if !ok {
return
}
// check if the message contains an error. if so, write that error
// and exit
if msg.Err != nil {
fmt.Fprintf(sysErrStream, "Error grabbing logs: %v\n", msg.Err)
continue
}
logLine := msg.Line
if config.Details {
logLine = append(attrsByteSlice(msg.Attrs), ' ')
logLine = append(logLine, msg.Line...)
}
if config.Timestamps {
logLine = append([]byte(msg.Timestamp.Format(jsonmessage.RFC3339NanoFixed)+" "), logLine...)
}
if msg.Source == "stdout" && config.ShowStdout {
_, _ = outStream.Write(logLine)
}
if msg.Source == "stderr" && config.ShowStderr {
_, _ = errStream.Write(logLine)
}
}
}
type byKey []backend.LogAttr
func (b byKey) Len() int { return len(b) }
func (b byKey) Less(i, j int) bool { return b[i].Key < b[j].Key }
func (b byKey) Swap(i, j int) { b[i], b[j] = b[j], b[i] }
func attrsByteSlice(a []backend.LogAttr) []byte {
// Note this sorts "a" in-place. That is fine here - nothing else is
// going to use Attrs or care about the order.
sort.Sort(byKey(a))
var ret []byte
for i, pair := range a {
k, v := url.QueryEscape(pair.Key), url.QueryEscape(pair.Value)
ret = append(ret, []byte(k)...)
ret = append(ret, '=')
ret = append(ret, []byte(v)...)
if i != len(a)-1 {
ret = append(ret, ',')
}
}
return ret
}

View File

@@ -1,116 +0,0 @@
package middleware
import (
"bufio"
"context"
"encoding/json"
"io"
"net/http"
"strings"
"github.com/containerd/log"
"github.com/docker/docker/api/server/httpstatus"
"github.com/docker/docker/api/server/httputils"
"github.com/docker/docker/pkg/ioutils"
"github.com/sirupsen/logrus"
)
// DebugRequestMiddleware dumps the request to logger
func DebugRequestMiddleware(handler func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error) func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
return func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
logger := log.G(ctx)
// Use a variable for fields to prevent overhead of repeatedly
// calling WithFields.
fields := log.Fields{
"module": "api",
"method": r.Method,
"request-url": r.RequestURI,
"vars": vars,
}
handleWithLogs := func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
logger.WithFields(fields).Debugf("handling %s request", r.Method)
err := handler(ctx, w, r, vars)
if err != nil {
// TODO(thaJeztah): unify this with Server.makeHTTPHandler, which also logs internal server errors as error-log. See https://github.com/moby/moby/pull/48740#discussion_r1816675574
fields["error-response"] = err
fields["status"] = httpstatus.FromError(err)
logger.WithFields(fields).Debugf("error response for %s request", r.Method)
}
return err
}
if r.Method != http.MethodPost {
return handleWithLogs(ctx, w, r, vars)
}
if err := httputils.CheckForJSON(r); err != nil {
return handleWithLogs(ctx, w, r, vars)
}
maxBodySize := 4096 // 4KB
if r.ContentLength > int64(maxBodySize) {
return handleWithLogs(ctx, w, r, vars)
}
body := r.Body
bufReader := bufio.NewReaderSize(body, maxBodySize)
r.Body = ioutils.NewReadCloserWrapper(bufReader, func() error { return body.Close() })
b, err := bufReader.Peek(maxBodySize)
if err != io.EOF {
// either there was an error reading, or the buffer is full (in which case the request is too large)
return handleWithLogs(ctx, w, r, vars)
}
var postForm map[string]interface{}
if err := json.Unmarshal(b, &postForm); err == nil {
maskSecretKeys(postForm)
// TODO(thaJeztah): is there a better way to detect if we're using JSON-formatted logs?
if _, ok := logger.Logger.Formatter.(*logrus.JSONFormatter); ok {
fields["form-data"] = postForm
} else {
if data, err := json.Marshal(postForm); err != nil {
fields["form-data"] = postForm
} else {
fields["form-data"] = string(data)
}
}
}
return handleWithLogs(ctx, w, r, vars)
}
}
func maskSecretKeys(inp interface{}) {
if arr, ok := inp.([]interface{}); ok {
for _, f := range arr {
maskSecretKeys(f)
}
return
}
if form, ok := inp.(map[string]interface{}); ok {
scrub := []string{
// Note: The Data field contains the base64-encoded secret in 'secret'
// and 'config' create and update requests. Currently, no other POST
// API endpoints use a data field, so we scrub this field unconditionally.
// Change this handling to be conditional if a new endpoint is added
// in future where this field should not be scrubbed.
"data",
"jointoken",
"password",
"secret",
"signingcakey",
"unlockkey",
}
loop0:
for k, v := range form {
for _, m := range scrub {
if strings.EqualFold(m, k) {
form[k] = "*****"
continue loop0
}
}
maskSecretKeys(v)
}
}
}

View File

@@ -1,75 +0,0 @@
package middleware
import (
"testing"
"gotest.tools/v3/assert"
is "gotest.tools/v3/assert/cmp"
)
func TestMaskSecretKeys(t *testing.T) {
tests := []struct {
doc string
input map[string]interface{}
expected map[string]interface{}
}{
{
doc: "secret/config create and update requests",
input: map[string]interface{}{"Data": "foo", "Name": "name", "Labels": map[string]interface{}{}},
expected: map[string]interface{}{"Data": "*****", "Name": "name", "Labels": map[string]interface{}{}},
},
{
doc: "masking other fields (recursively)",
input: map[string]interface{}{
"password": "pass",
"secret": "secret",
"jointoken": "jointoken",
"unlockkey": "unlockkey",
"signingcakey": "signingcakey",
"other": map[string]interface{}{
"password": "pass",
"secret": "secret",
"jointoken": "jointoken",
"unlockkey": "unlockkey",
"signingcakey": "signingcakey",
},
},
expected: map[string]interface{}{
"password": "*****",
"secret": "*****",
"jointoken": "*****",
"unlockkey": "*****",
"signingcakey": "*****",
"other": map[string]interface{}{
"password": "*****",
"secret": "*****",
"jointoken": "*****",
"unlockkey": "*****",
"signingcakey": "*****",
},
},
},
{
doc: "case insensitive field matching",
input: map[string]interface{}{
"PASSWORD": "pass",
"other": map[string]interface{}{
"PASSWORD": "pass",
},
},
expected: map[string]interface{}{
"PASSWORD": "*****",
"other": map[string]interface{}{
"PASSWORD": "*****",
},
},
},
}
for _, testcase := range tests {
t.Run(testcase.doc, func(t *testing.T) {
maskSecretKeys(testcase.input)
assert.Check(t, is.DeepEqual(testcase.expected, testcase.input))
})
}
}

View File

@@ -1,86 +0,0 @@
package middleware
import (
"context"
"fmt"
"net/http"
"runtime"
"github.com/docker/docker/api"
"github.com/docker/docker/api/server/httputils"
"github.com/docker/docker/api/types/versions"
)
// VersionMiddleware is a middleware that
// validates the client and server versions.
type VersionMiddleware struct {
serverVersion string
// defaultAPIVersion is the default API version provided by the API server,
// specified as "major.minor". It is usually configured to the latest API
// version [github.com/docker/docker/api.DefaultVersion].
//
// API requests for API versions greater than this version are rejected by
// the server and produce a [versionUnsupportedError].
defaultAPIVersion string
// minAPIVersion is the minimum API version provided by the API server,
// specified as "major.minor".
//
// API requests for API versions lower than this version are rejected by
// the server and produce a [versionUnsupportedError].
minAPIVersion string
}
// NewVersionMiddleware creates a VersionMiddleware with the given versions.
func NewVersionMiddleware(serverVersion, defaultAPIVersion, minAPIVersion string) (*VersionMiddleware, error) {
if versions.LessThan(defaultAPIVersion, api.MinSupportedAPIVersion) || versions.GreaterThan(defaultAPIVersion, api.DefaultVersion) {
return nil, fmt.Errorf("invalid default API version (%s): must be between %s and %s", defaultAPIVersion, api.MinSupportedAPIVersion, api.DefaultVersion)
}
if versions.LessThan(minAPIVersion, api.MinSupportedAPIVersion) || versions.GreaterThan(minAPIVersion, api.DefaultVersion) {
return nil, fmt.Errorf("invalid minimum API version (%s): must be between %s and %s", minAPIVersion, api.MinSupportedAPIVersion, api.DefaultVersion)
}
if versions.GreaterThan(minAPIVersion, defaultAPIVersion) {
return nil, fmt.Errorf("invalid API version: the minimum API version (%s) is higher than the default version (%s)", minAPIVersion, defaultAPIVersion)
}
return &VersionMiddleware{
serverVersion: serverVersion,
defaultAPIVersion: defaultAPIVersion,
minAPIVersion: minAPIVersion,
}, nil
}
type versionUnsupportedError struct {
version, minVersion, maxVersion string
}
func (e versionUnsupportedError) Error() string {
if e.minVersion != "" {
return fmt.Sprintf("client version %s is too old. Minimum supported API version is %s, please upgrade your client to a newer version", e.version, e.minVersion)
}
return fmt.Sprintf("client version %s is too new. Maximum supported API version is %s", e.version, e.maxVersion)
}
func (e versionUnsupportedError) InvalidParameter() {}
// WrapHandler returns a new handler function wrapping the previous one in the request chain.
func (v VersionMiddleware) WrapHandler(handler func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error) func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
return func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
w.Header().Set("Server", fmt.Sprintf("Docker/%s (%s)", v.serverVersion, runtime.GOOS))
w.Header().Set("Api-Version", v.defaultAPIVersion)
w.Header().Set("Ostype", runtime.GOOS)
apiVersion := vars["version"]
if apiVersion == "" {
apiVersion = v.defaultAPIVersion
}
if versions.LessThan(apiVersion, v.minAPIVersion) {
return versionUnsupportedError{version: apiVersion, minVersion: v.minAPIVersion}
}
if versions.GreaterThan(apiVersion, v.defaultAPIVersion) {
return versionUnsupportedError{version: apiVersion, maxVersion: v.defaultAPIVersion}
}
ctx = context.WithValue(ctx, httputils.APIVersionKey{}, apiVersion)
return handler(ctx, w, r, vars)
}
}

View File

@@ -1,145 +0,0 @@
package middleware
import (
"context"
"fmt"
"net/http"
"net/http/httptest"
"runtime"
"testing"
"github.com/docker/docker/api"
"github.com/docker/docker/api/server/httputils"
"gotest.tools/v3/assert"
is "gotest.tools/v3/assert/cmp"
)
func TestNewVersionMiddlewareValidation(t *testing.T) {
tests := []struct {
doc, defaultVersion, minVersion, expectedErr string
}{
{
doc: "defaults",
defaultVersion: api.DefaultVersion,
minVersion: api.MinSupportedAPIVersion,
},
{
doc: "invalid default lower than min",
defaultVersion: api.MinSupportedAPIVersion,
minVersion: api.DefaultVersion,
expectedErr: fmt.Sprintf("invalid API version: the minimum API version (%s) is higher than the default version (%s)", api.DefaultVersion, api.MinSupportedAPIVersion),
},
{
doc: "invalid default too low",
defaultVersion: "0.1",
minVersion: api.MinSupportedAPIVersion,
expectedErr: fmt.Sprintf("invalid default API version (0.1): must be between %s and %s", api.MinSupportedAPIVersion, api.DefaultVersion),
},
{
doc: "invalid default too high",
defaultVersion: "9999.9999",
minVersion: api.DefaultVersion,
expectedErr: fmt.Sprintf("invalid default API version (9999.9999): must be between %s and %s", api.MinSupportedAPIVersion, api.DefaultVersion),
},
{
doc: "invalid minimum too low",
defaultVersion: api.MinSupportedAPIVersion,
minVersion: "0.1",
expectedErr: fmt.Sprintf("invalid minimum API version (0.1): must be between %s and %s", api.MinSupportedAPIVersion, api.DefaultVersion),
},
{
doc: "invalid minimum too high",
defaultVersion: api.DefaultVersion,
minVersion: "9999.9999",
expectedErr: fmt.Sprintf("invalid minimum API version (9999.9999): must be between %s and %s", api.MinSupportedAPIVersion, api.DefaultVersion),
},
}
for _, tc := range tests {
t.Run(tc.doc, func(t *testing.T) {
_, err := NewVersionMiddleware("1.2.3", tc.defaultVersion, tc.minVersion)
if tc.expectedErr == "" {
assert.Check(t, err)
} else {
assert.Check(t, is.Error(err, tc.expectedErr))
}
})
}
}
func TestVersionMiddlewareVersion(t *testing.T) {
expectedVersion := "<not set>"
handler := func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
v := httputils.VersionFromContext(ctx)
assert.Check(t, is.Equal(expectedVersion, v))
return nil
}
m, err := NewVersionMiddleware("1.2.3", api.DefaultVersion, api.MinSupportedAPIVersion)
assert.NilError(t, err)
h := m.WrapHandler(handler)
req, _ := http.NewRequest(http.MethodGet, "/containers/json", http.NoBody)
resp := httptest.NewRecorder()
ctx := context.Background()
tests := []struct {
reqVersion string
expectedVersion string
errString string
}{
{
expectedVersion: api.DefaultVersion,
},
{
reqVersion: api.MinSupportedAPIVersion,
expectedVersion: api.MinSupportedAPIVersion,
},
{
reqVersion: "0.1",
errString: fmt.Sprintf("client version 0.1 is too old. Minimum supported API version is %s, please upgrade your client to a newer version", api.MinSupportedAPIVersion),
},
{
reqVersion: "9999.9999",
errString: fmt.Sprintf("client version 9999.9999 is too new. Maximum supported API version is %s", api.DefaultVersion),
},
}
for _, test := range tests {
expectedVersion = test.expectedVersion
err := h(ctx, resp, req, map[string]string{"version": test.reqVersion})
if test.errString != "" {
assert.Check(t, is.Error(err, test.errString))
} else {
assert.Check(t, err)
}
}
}
func TestVersionMiddlewareWithErrorsReturnsHeaders(t *testing.T) {
handler := func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
v := httputils.VersionFromContext(ctx)
assert.Check(t, v != "")
return nil
}
m, err := NewVersionMiddleware("1.2.3", api.DefaultVersion, api.MinSupportedAPIVersion)
assert.NilError(t, err)
h := m.WrapHandler(handler)
req, _ := http.NewRequest(http.MethodGet, "/containers/json", http.NoBody)
resp := httptest.NewRecorder()
ctx := context.Background()
vars := map[string]string{"version": "0.1"}
err = h(ctx, resp, req, vars)
assert.Check(t, is.ErrorContains(err, ""))
hdr := resp.Result().Header
assert.Check(t, is.Contains(hdr.Get("Server"), "Docker/1.2.3"))
assert.Check(t, is.Contains(hdr.Get("Server"), runtime.GOOS))
assert.Check(t, is.Equal(hdr.Get("Api-Version"), api.DefaultVersion))
assert.Check(t, is.Equal(hdr.Get("Ostype"), runtime.GOOS))
}

View File

@@ -1,23 +0,0 @@
package build
import (
"context"
"github.com/docker/docker/api/types/backend"
"github.com/docker/docker/api/types/build"
)
// Backend abstracts an image builder whose only purpose is to build an image referenced by an imageID.
type Backend interface {
// Build a Docker image returning the id of the image
// TODO: make this return a reference instead of string
Build(context.Context, backend.BuildConfig) (string, error)
// PruneCache prunes the build cache.
PruneCache(context.Context, build.CachePruneOptions) (*build.CachePruneReport, error)
Cancel(context.Context, string) error
}
type experimentalProvider interface {
HasExperimental() bool
}

View File

@@ -1,67 +0,0 @@
package build
import (
"runtime"
"github.com/docker/docker/api/server/router"
"github.com/docker/docker/api/types/build"
)
// buildRouter is a router to talk with the build controller
type buildRouter struct {
backend Backend
daemon experimentalProvider
routes []router.Route
}
// NewRouter initializes a new build router
func NewRouter(b Backend, d experimentalProvider) router.Router {
r := &buildRouter{
backend: b,
daemon: d,
}
r.initRoutes()
return r
}
// Routes returns the available routers to the build controller
func (br *buildRouter) Routes() []router.Route {
return br.routes
}
func (br *buildRouter) initRoutes() {
br.routes = []router.Route{
router.NewPostRoute("/build", br.postBuild),
router.NewPostRoute("/build/prune", br.postPrune),
router.NewPostRoute("/build/cancel", br.postCancel),
}
}
// BuilderVersion derives the default docker builder version from the config.
//
// The default on Linux is version "2" (BuildKit), but the daemon can be
// configured to recommend version "1" (classic Builder). Windows does not
// yet support BuildKit for native Windows images, and uses "1" (classic builder)
// as a default.
//
// This value is only a recommendation as advertised by the daemon, and it is
// up to the client to choose which builder to use.
func BuilderVersion(features map[string]bool) build.BuilderVersion {
// TODO(thaJeztah) move the default to daemon/config
bv := build.BuilderBuildKit
if runtime.GOOS == "windows" {
// BuildKit is not yet the default on Windows.
bv = build.BuilderV1
}
// Allow the features field in the daemon config to override the
// default builder to advertise.
if enable, ok := features["buildkit"]; ok {
if enable {
bv = build.BuilderBuildKit
} else {
bv = build.BuilderV1
}
}
return bv
}

View File

@@ -1,10 +0,0 @@
package checkpoint
import "github.com/docker/docker/api/types/checkpoint"
// Backend for Checkpoint
type Backend interface {
CheckpointCreate(container string, config checkpoint.CreateOptions) error
CheckpointDelete(container string, config checkpoint.DeleteOptions) error
CheckpointList(container string, config checkpoint.ListOptions) ([]checkpoint.Summary, error)
}

View File

@@ -1,36 +0,0 @@
package checkpoint
import (
"github.com/docker/docker/api/server/httputils"
"github.com/docker/docker/api/server/router"
)
// checkpointRouter is a router to talk with the checkpoint controller
type checkpointRouter struct {
backend Backend
decoder httputils.ContainerDecoder
routes []router.Route
}
// NewRouter initializes a new checkpoint router
func NewRouter(b Backend, decoder httputils.ContainerDecoder) router.Router {
r := &checkpointRouter{
backend: b,
decoder: decoder,
}
r.initRoutes()
return r
}
// Routes returns the available routers to the checkpoint controller
func (cr *checkpointRouter) Routes() []router.Route {
return cr.routes
}
func (cr *checkpointRouter) initRoutes() {
cr.routes = []router.Route{
router.NewGetRoute("/containers/{name:.*}/checkpoints", cr.getContainerCheckpoints, router.Experimental),
router.NewPostRoute("/containers/{name:.*}/checkpoints", cr.postContainerCheckpoint, router.Experimental),
router.NewDeleteRoute("/containers/{name}/checkpoints/{checkpoint}", cr.deleteContainerCheckpoint, router.Experimental),
}
}

View File

@@ -1,60 +0,0 @@
package checkpoint
import (
"context"
"net/http"
"github.com/docker/docker/api/server/httputils"
"github.com/docker/docker/api/types/checkpoint"
)
func (cr *checkpointRouter) postContainerCheckpoint(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
if err := httputils.ParseForm(r); err != nil {
return err
}
var options checkpoint.CreateOptions
if err := httputils.ReadJSON(r, &options); err != nil {
return err
}
err := cr.backend.CheckpointCreate(vars["name"], options)
if err != nil {
return err
}
w.WriteHeader(http.StatusCreated)
return nil
}
func (cr *checkpointRouter) getContainerCheckpoints(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
if err := httputils.ParseForm(r); err != nil {
return err
}
checkpoints, err := cr.backend.CheckpointList(vars["name"], checkpoint.ListOptions{
CheckpointDir: r.Form.Get("dir"),
})
if err != nil {
return err
}
return httputils.WriteJSON(w, http.StatusOK, checkpoints)
}
func (cr *checkpointRouter) deleteContainerCheckpoint(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
if err := httputils.ParseForm(r); err != nil {
return err
}
err := cr.backend.CheckpointDelete(vars["name"], checkpoint.DeleteOptions{
CheckpointDir: r.Form.Get("dir"),
CheckpointID: vars["checkpoint"],
})
if err != nil {
return err
}
w.WriteHeader(http.StatusNoContent)
return nil
}

View File

@@ -1,79 +0,0 @@
package container
import (
"context"
"io"
"github.com/docker/docker/api/types/backend"
"github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/filters"
"github.com/moby/go-archive"
)
// execBackend includes functions to implement to provide exec functionality.
type execBackend interface {
ContainerExecCreate(name string, options *container.ExecOptions) (string, error)
ContainerExecInspect(id string) (*backend.ExecInspect, error)
ContainerExecResize(ctx context.Context, name string, height, width uint32) error
ContainerExecStart(ctx context.Context, name string, options backend.ExecStartConfig) error
ExecExists(name string) (bool, error)
}
// copyBackend includes functions to implement to provide container copy functionality.
type copyBackend interface {
ContainerArchivePath(name string, path string) (content io.ReadCloser, stat *container.PathStat, err error)
ContainerExport(ctx context.Context, name string, out io.Writer) error
ContainerExtractToDir(name, path string, copyUIDGID, noOverwriteDirNonDir bool, content io.Reader) error
ContainerStatPath(name string, path string) (stat *container.PathStat, err error)
}
// stateBackend includes functions to implement to provide container state lifecycle functionality.
type stateBackend interface {
ContainerCreate(ctx context.Context, config backend.ContainerCreateConfig) (container.CreateResponse, error)
ContainerKill(name string, signal string) error
ContainerPause(name string) error
ContainerRename(oldName, newName string) error
ContainerResize(ctx context.Context, name string, height, width uint32) error
ContainerRestart(ctx context.Context, name string, options container.StopOptions) error
ContainerRm(name string, config *backend.ContainerRmConfig) error
ContainerStart(ctx context.Context, name string, checkpoint string, checkpointDir string) error
ContainerStop(ctx context.Context, name string, options container.StopOptions) error
ContainerUnpause(name string) error
ContainerUpdate(name string, hostConfig *container.HostConfig) (container.UpdateResponse, error)
ContainerWait(ctx context.Context, name string, condition container.WaitCondition) (<-chan container.StateStatus, error)
}
// monitorBackend includes functions to implement to provide containers monitoring functionality.
type monitorBackend interface {
ContainerChanges(ctx context.Context, name string) ([]archive.Change, error)
ContainerInspect(ctx context.Context, name string, options backend.ContainerInspectOptions) (*container.InspectResponse, error)
ContainerLogs(ctx context.Context, name string, config *container.LogsOptions) (msgs <-chan *backend.LogMessage, tty bool, err error)
ContainerStats(ctx context.Context, name string, config *backend.ContainerStatsConfig) error
ContainerTop(name string, psArgs string) (*container.TopResponse, error)
Containers(ctx context.Context, config *container.ListOptions) ([]*container.Summary, error)
}
// attachBackend includes function to implement to provide container attaching functionality.
type attachBackend interface {
ContainerAttach(name string, c *backend.ContainerAttachConfig) error
}
// systemBackend includes functions to implement to provide system wide containers functionality
type systemBackend interface {
ContainersPrune(ctx context.Context, pruneFilters filters.Args) (*container.PruneReport, error)
}
type commitBackend interface {
CreateImageFromContainer(ctx context.Context, name string, config *backend.CreateImageConfig) (imageID string, err error)
}
// Backend is all the methods that need to be implemented to provide container specific functionality.
type Backend interface {
commitBackend
execBackend
copyBackend
stateBackend
monitorBackend
attachBackend
systemBackend
}

View File

@@ -1,71 +0,0 @@
package container
import (
"github.com/docker/docker/api/server/httputils"
"github.com/docker/docker/api/server/router"
)
// containerRouter is a router to talk with the container controller
type containerRouter struct {
backend Backend
decoder httputils.ContainerDecoder
routes []router.Route
cgroup2 bool
}
// NewRouter initializes a new container router
func NewRouter(b Backend, decoder httputils.ContainerDecoder, cgroup2 bool) router.Router {
r := &containerRouter{
backend: b,
decoder: decoder,
cgroup2: cgroup2,
}
r.initRoutes()
return r
}
// Routes returns the available routes to the container controller
func (c *containerRouter) Routes() []router.Route {
return c.routes
}
// initRoutes initializes the routes in container router
func (c *containerRouter) initRoutes() {
c.routes = []router.Route{
// HEAD
router.NewHeadRoute("/containers/{name:.*}/archive", c.headContainersArchive),
// GET
router.NewGetRoute("/containers/json", c.getContainersJSON),
router.NewGetRoute("/containers/{name:.*}/export", c.getContainersExport),
router.NewGetRoute("/containers/{name:.*}/changes", c.getContainersChanges),
router.NewGetRoute("/containers/{name:.*}/json", c.getContainersByName),
router.NewGetRoute("/containers/{name:.*}/top", c.getContainersTop),
router.NewGetRoute("/containers/{name:.*}/logs", c.getContainersLogs),
router.NewGetRoute("/containers/{name:.*}/stats", c.getContainersStats),
router.NewGetRoute("/containers/{name:.*}/attach/ws", c.wsContainersAttach),
router.NewGetRoute("/exec/{id:.*}/json", c.getExecByID),
router.NewGetRoute("/containers/{name:.*}/archive", c.getContainersArchive),
// POST
router.NewPostRoute("/containers/create", c.postContainersCreate),
router.NewPostRoute("/containers/{name:.*}/kill", c.postContainersKill),
router.NewPostRoute("/containers/{name:.*}/pause", c.postContainersPause),
router.NewPostRoute("/containers/{name:.*}/unpause", c.postContainersUnpause),
router.NewPostRoute("/containers/{name:.*}/restart", c.postContainersRestart),
router.NewPostRoute("/containers/{name:.*}/start", c.postContainersStart),
router.NewPostRoute("/containers/{name:.*}/stop", c.postContainersStop),
router.NewPostRoute("/containers/{name:.*}/wait", c.postContainersWait),
router.NewPostRoute("/containers/{name:.*}/resize", c.postContainersResize),
router.NewPostRoute("/containers/{name:.*}/attach", c.postContainersAttach),
router.NewPostRoute("/containers/{name:.*}/exec", c.postContainerExecCreate),
router.NewPostRoute("/exec/{name:.*}/start", c.postContainerExecStart),
router.NewPostRoute("/exec/{name:.*}/resize", c.postContainerExecResize),
router.NewPostRoute("/containers/{name:.*}/rename", c.postContainerRename),
router.NewPostRoute("/containers/{name:.*}/update", c.postContainerUpdate),
router.NewPostRoute("/containers/prune", c.postContainersPrune),
router.NewPostRoute("/commit", c.postCommit),
// PUT
router.NewPutRoute("/containers/{name:.*}/archive", c.putContainersArchive),
// DELETE
router.NewDeleteRoute("/containers/{name:.*}", c.deleteContainers),
}
}

View File

@@ -1,99 +0,0 @@
package container
import (
"compress/flate"
"compress/gzip"
"context"
"encoding/base64"
"encoding/json"
"io"
"net/http"
"github.com/docker/docker/api/server/httputils"
"github.com/docker/docker/api/types/container"
gddohttputil "github.com/golang/gddo/httputil"
)
// setContainerPathStatHeader encodes the stat to JSON, base64 encode, and place in a header.
func setContainerPathStatHeader(stat *container.PathStat, header http.Header) error {
statJSON, err := json.Marshal(stat)
if err != nil {
return err
}
header.Set(
"X-Docker-Container-Path-Stat",
base64.StdEncoding.EncodeToString(statJSON),
)
return nil
}
func (c *containerRouter) headContainersArchive(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
v, err := httputils.ArchiveFormValues(r, vars)
if err != nil {
return err
}
stat, err := c.backend.ContainerStatPath(v.Name, v.Path)
if err != nil {
return err
}
return setContainerPathStatHeader(stat, w.Header())
}
func writeCompressedResponse(w http.ResponseWriter, r *http.Request, body io.Reader) error {
var cw io.Writer
switch gddohttputil.NegotiateContentEncoding(r, []string{"gzip", "deflate"}) {
case "gzip":
gw := gzip.NewWriter(w)
defer gw.Close()
cw = gw
w.Header().Set("Content-Encoding", "gzip")
case "deflate":
fw, err := flate.NewWriter(w, flate.DefaultCompression)
if err != nil {
return err
}
defer fw.Close()
cw = fw
w.Header().Set("Content-Encoding", "deflate")
default:
cw = w
}
_, err := io.Copy(cw, body)
return err
}
func (c *containerRouter) getContainersArchive(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
v, err := httputils.ArchiveFormValues(r, vars)
if err != nil {
return err
}
tarArchive, stat, err := c.backend.ContainerArchivePath(v.Name, v.Path)
if err != nil {
return err
}
defer tarArchive.Close()
if err := setContainerPathStatHeader(stat, w.Header()); err != nil {
return err
}
w.Header().Set("Content-Type", "application/x-tar")
return writeCompressedResponse(w, r, tarArchive)
}
func (c *containerRouter) putContainersArchive(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
v, err := httputils.ArchiveFormValues(r, vars)
if err != nil {
return err
}
noOverwriteDirNonDir := httputils.BoolValue(r, "noOverwriteDirNonDir")
copyUIDGID := httputils.BoolValue(r, "copyUIDGID")
return c.backend.ContainerExtractToDir(v.Name, v.Path, copyUIDGID, noOverwriteDirNonDir, r.Body)
}

View File

@@ -1,171 +0,0 @@
package container
import (
"context"
"fmt"
"io"
"net/http"
"github.com/containerd/log"
"github.com/docker/docker/api/server/httputils"
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/backend"
"github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/versions"
"github.com/docker/docker/errdefs"
"github.com/docker/docker/pkg/stdcopy"
"github.com/pkg/errors"
)
func (c *containerRouter) getExecByID(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
eConfig, err := c.backend.ContainerExecInspect(vars["id"])
if err != nil {
return err
}
return httputils.WriteJSON(w, http.StatusOK, eConfig)
}
type execCommandError struct{}
func (execCommandError) Error() string {
return "No exec command specified"
}
func (execCommandError) InvalidParameter() {}
func (c *containerRouter) postContainerExecCreate(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
if err := httputils.ParseForm(r); err != nil {
return err
}
execConfig := &container.ExecOptions{}
if err := httputils.ReadJSON(r, execConfig); err != nil {
return err
}
if len(execConfig.Cmd) == 0 {
return execCommandError{}
}
version := httputils.VersionFromContext(ctx)
if versions.LessThan(version, "1.42") {
// Not supported by API versions before 1.42
execConfig.ConsoleSize = nil
}
// Register an instance of Exec in container.
id, err := c.backend.ContainerExecCreate(vars["name"], execConfig)
if err != nil {
log.G(ctx).Errorf("Error setting up exec command in container %s: %v", vars["name"], err)
return err
}
return httputils.WriteJSON(w, http.StatusCreated, &container.ExecCreateResponse{
ID: id,
})
}
// TODO(vishh): Refactor the code to avoid having to specify stream config as part of both create and start.
func (c *containerRouter) postContainerExecStart(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
if err := httputils.ParseForm(r); err != nil {
return err
}
var (
execName = vars["name"]
stdin, inStream io.ReadCloser
stdout, stderr, outStream io.Writer
)
options := &container.ExecStartOptions{}
if err := httputils.ReadJSON(r, options); err != nil {
return err
}
if exists, err := c.backend.ExecExists(execName); !exists {
return err
}
if options.ConsoleSize != nil {
version := httputils.VersionFromContext(ctx)
// Not supported before 1.42
if versions.LessThan(version, "1.42") {
options.ConsoleSize = nil
}
// No console without tty
if !options.Tty {
options.ConsoleSize = nil
}
}
if !options.Detach {
var err error
// Setting up the streaming http interface.
inStream, outStream, err = httputils.HijackConnection(w)
if err != nil {
return err
}
defer httputils.CloseStreams(inStream, outStream)
if _, ok := r.Header["Upgrade"]; ok {
contentType := types.MediaTypeRawStream
if !options.Tty && versions.GreaterThanOrEqualTo(httputils.VersionFromContext(ctx), "1.42") {
contentType = types.MediaTypeMultiplexedStream
}
_, _ = fmt.Fprint(outStream, "HTTP/1.1 101 UPGRADED\r\nContent-Type: "+contentType+"\r\nConnection: Upgrade\r\nUpgrade: tcp\r\n")
} else {
_, _ = fmt.Fprint(outStream, "HTTP/1.1 200 OK\r\nContent-Type: application/vnd.docker.raw-stream\r\n")
}
// copy headers that were removed as part of hijack
if err := w.Header().WriteSubset(outStream, nil); err != nil {
return err
}
_, _ = fmt.Fprint(outStream, "\r\n")
stdin = inStream
if options.Tty {
stdout = outStream
} else {
stderr = stdcopy.NewStdWriter(outStream, stdcopy.Stderr)
stdout = stdcopy.NewStdWriter(outStream, stdcopy.Stdout)
}
}
// Now run the user process in container.
//
// TODO: Maybe we should we pass ctx here if we're not detaching?
err := c.backend.ContainerExecStart(context.Background(), execName, backend.ExecStartConfig{
Stdin: stdin,
Stdout: stdout,
Stderr: stderr,
ConsoleSize: options.ConsoleSize,
})
if err != nil {
if options.Detach {
return err
}
_, _ = fmt.Fprintf(stdout, "%v\r\n", err)
log.G(ctx).Errorf("Error running exec %s in container: %v", execName, err)
}
return nil
}
func (c *containerRouter) postContainerExecResize(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
if err := httputils.ParseForm(r); err != nil {
return err
}
height, err := httputils.Uint32Value(r, "h")
if err != nil {
return errdefs.InvalidParameter(errors.Wrapf(err, "invalid resize height %q", r.Form.Get("h")))
}
width, err := httputils.Uint32Value(r, "w")
if err != nil {
return errdefs.InvalidParameter(errors.Wrapf(err, "invalid resize width %q", r.Form.Get("w")))
}
return c.backend.ContainerExecResize(ctx, vars["name"], height, width)
}

View File

@@ -1,41 +0,0 @@
// FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16:
//go:build go1.23
package container
import (
"context"
"net/http"
"github.com/docker/docker/api/server/httputils"
"github.com/docker/docker/api/types/backend"
"github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/versions"
"github.com/docker/docker/internal/sliceutil"
"github.com/docker/docker/pkg/stringid"
)
// getContainersByName inspects container's configuration and serializes it as json.
func (c *containerRouter) getContainersByName(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
ctr, err := c.backend.ContainerInspect(ctx, vars["name"], backend.ContainerInspectOptions{
Size: httputils.BoolValue(r, "size"),
})
if err != nil {
return err
}
version := httputils.VersionFromContext(ctx)
if versions.LessThan(version, "1.45") {
shortCID := stringid.TruncateID(ctr.ID)
for nwName, ep := range ctr.NetworkSettings.Networks {
if container.NetworkMode(nwName).IsUserDefined() {
ep.Aliases = sliceutil.Dedup(append(ep.Aliases, shortCID, ctr.Config.Hostname))
}
}
}
if versions.LessThan(version, "1.48") {
ctr.ImageManifestDescriptor = nil
}
return httputils.WriteJSON(w, http.StatusOK, ctr)
}

View File

@@ -1,53 +0,0 @@
package debug
import (
"context"
"expvar"
"net/http"
"net/http/pprof"
"github.com/docker/docker/api/server/httputils"
"github.com/docker/docker/api/server/router"
)
// NewRouter creates a new debug router
// The debug router holds endpoints for debug the daemon, such as those for pprof.
func NewRouter() router.Router {
r := &debugRouter{}
r.initRoutes()
return r
}
type debugRouter struct {
routes []router.Route
}
func (r *debugRouter) initRoutes() {
r.routes = []router.Route{
router.NewGetRoute("/debug/vars", frameworkAdaptHandler(expvar.Handler())),
router.NewGetRoute("/debug/pprof/", frameworkAdaptHandlerFunc(pprof.Index)),
router.NewGetRoute("/debug/pprof/cmdline", frameworkAdaptHandlerFunc(pprof.Cmdline)),
router.NewGetRoute("/debug/pprof/profile", frameworkAdaptHandlerFunc(pprof.Profile)),
router.NewGetRoute("/debug/pprof/symbol", frameworkAdaptHandlerFunc(pprof.Symbol)),
router.NewGetRoute("/debug/pprof/trace", frameworkAdaptHandlerFunc(pprof.Trace)),
router.NewGetRoute("/debug/pprof/{name}", handlePprof),
}
}
func (r *debugRouter) Routes() []router.Route {
return r.routes
}
func frameworkAdaptHandler(handler http.Handler) httputils.APIFunc {
return func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
handler.ServeHTTP(w, r)
return nil
}
}
func frameworkAdaptHandlerFunc(handler http.HandlerFunc) httputils.APIFunc {
return func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
handler(w, r)
return nil
}
}

View File

@@ -1,15 +0,0 @@
package distribution
import (
"context"
"github.com/distribution/reference"
"github.com/docker/distribution"
"github.com/docker/docker/api/types/registry"
)
// Backend is all the methods that need to be implemented
// to provide image specific functionality.
type Backend interface {
GetRepositories(context.Context, reference.Named, *registry.AuthConfig) ([]distribution.Repository, error)
}

View File

@@ -1,47 +0,0 @@
package image
import (
"context"
"io"
"github.com/distribution/reference"
"github.com/docker/docker/api/types/backend"
"github.com/docker/docker/api/types/filters"
"github.com/docker/docker/api/types/image"
"github.com/docker/docker/api/types/registry"
dockerimage "github.com/docker/docker/image"
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
)
// Backend is all the methods that need to be implemented
// to provide image specific functionality.
type Backend interface {
imageBackend
importExportBackend
registryBackend
}
type imageBackend interface {
ImageDelete(ctx context.Context, imageRef string, options image.RemoveOptions) ([]image.DeleteResponse, error)
ImageHistory(ctx context.Context, imageName string, platform *ocispec.Platform) ([]*image.HistoryResponseItem, error)
Images(ctx context.Context, opts image.ListOptions) ([]*image.Summary, error)
GetImage(ctx context.Context, refOrID string, options backend.GetImageOpts) (*dockerimage.Image, error)
ImageInspect(ctx context.Context, refOrID string, options backend.ImageInspectOpts) (*image.InspectResponse, error)
TagImage(ctx context.Context, id dockerimage.ID, newRef reference.Named) error
ImagesPrune(ctx context.Context, pruneFilters filters.Args) (*image.PruneReport, error)
}
type importExportBackend interface {
LoadImage(ctx context.Context, inTar io.ReadCloser, platform *ocispec.Platform, outStream io.Writer, quiet bool) error
ImportImage(ctx context.Context, ref reference.Named, platform *ocispec.Platform, msg string, layerReader io.Reader, changes []string) (dockerimage.ID, error)
ExportImage(ctx context.Context, names []string, platform *ocispec.Platform, outStream io.Writer) error
}
type registryBackend interface {
PullImage(ctx context.Context, ref reference.Named, platform *ocispec.Platform, metaHeaders map[string][]string, authConfig *registry.AuthConfig, outStream io.Writer) error
PushImage(ctx context.Context, ref reference.Named, platform *ocispec.Platform, metaHeaders map[string][]string, authConfig *registry.AuthConfig, outStream io.Writer) error
}
type Searcher interface {
Search(ctx context.Context, searchFilters filters.Args, term string, limit int, authConfig *registry.AuthConfig, headers map[string][]string) ([]registry.SearchResult, error)
}

View File

@@ -1,48 +0,0 @@
package image
import (
"github.com/docker/docker/api/server/router"
)
// imageRouter is a router to talk with the image controller
type imageRouter struct {
backend Backend
searcher Searcher
routes []router.Route
}
// NewRouter initializes a new image router
func NewRouter(backend Backend, searcher Searcher) router.Router {
ir := &imageRouter{
backend: backend,
searcher: searcher,
}
ir.initRoutes()
return ir
}
// Routes returns the available routes to the image controller
func (ir *imageRouter) Routes() []router.Route {
return ir.routes
}
// initRoutes initializes the routes in the image router
func (ir *imageRouter) initRoutes() {
ir.routes = []router.Route{
// GET
router.NewGetRoute("/images/json", ir.getImagesJSON),
router.NewGetRoute("/images/search", ir.getImagesSearch),
router.NewGetRoute("/images/get", ir.getImagesGet),
router.NewGetRoute("/images/{name:.*}/get", ir.getImagesGet),
router.NewGetRoute("/images/{name:.*}/history", ir.getImagesHistory),
router.NewGetRoute("/images/{name:.*}/json", ir.getImagesByName),
// POST
router.NewPostRoute("/images/load", ir.postImagesLoad),
router.NewPostRoute("/images/create", ir.postImagesCreate),
router.NewPostRoute("/images/{name:.*}/push", ir.postImagesPush),
router.NewPostRoute("/images/{name:.*}/tag", ir.postImagesTag),
router.NewPostRoute("/images/prune", ir.postImagesPrune),
// DELETE
router.NewDeleteRoute("/images/{name:.*}", ir.deleteImages),
}
}

View File

@@ -1,602 +0,0 @@
package image
import (
"context"
"fmt"
"io"
"net/http"
"net/url"
"strconv"
"strings"
"time"
"github.com/containerd/platforms"
"github.com/distribution/reference"
"github.com/docker/docker/api"
"github.com/docker/docker/api/server/httputils"
"github.com/docker/docker/api/types/backend"
"github.com/docker/docker/api/types/filters"
imagetypes "github.com/docker/docker/api/types/image"
"github.com/docker/docker/api/types/registry"
"github.com/docker/docker/api/types/versions"
"github.com/docker/docker/builder/remotecontext"
"github.com/docker/docker/dockerversion"
"github.com/docker/docker/errdefs"
"github.com/docker/docker/image"
"github.com/docker/docker/pkg/ioutils"
"github.com/docker/docker/pkg/progress"
"github.com/docker/docker/pkg/streamformatter"
"github.com/opencontainers/go-digest"
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/pkg/errors"
)
// Creates an image from Pull or from Import
func (ir *imageRouter) postImagesCreate(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
if err := httputils.ParseForm(r); err != nil {
return err
}
var (
img = r.Form.Get("fromImage")
repo = r.Form.Get("repo")
tag = r.Form.Get("tag")
comment = r.Form.Get("message")
progressErr error
output = ioutils.NewWriteFlusher(w)
platform *ocispec.Platform
)
defer output.Close()
w.Header().Set("Content-Type", "application/json")
version := httputils.VersionFromContext(ctx)
if versions.GreaterThanOrEqualTo(version, "1.32") {
if p := r.FormValue("platform"); p != "" {
sp, err := platforms.Parse(p)
if err != nil {
return errdefs.InvalidParameter(err)
}
platform = &sp
}
}
if img != "" { // pull
metaHeaders := map[string][]string{}
for k, v := range r.Header {
if strings.HasPrefix(k, "X-Meta-") {
metaHeaders[k] = v
}
}
// Special case: "pull -a" may send an image name with a
// trailing :. This is ugly, but let's not break API
// compatibility.
imgName := strings.TrimSuffix(img, ":")
ref, err := reference.ParseNormalizedNamed(imgName)
if err != nil {
return errdefs.InvalidParameter(err)
}
// TODO(thaJeztah) this could use a WithTagOrDigest() utility
if tag != "" {
// The "tag" could actually be a digest.
var dgst digest.Digest
dgst, err = digest.Parse(tag)
if err == nil {
ref, err = reference.WithDigest(reference.TrimNamed(ref), dgst)
} else {
ref, err = reference.WithTag(ref, tag)
}
if err != nil {
return errdefs.InvalidParameter(err)
}
}
if err := validateRepoName(ref); err != nil {
return errdefs.Forbidden(err)
}
// For a pull it is not an error if no auth was given. Ignore invalid
// AuthConfig to increase compatibility with the existing API.
authConfig, _ := registry.DecodeAuthConfig(r.Header.Get(registry.AuthHeader))
progressErr = ir.backend.PullImage(ctx, ref, platform, metaHeaders, authConfig, output)
} else { // import
src := r.Form.Get("fromSrc")
tagRef, err := httputils.RepoTagReference(repo, tag)
if err != nil {
return errdefs.InvalidParameter(err)
}
if comment == "" {
comment = "Imported from " + src
}
var layerReader io.ReadCloser
defer r.Body.Close()
if src == "-" {
layerReader = r.Body
} else {
if len(strings.Split(src, "://")) == 1 {
src = "http://" + src
}
u, err := url.Parse(src)
if err != nil {
return errdefs.InvalidParameter(err)
}
resp, err := remotecontext.GetWithStatusError(u.String())
if err != nil {
return err
}
output.Write(streamformatter.FormatStatus("", "Downloading from %s", u))
progressOutput := streamformatter.NewJSONProgressOutput(output, true)
layerReader = progress.NewProgressReader(resp.Body, progressOutput, resp.ContentLength, "", "Importing")
defer layerReader.Close()
}
var id image.ID
id, progressErr = ir.backend.ImportImage(ctx, tagRef, platform, comment, layerReader, r.Form["changes"])
if progressErr == nil {
_, _ = output.Write(streamformatter.FormatStatus("", "%v", id.String()))
}
}
if progressErr != nil {
if !output.Flushed() {
return progressErr
}
_, _ = output.Write(streamformatter.FormatError(progressErr))
}
return nil
}
func (ir *imageRouter) postImagesPush(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
metaHeaders := map[string][]string{}
for k, v := range r.Header {
if strings.HasPrefix(k, "X-Meta-") {
metaHeaders[k] = v
}
}
if err := httputils.ParseForm(r); err != nil {
return err
}
var authConfig *registry.AuthConfig
if authEncoded := r.Header.Get(registry.AuthHeader); authEncoded != "" {
// the new format is to handle the authConfig as a header. Ignore invalid
// AuthConfig to increase compatibility with the existing API.
authConfig, _ = registry.DecodeAuthConfig(authEncoded)
} else {
// the old format is supported for compatibility if there was no authConfig header
var err error
authConfig, err = registry.DecodeAuthConfigBody(r.Body)
if err != nil {
return errors.Wrap(err, "bad parameters and missing X-Registry-Auth")
}
}
output := ioutils.NewWriteFlusher(w)
defer output.Close()
w.Header().Set("Content-Type", "application/json")
img := vars["name"]
tag := r.Form.Get("tag")
var ref reference.Named
// Tag is empty only in case PushOptions.All is true.
if tag != "" {
r, err := httputils.RepoTagReference(img, tag)
if err != nil {
return errdefs.InvalidParameter(err)
}
ref = r
} else {
r, err := reference.ParseNormalizedNamed(img)
if err != nil {
return errdefs.InvalidParameter(err)
}
ref = r
}
var platform *ocispec.Platform
// Platform is optional, and only supported in API version 1.46 and later.
// However the PushOptions struct previously was an alias for the PullOptions struct
// which also contained a Platform field.
// This means that older clients may be sending a platform field, even
// though it wasn't really supported by the server.
// Don't break these clients and just ignore the platform field on older APIs.
if versions.GreaterThanOrEqualTo(httputils.VersionFromContext(ctx), "1.46") {
if formPlatform := r.Form.Get("platform"); formPlatform != "" {
p, err := httputils.DecodePlatform(formPlatform)
if err != nil {
return err
}
platform = p
}
}
if err := ir.backend.PushImage(ctx, ref, platform, metaHeaders, authConfig, output); err != nil {
if !output.Flushed() {
return err
}
_, _ = output.Write(streamformatter.FormatError(err))
}
return nil
}
func (ir *imageRouter) getImagesGet(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
if err := httputils.ParseForm(r); err != nil {
return err
}
w.Header().Set("Content-Type", "application/x-tar")
output := ioutils.NewWriteFlusher(w)
defer output.Close()
var names []string
if name, ok := vars["name"]; ok {
names = []string{name}
} else {
names = r.Form["names"]
}
var platform *ocispec.Platform
if versions.GreaterThanOrEqualTo(httputils.VersionFromContext(ctx), "1.48") {
if formPlatforms := r.Form["platform"]; len(formPlatforms) > 1 {
// TODO(thaJeztah): remove once we support multiple platforms: see https://github.com/moby/moby/issues/48759
return errdefs.InvalidParameter(errors.New("multiple platform parameters not supported"))
}
if formPlatform := r.Form.Get("platform"); formPlatform != "" {
p, err := httputils.DecodePlatform(formPlatform)
if err != nil {
return err
}
platform = p
}
}
if err := ir.backend.ExportImage(ctx, names, platform, output); err != nil {
if !output.Flushed() {
return err
}
_, _ = output.Write(streamformatter.FormatError(err))
}
return nil
}
func (ir *imageRouter) postImagesLoad(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
if err := httputils.ParseForm(r); err != nil {
return err
}
var platform *ocispec.Platform
if versions.GreaterThanOrEqualTo(httputils.VersionFromContext(ctx), "1.48") {
if formPlatforms := r.Form["platform"]; len(formPlatforms) > 1 {
// TODO(thaJeztah): remove once we support multiple platforms: see https://github.com/moby/moby/issues/48759
return errdefs.InvalidParameter(errors.New("multiple platform parameters not supported"))
}
if formPlatform := r.Form.Get("platform"); formPlatform != "" {
p, err := httputils.DecodePlatform(formPlatform)
if err != nil {
return err
}
platform = p
}
}
quiet := httputils.BoolValueOrDefault(r, "quiet", true)
w.Header().Set("Content-Type", "application/json")
output := ioutils.NewWriteFlusher(w)
defer output.Close()
if err := ir.backend.LoadImage(ctx, r.Body, platform, output, quiet); err != nil {
_, _ = output.Write(streamformatter.FormatError(err))
}
return nil
}
type missingImageError struct{}
func (missingImageError) Error() string {
return "image name cannot be blank"
}
func (missingImageError) InvalidParameter() {}
func (ir *imageRouter) deleteImages(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
if err := httputils.ParseForm(r); err != nil {
return err
}
name := vars["name"]
if strings.TrimSpace(name) == "" {
return missingImageError{}
}
force := httputils.BoolValue(r, "force")
prune := !httputils.BoolValue(r, "noprune")
var platforms []ocispec.Platform
if versions.GreaterThanOrEqualTo(httputils.VersionFromContext(ctx), "1.50") {
p, err := httputils.DecodePlatforms(r.Form["platforms"])
if err != nil {
return err
}
platforms = p
}
list, err := ir.backend.ImageDelete(ctx, name, imagetypes.RemoveOptions{
Force: force,
PruneChildren: prune,
Platforms: platforms,
})
if err != nil {
return err
}
return httputils.WriteJSON(w, http.StatusOK, list)
}
func (ir *imageRouter) getImagesByName(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
if err := httputils.ParseForm(r); err != nil {
return err
}
var manifests bool
if r.Form.Get("manifests") != "" && versions.GreaterThanOrEqualTo(httputils.VersionFromContext(ctx), "1.48") {
manifests = httputils.BoolValue(r, "manifests")
}
var platform *ocispec.Platform
if r.Form.Get("platform") != "" && versions.GreaterThanOrEqualTo(httputils.VersionFromContext(ctx), "1.49") {
p, err := httputils.DecodePlatform(r.Form.Get("platform"))
if err != nil {
return errdefs.InvalidParameter(err)
}
platform = p
}
if manifests && platform != nil {
return errdefs.InvalidParameter(errors.New("conflicting options: manifests and platform options cannot both be set"))
}
resp, err := ir.backend.ImageInspect(ctx, vars["name"], backend.ImageInspectOpts{
Manifests: manifests,
Platform: platform,
})
if err != nil {
return err
}
// inspectResponse preserves fields in the response that have an
// "omitempty" in the OCI spec, but didn't omit such fields in
// legacy responses before API v1.50.
imageInspect := &inspectCompatResponse{
InspectResponse: resp,
legacyConfig: legacyConfigFields["current"],
}
// Make sure we output empty arrays instead of nil. While Go nil slice is functionally equivalent to an empty slice,
// it matters for the JSON representation.
if imageInspect.RepoTags == nil {
imageInspect.RepoTags = []string{}
}
if imageInspect.RepoDigests == nil {
imageInspect.RepoDigests = []string{}
}
version := httputils.VersionFromContext(ctx)
if versions.LessThan(version, "1.44") {
imageInspect.VirtualSize = imageInspect.Size //nolint:staticcheck // ignore SA1019: field is deprecated, but still set on API < v1.44.
if imageInspect.Created == "" {
// backwards compatibility for Created not existing returning "0001-01-01T00:00:00Z"
// https://github.com/moby/moby/issues/47368
imageInspect.Created = time.Time{}.Format(time.RFC3339Nano)
}
}
if versions.GreaterThanOrEqualTo(version, "1.45") {
imageInspect.Container = "" //nolint:staticcheck // ignore SA1019: field is deprecated, but still set on API < v1.45.
imageInspect.ContainerConfig = nil //nolint:staticcheck // ignore SA1019: field is deprecated, but still set on API < v1.45.
}
if versions.LessThan(version, "1.48") {
imageInspect.Descriptor = nil
}
if versions.LessThan(version, "1.50") {
imageInspect.legacyConfig = legacyConfigFields["v1.49"]
}
return httputils.WriteJSON(w, http.StatusOK, imageInspect)
}
func (ir *imageRouter) getImagesJSON(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
if err := httputils.ParseForm(r); err != nil {
return err
}
imageFilters, err := filters.FromJSON(r.Form.Get("filters"))
if err != nil {
return err
}
version := httputils.VersionFromContext(ctx)
if versions.LessThan(version, "1.41") {
// NOTE: filter is a shell glob string applied to repository names.
filterParam := r.Form.Get("filter")
if filterParam != "" {
imageFilters.Add("reference", filterParam)
}
}
var sharedSize bool
if versions.GreaterThanOrEqualTo(version, "1.42") {
// NOTE: Support for the "shared-size" parameter was added in API 1.42.
sharedSize = httputils.BoolValue(r, "shared-size")
}
var manifests bool
if versions.GreaterThanOrEqualTo(version, "1.47") {
manifests = httputils.BoolValue(r, "manifests")
}
images, err := ir.backend.Images(ctx, imagetypes.ListOptions{
All: httputils.BoolValue(r, "all"),
Filters: imageFilters,
SharedSize: sharedSize,
Manifests: manifests,
})
if err != nil {
return err
}
useNone := versions.LessThan(version, "1.43")
withVirtualSize := versions.LessThan(version, "1.44")
noDescriptor := versions.LessThan(version, "1.48")
noContainers := versions.LessThan(version, "1.51")
for _, img := range images {
if useNone {
if len(img.RepoTags) == 0 && len(img.RepoDigests) == 0 {
img.RepoTags = append(img.RepoTags, "<none>:<none>")
img.RepoDigests = append(img.RepoDigests, "<none>@<none>")
}
} else {
if img.RepoTags == nil {
img.RepoTags = []string{}
}
if img.RepoDigests == nil {
img.RepoDigests = []string{}
}
}
if withVirtualSize {
img.VirtualSize = img.Size //nolint:staticcheck // ignore SA1019: field is deprecated, but still set on API < v1.44.
}
if noDescriptor {
img.Descriptor = nil
}
if noContainers {
img.Containers = -1
}
}
return httputils.WriteJSON(w, http.StatusOK, images)
}
func (ir *imageRouter) getImagesHistory(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
if err := httputils.ParseForm(r); err != nil {
return err
}
var platform *ocispec.Platform
if versions.GreaterThanOrEqualTo(httputils.VersionFromContext(ctx), "1.48") {
if formPlatform := r.Form.Get("platform"); formPlatform != "" {
p, err := httputils.DecodePlatform(formPlatform)
if err != nil {
return err
}
platform = p
}
}
history, err := ir.backend.ImageHistory(ctx, vars["name"], platform)
if err != nil {
return err
}
return httputils.WriteJSON(w, http.StatusOK, history)
}
func (ir *imageRouter) postImagesTag(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
if err := httputils.ParseForm(r); err != nil {
return err
}
ref, err := httputils.RepoTagReference(r.Form.Get("repo"), r.Form.Get("tag"))
if ref == nil || err != nil {
return errdefs.InvalidParameter(err)
}
refName := reference.FamiliarName(ref)
if refName == string(digest.Canonical) {
return errdefs.InvalidParameter(errors.New("refusing to create an ambiguous tag using digest algorithm as name"))
}
img, err := ir.backend.GetImage(ctx, vars["name"], backend.GetImageOpts{})
if err != nil {
return errdefs.NotFound(err)
}
if err := ir.backend.TagImage(ctx, img.ID(), ref); err != nil {
return err
}
w.WriteHeader(http.StatusCreated)
return nil
}
func (ir *imageRouter) getImagesSearch(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
if err := httputils.ParseForm(r); err != nil {
return err
}
var limit int
if r.Form.Get("limit") != "" {
var err error
limit, err = strconv.Atoi(r.Form.Get("limit"))
if err != nil || limit < 0 {
return errdefs.InvalidParameter(errors.Wrap(err, "invalid limit specified"))
}
}
searchFilters, err := filters.FromJSON(r.Form.Get("filters"))
if err != nil {
return err
}
// For a search it is not an error if no auth was given. Ignore invalid
// AuthConfig to increase compatibility with the existing API.
authConfig, _ := registry.DecodeAuthConfig(r.Header.Get(registry.AuthHeader))
headers := http.Header{}
for k, v := range r.Header {
k = http.CanonicalHeaderKey(k)
if strings.HasPrefix(k, "X-Meta-") {
headers[k] = v
}
}
headers.Set("User-Agent", dockerversion.DockerUserAgent(ctx))
res, err := ir.searcher.Search(ctx, searchFilters, r.Form.Get("term"), limit, authConfig, headers)
if err != nil {
return err
}
return httputils.WriteJSON(w, http.StatusOK, res)
}
func (ir *imageRouter) postImagesPrune(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
if err := httputils.ParseForm(r); err != nil {
return err
}
pruneFilters, err := filters.FromJSON(r.Form.Get("filters"))
if err != nil {
return err
}
pruneReport, err := ir.backend.ImagesPrune(ctx, pruneFilters)
if err != nil {
return err
}
return httputils.WriteJSON(w, http.StatusOK, pruneReport)
}
// validateRepoName validates the name of a repository.
func validateRepoName(name reference.Named) error {
familiarName := reference.FamiliarName(name)
if familiarName == api.NoBaseImageSpecifier {
return fmt.Errorf("'%s' is a reserved name", familiarName)
}
return nil
}

View File

@@ -1,88 +0,0 @@
// FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16:
//go:build go1.23
package image
import (
"encoding/json"
"maps"
"github.com/docker/docker/api/types/image"
)
// legacyConfigFields defines legacy image-config fields to include in
// API responses on older API versions.
var legacyConfigFields = map[string]map[string]any{
// Legacy fields for API v1.49 and lower. These fields are deprecated
// and omitted in newer API versions; see https://github.com/moby/moby/pull/48457
"v1.49": {
"AttachStderr": false,
"AttachStdin": false,
"AttachStdout": false,
"Cmd": nil,
"Domainname": "",
"Entrypoint": nil,
"Env": nil,
"Hostname": "",
"Image": "",
"Labels": nil,
"OnBuild": nil,
"OpenStdin": false,
"StdinOnce": false,
"Tty": false,
"User": "",
"Volumes": nil,
"WorkingDir": "",
},
// Legacy fields for current API versions (v1.50 and up). These fields
// did not have an "omitempty" and were always included in the response,
// even if not set; see https://github.com/moby/moby/issues/50134
"current": {
"Cmd": nil,
"Entrypoint": nil,
"Env": nil,
"Labels": nil,
"OnBuild": nil,
"User": "",
"Volumes": nil,
"WorkingDir": "",
},
}
// inspectCompatResponse is a wrapper around [image.InspectResponse] with a
// custom marshal function for legacy [api/types/container.Config} fields
// that have been removed, or did not have omitempty.
type inspectCompatResponse struct {
*image.InspectResponse
legacyConfig map[string]any
}
// MarshalJSON implements a custom marshaler to include legacy fields
// in API responses.
func (ir *inspectCompatResponse) MarshalJSON() ([]byte, error) {
type tmp *image.InspectResponse
base, err := json.Marshal((tmp)(ir.InspectResponse))
if err != nil {
return nil, err
}
if len(ir.legacyConfig) == 0 {
return base, nil
}
type resp struct {
*image.InspectResponse
Config map[string]any
}
var merged resp
err = json.Unmarshal(base, &merged)
if err != nil {
return base, nil
}
// prevent mutating legacyConfigFields.
cfg := maps.Clone(ir.legacyConfig)
maps.Copy(cfg, merged.Config)
merged.Config = cfg
return json.Marshal(merged)
}

View File

@@ -1,73 +0,0 @@
package router
import (
"net/http"
"github.com/docker/docker/api/server/httputils"
)
// RouteWrapper wraps a route with extra functionality.
// It is passed in when creating a new route.
type RouteWrapper func(r Route) Route
// localRoute defines an individual API route to connect
// with the docker daemon. It implements Route.
type localRoute struct {
method string
path string
handler httputils.APIFunc
}
// Handler returns the APIFunc to let the server wrap it in middlewares.
func (l localRoute) Handler() httputils.APIFunc {
return l.handler
}
// Method returns the http method that the route responds to.
func (l localRoute) Method() string {
return l.method
}
// Path returns the subpath where the route responds to.
func (l localRoute) Path() string {
return l.path
}
// NewRoute initializes a new local route for the router.
func NewRoute(method, path string, handler httputils.APIFunc, opts ...RouteWrapper) Route {
var r Route = localRoute{method, path, handler}
for _, o := range opts {
r = o(r)
}
return r
}
// NewGetRoute initializes a new route with the http method GET.
func NewGetRoute(path string, handler httputils.APIFunc, opts ...RouteWrapper) Route {
return NewRoute(http.MethodGet, path, handler, opts...)
}
// NewPostRoute initializes a new route with the http method POST.
func NewPostRoute(path string, handler httputils.APIFunc, opts ...RouteWrapper) Route {
return NewRoute(http.MethodPost, path, handler, opts...)
}
// NewPutRoute initializes a new route with the http method PUT.
func NewPutRoute(path string, handler httputils.APIFunc, opts ...RouteWrapper) Route {
return NewRoute(http.MethodPut, path, handler, opts...)
}
// NewDeleteRoute initializes a new route with the http method DELETE.
func NewDeleteRoute(path string, handler httputils.APIFunc, opts ...RouteWrapper) Route {
return NewRoute(http.MethodDelete, path, handler, opts...)
}
// NewOptionsRoute initializes a new route with the http method OPTIONS.
func NewOptionsRoute(path string, handler httputils.APIFunc, opts ...RouteWrapper) Route {
return NewRoute(http.MethodOptions, path, handler, opts...)
}
// NewHeadRoute initializes a new route with the http method HEAD.
func NewHeadRoute(path string, handler httputils.APIFunc, opts ...RouteWrapper) Route {
return NewRoute(http.MethodHead, path, handler, opts...)
}

View File

@@ -1,30 +0,0 @@
package network
import (
"context"
"github.com/docker/docker/api/types/backend"
"github.com/docker/docker/api/types/filters"
"github.com/docker/docker/api/types/network"
)
// Backend is all the methods that need to be implemented
// to provide network specific functionality.
type Backend interface {
GetNetworks(filters.Args, backend.NetworkListConfig) ([]network.Inspect, error)
CreateNetwork(ctx context.Context, nc network.CreateRequest) (*network.CreateResponse, error)
ConnectContainerToNetwork(ctx context.Context, containerName, networkName string, endpointConfig *network.EndpointSettings) error
DisconnectContainerFromNetwork(containerName string, networkName string, force bool) error
DeleteNetwork(networkID string) error
NetworksPrune(ctx context.Context, pruneFilters filters.Args) (*network.PruneReport, error)
}
// ClusterBackend is all the methods that need to be implemented
// to provide cluster network specific functionality.
type ClusterBackend interface {
GetNetworks(filters.Args) ([]network.Inspect, error)
GetNetwork(name string) (network.Inspect, error)
GetNetworksByName(name string) ([]network.Inspect, error)
CreateNetwork(nc network.CreateRequest) (string, error)
RemoveNetwork(name string) error
}

View File

@@ -1,43 +0,0 @@
package network
import (
"github.com/docker/docker/api/server/router"
)
// networkRouter is a router to talk with the network controller
type networkRouter struct {
backend Backend
cluster ClusterBackend
routes []router.Route
}
// NewRouter initializes a new network router
func NewRouter(b Backend, c ClusterBackend) router.Router {
r := &networkRouter{
backend: b,
cluster: c,
}
r.initRoutes()
return r
}
// Routes returns the available routes to the network controller
func (n *networkRouter) Routes() []router.Route {
return n.routes
}
func (n *networkRouter) initRoutes() {
n.routes = []router.Route{
// GET
router.NewGetRoute("/networks", n.getNetworksList),
router.NewGetRoute("/networks/", n.getNetworksList),
router.NewGetRoute("/networks/{id:.+}", n.getNetwork),
// POST
router.NewPostRoute("/networks/create", n.postNetworkCreate),
router.NewPostRoute("/networks/{id:.*}/connect", n.postNetworkConnect),
router.NewPostRoute("/networks/{id:.*}/disconnect", n.postNetworkDisconnect),
router.NewPostRoute("/networks/prune", n.postNetworksPrune),
// DELETE
router.NewDeleteRoute("/networks/{id:.*}", n.deleteNetwork),
}
}

Some files were not shown because too many files have changed in this diff Show More