Compare commits

...

3021 Commits

Author SHA1 Message Date
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
Paweł Gronowski
9a9cade0df Merge pull request #50199 from vvoland/c8d-push-fixtag
c8d/push: Fix fallback single-manifest push not creating a tag
2025-06-13 13:42:50 +00:00
Paweł Gronowski
987b8a88a6 c8d/push: Extract shared push logic
Just a refactor of the previous commit to reduce duplication.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-06-13 14:51:18 +02:00
Sebastiaan van Stijn
e921abf618 Merge pull request #50198 from thaJeztah/bump_containerd
vendor: github.com/containerd/containerd/v2 v2.1.2
2025-06-13 14:39:07 +02:00
Paweł Gronowski
d9e7b86de4 c8d/push: Fix fallback single-manifest push not creating a tag
After pushing the multi-platform index fails due to missing content, we
retry with the single-platform manifest. While the target descriptor was
changed for the second push, the actual target digested reference still
pointed to the original multi-platform index. Obviously, with the
fallback that didn't really work correctly, because the multi-platform
index is not pushed.

This commit fixes the issue by updating the target reference to point to
the single-platform manifest.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-06-13 14:31:34 +02:00
Sebastiaan van Stijn
5dc1ccdfc8 Merge pull request #50136 from mabrarov/50133-container_stop_state_sync
fix: daemon: state of stopped container visible to other queries when container is stopped
2025-06-13 14:16:37 +02:00
Sebastiaan van Stijn
53d12c96f8 vendor: github.com/containerd/containerd/v2 v2.1.2
no significant changes other than error messages that now contain more
information

full diff: https://github.com/containerd/containerd/compare/v2.1.1...v2.1.2

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-13 13:50:48 +02:00
Paweł Gronowski
72145a8ad2 Merge pull request #50146 from vvoland/image-list-containers
api/image/list: Return `Containers` count
2025-06-13 11:34:38 +00:00
Rob Murray
f9e6f25677 Merge pull request #50196 from robmry/fix_TestDaemonRestartRestoreBridgeNetwork
Fix flaky test TestDaemonRestartRestoreBridgeNetwork
2025-06-13 12:21:19 +01:00
Sebastiaan van Stijn
9e985bd96f Merge pull request #50158 from mmorel-35/errorlint
fix errorlint linter
2025-06-13 12:38:38 +02:00
Rob Murray
aac0260d21 Fix flaky test TestDaemonRestartRestoreBridgeNetwork
It checked for "Bind for 0.0.0.0:80 failed: port is already
allocated". But, since commit d662091 ("portallocator: always
check for ports allocated for 0.0.0.0/::"), the message is
sometimes about ":::80".

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-06-13 10:53:22 +01:00
Paweł Gronowski
cfcbfabb0f api/image/list: Return Containers count
This parameter was already supported for some time in the backend (for
purposes related to docker system prune). It was also already present in
the imagetypes.ListOptions but was never actually handled by the client.

Make it available by default in the response.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-06-13 11:46:09 +02:00
Sebastiaan van Stijn
52a54d9ef6 Merge pull request #50176 from dmcgowan/handle-token-server-error-messages
Handle error message from token server with containerd backend
2025-06-13 10:40:33 +02:00
Matthieu MOREL
6d737371b8 fix comparison rule from errorlint
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-06-13 08:26:56 +00: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
Paweł Gronowski
b65c31427c Merge pull request #50174 from jsternberg/buildkit-update
vendor: github.com/moby/buildkit v0.23.0-rc1
2025-06-12 18:55:04 +00:00
Rob Murray
5de6c1f6f3 Merge pull request #50189 from thaJeztah/fix_TestCopyFromContainerPathIsNotDir
integration-cli: TestCopyFromContainerPathIsNotDir: adjust for win 2025
2025-06-12 19:54:41 +01:00
Sebastiaan van Stijn
84f5e5351c Merge pull request #50145 from vvoland/api-151
api: bump to 1.51
2025-06-12 20:18:50 +02:00
Derek McGowan
941d09e265 Handle error message from token server with containerd backend
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-12 11:13:34 -07:00
Jonathan A. Sternberg
e4e7fcf668 vendor: github.com/moby/buildkit v0.23.0-rc1
Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-12 19:08:16 +02:00
Sebastiaan van Stijn
a057f98a30 Merge pull request #50187 from thaJeztah/bump_buildkit_deps
vendor: update buildkit and containerd dependencies
2025-06-12 19:08:04 +02:00
Sebastiaan van Stijn
d3d20b9195 integration-cli: TestCopyFromContainerPathIsNotDir: adjust for win 2025
It looks like the error returned by Windows changed in Windows 2025; before
Windows 2025, this produced a `ERROR_INVALID_NAME`;

    The filename, directory name, or volume label syntax is incorrect.

But Windows 2025 produces a `ERROR_DIRECTORY` ("The directory name is invalid."):

    CreateFile \\\\?\\Volume{d9f06b05-0405-418b-b3e5-4fede64f3cdc}\\windows\\system32\\drivers\\etc\\hosts\\: The directory name is invalid.

Docs; https://learn.microsoft.com/en-us/windows/win32/debug/system-error-codes--0-499-

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-12 15:18:17 +02:00
Sebastiaan van Stijn
a3d2e72958 Merge pull request #50183 from thaJeztah/remove_v1_code
daemon/containerd remove leftover schema1 compatibility code
2025-06-12 14:50:38 +02:00
Sebastiaan van Stijn
cf86f3a082 vendor: github.com/containerd/nydus-snapshotter v0.15.2
full diff: https://github.com/containerd/nydus-snapshotter/compare/v0.15.0...v0.15.2

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-12 14:07:03 +02:00
Sebastiaan van Stijn
9a85f50aaa vendor: github.com/pelletier/go-toml/v2 v2.2.4
full diff: https://github.com/pelletier/go-toml/compare/v2.2.3...v2.2.4

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-12 14:07:03 +02:00
Sebastiaan van Stijn
1764909076 vendor: github.com/fsnotify/fsnotify v1.9.0
full diff: https://github.com/fsnotify/fsnotify/compare/v1.7.0...v1.9.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-12 14:07:02 +02:00
Sebastiaan van Stijn
102adcab57 vendor: github.com/containerd/console v1.0.5
full diff: https://github.com/containerd/console/compare/v1.0.4...v1.0.5

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-12 14:07:02 +02:00
Sebastiaan van Stijn
5230692cad vendor: cloud.google.com/go/longrunning v0.5.5
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-12 14:05:28 +02:00
Sebastiaan van Stijn
5fb6604642 vendor: google.golang.org/api v0.160.0
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-12 14:03:05 +02:00
Paweł Gronowski
f2faca7de3 Merge pull request #50178 from thaJeztah/pull_clean
daemon/containerd: fix minor linting issue, and update link to error message
2025-06-12 11:49:37 +00:00
Paweł Gronowski
c430c9c7f2 Merge pull request #50115 from corhere/libn/fix-47859-networkdb-clusterleave-leak
libnetwork/networkdb: always shut down memberlist
2025-06-12 11:49:00 +00:00
Sebastiaan van Stijn
d2954c4e05 vendor: otel v1.35.0, otel/contrib v0.60.0, grpc v1.72.2
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-12 13:43:25 +02:00
Sebastiaan van Stijn
05f892190c vendor: github.com/prometheus/client_golang v1.22.0
full diff: https://github.com/prometheus/client_golang/compare/v1.20.5...v1.22.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-12 13:43:24 +02:00
Sebastiaan van Stijn
952cddd05b vendor: google.golang.org/protobuf v1.36.6
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-12 13:43:24 +02:00
Sebastiaan van Stijn
ccf5f8036c vendor: golang.org/x/sys v0.33.0
full diff: https:/github.com/golang/sys/compare/v0.32.0...v0.33.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-12 13:43:24 +02:00
Sebastiaan van Stijn
c81e03bc0b vendor: golang.org/x/sync v0.14.0
full diff: https://github.com/golang/sync/compare/v0.13.0...v0.14.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-12 13:43:24 +02:00
Paweł Gronowski
b5d26e5883 Merge pull request #50078 from vvoland/cdi-default-cache
daemon: Configure default CDI cache
2025-06-12 11:36:32 +00:00
Sebastiaan van Stijn
05e8b1701c daemon/containerd remove leftover schema1 compatibility code
commit 7c09fa25fd and
e8c269843c removed support for schema1, but
we still enabled the schema1 conversion in containerd, causing the error
produced by dockerd to be shadowed by the error from containerd;

Before this patch, we would get an error from containerd;

    docker pull docker:1.0
    Error response from daemon: failed to get converter for "docker.io/library/docker:1.0": Pulling Schema 1 images have been deprecated and disabled by default since containerd v2.0. As a workaround you may set an environment variable `CONTAINERD_ENABLE_DEPRECATED_PULL_SCHEMA_1_IMAGE=1`, but this will be completely removed in containerd v2.1.

After enabling that env-var, it would return the error from dockerd;

    CONTAINERD_ENABLE_DEPRECATED_PULL_SCHEMA_1_IMAGE=1 dockerd --feature containerd-snapshotter

    docker pull docker:1.0
    Error response from daemon: 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 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/

With this patch, we immediately return the error from dockerd;

    docker pull docker:1.0
    Error response from daemon: 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 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/

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-12 12:34:26 +02:00
Paweł Gronowski
5bbdb066d8 Merge pull request #50031 from vvoland/bbolt-1.4
vendor: go.etcd.io/bbolt v1.4.0
2025-06-12 10:09:09 +00:00
Sebastiaan van Stijn
2ff281e33a daemon/containerd: update link to containerd code
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-12 11:36:08 +02:00
Sebastiaan van Stijn
d54f713d95 daemon/containerd: rename var that shadowed type
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-12 11:32:02 +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
Marat Abrarov
8e6cd44ce4 daemon: ensuring state of stopped container is visible to other queries when container is stopped and before API response is sent (fix for https://github.com/moby/moby/issues/50133).
Signed-off-by: Marat Abrarov <abrarov@gmail.com>
2025-06-11 18:08:33 +03:00
Sebastiaan van Stijn
3b1d2f746d Merge pull request #49952 from sgopinath1/49824-amd-gpu
Added support for AMD GPUs in "docker run --gpus".
2025-06-11 14:48:58 +02:00
Sebastiaan van Stijn
349a2d0050 Merge pull request #50143 from marie/validate-bind-dir
Validate BIND_DIR variable in Makefile
2025-06-11 14:11:45 +02:00
Paweł Gronowski
86091394e9 Merge pull request #50164 from thaJeztah/fix_linting_nits
fix some linting issues
2025-06-11 10:46:15 +00:00
Rob Murray
6b9bd0a800 Merge pull request #50144 from thaJeztah/rm_import_aliases
all: remove redundant import-aliases for "go-winio"
2025-06-11 11:25:05 +01:00
Paweł Gronowski
d371ea117b Merge pull request #50156 from gagara/openrc-containerd-customization
openrc: allow customizing containerd service name
2025-06-11 09:24:11 +00:00
Paweł Gronowski
e84353ebbd Merge pull request #50135 from thaJeztah/inspect_no_omitempty
api: image inspect: add back fields that did not omitempty
2025-06-11 08:58:14 +00:00
Sebastiaan van Stijn
23c56099ee daemon/logger/loggerutils: use defer to fix gocritic "badlock" linter
daemon/logger/loggerutils/logfile.go:374:2: badLock: defer is missing, mutex is unlocked immediately (gocritic)
        w.rotateMu.Unlock()
        ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-10 13:54:56 +02:00
Sebastiaan van Stijn
0069360e3b volume/mounts: windowsDetectMountType: rewrite using switch
Mostly for readability, and to avoid linters suggesting to move the
default condition outside of the if/else.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-10 13:19:25 +02:00
Sebastiaan van Stijn
027355d7b3 container/stream: TestRaceUnbuffered: put unused testing.T to use
Some linters were complaining about the testing.T not being used; put
it to use to silence the linter.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-10 13:15:05 +02:00
Sebastiaan van Stijn
2bbf5f5a39 daemon/containerd: ImageService.resolveImage: cleanup resolve by name:tag
- scope variables locally to the if/else if
- use if/else if to try to make it more clear it's a "best effort" before
  falling through to other ways of resolving the image reference
- remove outdated TODO, now that containerd errdefs can be used for either
  moby, or containerd error definitions.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-10 13:13:44 +02:00
Sebastiaan van Stijn
13879e7b49 Merge pull request #50082 from mmorel-35/go-critic
fix go-critic linter
2025-06-10 13:09:05 +02:00
Paweł Gronowski
729cbbd5c0 Merge pull request #49950 from dmcgowan/contributing-package-location
Add contributor guidelines for where to put source code in packages
2025-06-10 10:56:43 +00:00
Paweł Gronowski
52a8109a6b Merge pull request #50155 from robmry/windows_no_mirrored_plugin
Windows: don't try to load "mirrored" network plugin
2025-06-10 09:36:22 +00:00
Tianon Gravi
b2d4925e4a Merge pull request #50154 from robmry/dont_prune_windows_host_networks
Only "prune" Windows networks created by Docker
2025-06-09 15:28:51 -07:00
Paweł Gronowski
2e25775c83 libnetwork: Replace deprecated usages
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-06-09 19:30:00 +02:00
Paweł Gronowski
3dd8f03f25 vendor: go.etcd.io/bbolt v1.4.0
full diff: https://github.com/etcd-io/bbolt/compare/v1.3.11...v1.4.0

Changelog: https://github.com/etcd-io/bbolt/blob/main/CHANGELOG/CHANGELOG-1.4.md

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-06-09 19:29:58 +02:00
Rob Murray
55f47f9e34 Windows: don't try to load "mirrored" network plugin
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-06-09 11:38:13 +01:00
Matthieu MOREL
20b6075380 fix badCall from go-critic
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-06-08 09:02:11 +02:00
Viacheslav Gagara
10c4715a62 openrc: allow customizing containerd service name
Signed-off-by: Viacheslav Gagara <viacheslavg@gmail.com>
2025-06-08 09:10:59 +03:00
Matthieu MOREL
c466ae0f71 fix badLock from go-critic
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-06-07 09:57:59 +02:00
Matthieu MOREL
19f5ac3c81 fix initClause from go-critic
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-06-07 09:57:59 +02:00
Matthieu MOREL
aa632664b6 fix mapKey from go-critic
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-06-07 09:57:59 +02:00
Matthieu MOREL
5ad4e4edf7 fix deprecatedComment from go-critic
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-06-07 09:57:59 +02:00
Matthieu MOREL
b8a4f6534f fix stringsCompare and stringConcatSimplify from go-critic
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-06-07 09:57:59 +02:00
Matthieu MOREL
a62de57aa1 fix sprintfQuotedString from go-critic
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-06-07 09:57:59 +02:00
Matthieu MOREL
bc9ec5fc02 fix emptyStringTest from go-critic
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-06-07 09:57:59 +02:00
Matthieu MOREL
469afa5f8f fix httpNoBody from go-critic
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-06-07 09:57:58 +02:00
Matthieu MOREL
8f7faa01d1 fix boolExprSimplify from go-critic
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-06-07 09:57:58 +02:00
Matthieu MOREL
e5be7b54b1 fix yodaStyleExpr from go-critic
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-06-07 09:57:58 +02:00
Matthieu MOREL
64075850fc fix go-critic linter
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-06-07 09:57:58 +02:00
Sebastiaan van Stijn
145834f278 Merge pull request #50153 from vvoland/update-go
update to go1.24.4
2025-06-07 07:37:53 +02:00
Rob Murray
793dd8385a Only "prune" Windows networks created by Docker
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-06-06 20:24:04 +01:00
Derek McGowan
071d27cd3d Add contributor guidelines for where to put source code in packages
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-06 11:31:04 -07:00
Paweł Gronowski
1603ad636e update to go1.24.4
- https://github.com/golang/go/issues?q=milestone%3AGo1.24.4+label%3ACherryPickApproved
- full diff: https://github.com/golang/go/compare/go1.24.3...go1.24.4

This release includes 3 security fixes following the security policy:

- net/http: sensitive headers not cleared on cross-origin redirect

    Proxy-Authorization and Proxy-Authenticate headers persisted on cross-origin redirects potentially leaking sensitive information.

    Thanks to Takeshi Kaneko (GMO Cybersecurity by Ierae, Inc.) for reporting this issue.

    This is CVE-2025-4673 and Go issue https://go.dev/issue/73816.

- os: inconsistent handling of O_CREATE|O_EXCL on Unix and Windows

    os.OpenFile(path, os.O_CREATE|O_EXCL) behaved differently on Unix and Windows systems when the target path was a dangling symlink. On Unix systems, OpenFile with O_CREATE and O_EXCL flags never follows symlinks. On Windows, when the target path was a symlink to a nonexistent location, OpenFile would create a file in that location.

    OpenFile now always returns an error when the O_CREATE and O_EXCL flags are both set and the target path is a symlink.

    Thanks to Junyoung Park and Dong-uk Kim of KAIST Hacking Lab for discovering this issue.

    This is CVE-2025-0913 and Go issue https://go.dev/issue/73702.

- crypto/x509: usage of ExtKeyUsageAny disables policy validation

    Calling Verify with a VerifyOptions.KeyUsages that contains ExtKeyUsageAny unintentionally disabledpolicy validation. This only affected certificate chains which contain policy graphs, which are rather uncommon.

    Thanks to Krzysztof Skrzętnicki (@Tener) of Teleport for reporting this issue.

    This is CVE-2025-22874 and Go issue https://go.dev/issue/73612.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-06-06 19:35:32 +02:00
Sebastiaan van Stijn
2da78d4fcc Merge pull request #50022 from mmorel-35/thelper
fix thelper linter
2025-06-06 09:53:29 +02:00
Matthieu MOREL
9b5d8cd186 fix thelper linter
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-06-05 21:42:05 +00:00
Maria Glushenok
ea581c96b9 Validate BIND_DIR variable in Makefile
Signed-off-by: Maria Glushenok <glushenokm@gmail.com>
2025-06-05 20:43:41 +03:00
Sebastiaan van Stijn
59bdc72463 Merge pull request #50147 from robmry/inspect_overlay_enableipv4
Set EnableIPv4=true in overlay network inspect response
2025-06-05 19:08:48 +02:00
Sudheendra Gopinath
e32715ec03 Added support for AMD GPUs in "docker run --gpus".
Added backend code to support the exact same interface
used today for Nvidia GPUs, allowing customers to use
the same docker commands for both Nvidia and AMD GPUs.

Signed-off-by: Sudheendra Gopinath <sudheendra.gopinath@amd.com>

Reused common functions from nvidia_linux.go.

Removed duplicate code in amd_linux.go by reusing
the init() and countToDevices() functions in
nvidia_linux.go. AMD driver is registered in init().

Signed-off-by: Sudheendra Gopinath <sudheendra.gopinath@amd.com>

Renamed amd-container-runtime constant

Signed-off-by: Sudheendra Gopinath <sudheendra.gopinath@amd.com>

Removed empty branch to keep linter happy.

Also renamed amd_linux.go to gpu_amd_linux.go.

Signed-off-by: Sudheendra Gopinath <sudheendra.gopinath@amd.com>

Renamed nvidia_linux.go and gpu_amd_linux.go.

Signed-off-by: Sudheendra Gopinath <sudheendra.gopinath@amd.com>
2025-06-05 14:44:18 +00:00
Rob Murray
6bac5ca833 Set EnableIPv4=true in overlay network inspect response
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-06-05 15:27:32 +01:00
Paweł Gronowski
27f2e0ecc5 api: bump to 1.51
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-06-05 12:32:48 +02:00
Sebastiaan van Stijn
bd20bfdc41 all: remove redundant import-aliases for "go-winio"
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-05 12:11:30 +02:00
Sebastiaan van Stijn
acac1d84ce Merge pull request #50127 from thaJeztah/swagger_uint
api/swagger: quote maxUint64 example value
2025-06-05 11:59:20 +02:00
Akihiro Suda
c29de525b8 Merge pull request #50087 from vvoland/vendor-miekgdns
vendor: github.com/miekg/dns v1.1.66
2025-06-05 15:24:33 +09:00
Sebastiaan van Stijn
f85394dd5d api: image inspect: add back fields that did not omitempty
commit 4dc961d0e9 removed deprecated
fields from the image inspect response for API v1.50 and up. As
part of that change, it changed the type used for the Config field
to use the docker image spect structs, which embeds the OCI image
spec structs.

While the OCI image spect struct contains the same fields as we
used before, those fields also have "omitempty" set, which means
they are now omitted when empty.

We should probably consider deprecating that behavior in the API,
and call out that these fields are omitted if not set, but in the
meantime, we can add them back with their default (zero) value.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-04 18:01:19 +02:00
Rob Murray
9663b36b6d Merge pull request #50054 from robmry/fix_port_mapping
Avoid selecting duplicate host ports for mappings to 0.0.0.0 and specific addresses
2025-06-04 16:46:29 +01:00
Sebastiaan van Stijn
ee69d8ac95 Merge pull request #50051 from robmry/nftables_no_docker_user
nftables: don't create DOCKER-USER iptables chains
2025-06-03 13:19:12 +02:00
Sebastiaan van Stijn
e2b9f3d844 Merge pull request #50059 from shangmu/master
dockerd-rootless-setuptool.sh: Fix silent stop on error due to using output redirection together wit…
2025-06-03 12:05:03 +02:00
Paweł Gronowski
a8d3645957 Merge pull request #50128 from thaJeztah/bump_cli
Dockerfile: update cli to v28.2.2
2025-06-02 14:14:39 +00:00
Sebastiaan van Stijn
a9fabe7f0e Merge pull request #50124 from thaJeztah/resolvconf_table_test
libnetwork/resolvconf: Build: decorate error for invalid nameservers and use table-tests
2025-06-02 15:51:41 +02:00
Sebastiaan van Stijn
284904119a Dockerfile: update cli to v28.2.2
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-02 14:54:44 +02:00
Sebastiaan van Stijn
8ba832cc8f docs/api: swagger: quote maxUint64 example value
More recent versions of go-swagger failed on this, because the value
is interpolated as JSON numberic value, which assumes int64 (signed).

Quote the value to prevent it being handled before validated against
uint64.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-02 14:47:48 +02:00
Sebastiaan van Stijn
affe1d6335 api/swagger: quote maxUint64 example value
More recent versions of go-swagger failed on this, because the value
is interpolated as JSON numberic value, which assumes int64 (signed).

Quote the value to prevent it being handled before validated against
uint64.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-02 14:45:11 +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
Sebastiaan van Stijn
b6fa565cba libnetwork/resolvconf: Build: decorate error for invalid nameservers
Using the same prefix as is used in `Sandbox.loadResolvConf`, but omiting
the value, as it's already part of the error message;
829b695375/libnetwork/sandbox_dns_unix.go (L258-L261)

Unfortunately, `netip.ParseAddr` returns a non-exported (`parseAddrError`)
error-type; https://cs.opensource.google/go/go/+/refs/tags/go1.24.3:src/net/netip/netip.go;l=115

So we don't have the option to omit the `` from the error-message, and to
take the underlying `msg` field;
https://cs.opensource.google/go/go/+/refs/tags/go1.24.3:src/net/netip/netip.go;l=141-153

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-02 12:33:28 +02:00
Sebastiaan van Stijn
35e062dde1 libnetwork/resolvconf: rewrite TestBuild tests to a table-test
Also adding test-cases for;

- empty options for all fields
- invalid nameServer (domain instead of IP).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-02 12:20:19 +02:00
Akihiro Suda
829b695375 Merge pull request #50109 from vvoland/binimage-nosha
gha/bin-image: Don't push sha tags
2025-05-31 15:52:08 +09:00
Sebastiaan van Stijn
9649dc8134 Merge pull request #50110 from thaJeztah/remove_import_comments
all: remove // import comments
2025-05-30 20:35:54 +02:00
Cory Snider
16ed51d864 libnetwork/networkdb: always shut down memberlist
Gracefully leaving the memberlist cluster is a best-effort operation.
Failing to successfully broadcast the leave message to a peer should not
prevent NetworkDB from cleaning up the memberlist instance on close. But
that was not the case in practice. Log the error returned from
(*memberlist.Memberlist).Leave instead of returning it and proceed with
shutting down irrespective of whether Leave() returns an error.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-05-30 13:56:47 -04:00
Sebastiaan van Stijn
c1a27ea5af pkg/stack: remove // import comments
These comments were added to enforce using the correct import path for
our packages ("github.com/docker/docker", not "github.com/moby/moby").
However, when working in go module mode (not GOPATH / vendor), they have
no effect, so their impact is limited.

Remove these imports in preparation of migrating our code to become an
actual go module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-30 15:59:22 +02:00
Sebastiaan van Stijn
dd382769bd pkg/rootless: remove // import comments
These comments were added to enforce using the correct import path for
our packages ("github.com/docker/docker", not "github.com/moby/moby").
However, when working in go module mode (not GOPATH / vendor), they have
no effect, so their impact is limited.

Remove these imports in preparation of migrating our code to become an
actual go module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-30 15:59:22 +02:00
Sebastiaan van Stijn
ce191648c7 pkg/useragent: remove // import comments
These comments were added to enforce using the correct import path for
our packages ("github.com/docker/docker", not "github.com/moby/moby").
However, when working in go module mode (not GOPATH / vendor), they have
no effect, so their impact is limited.

Remove these imports in preparation of migrating our code to become an
actual go module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-30 15:59:21 +02:00
Sebastiaan van Stijn
ad1a388895 pkg/tailfile: remove // import comments
These comments were added to enforce using the correct import path for
our packages ("github.com/docker/docker", not "github.com/moby/moby").
However, when working in go module mode (not GOPATH / vendor), they have
no effect, so their impact is limited.

Remove these imports in preparation of migrating our code to become an
actual go module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-30 15:59:21 +02:00
Sebastiaan van Stijn
b6f99f6d7f pkg/stringid: remove // import comments
These comments were added to enforce using the correct import path for
our packages ("github.com/docker/docker", not "github.com/moby/moby").
However, when working in go module mode (not GOPATH / vendor), they have
no effect, so their impact is limited.

Remove these imports in preparation of migrating our code to become an
actual go module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-30 15:59:21 +02:00
Sebastiaan van Stijn
ca2cca1286 pkg/stdcopy: remove // import comments
These comments were added to enforce using the correct import path for
our packages ("github.com/docker/docker", not "github.com/moby/moby").
However, when working in go module mode (not GOPATH / vendor), they have
no effect, so their impact is limited.

Remove these imports in preparation of migrating our code to become an
actual go module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-30 15:59:21 +02:00
Sebastiaan van Stijn
225b7ca6b7 pkg/progress: remove // import comments
These comments were added to enforce using the correct import path for
our packages ("github.com/docker/docker", not "github.com/moby/moby").
However, when working in go module mode (not GOPATH / vendor), they have
no effect, so their impact is limited.

Remove these imports in preparation of migrating our code to become an
actual go module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-30 15:59:21 +02:00
Sebastiaan van Stijn
0f9818ad03 pkg/pools: remove // import comments
These comments were added to enforce using the correct import path for
our packages ("github.com/docker/docker", not "github.com/moby/moby").
However, when working in go module mode (not GOPATH / vendor), they have
no effect, so their impact is limited.

Remove these imports in preparation of migrating our code to become an
actual go module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-30 15:59:20 +02:00
Sebastiaan van Stijn
f0f4fa0038 pkg/plugingetter: remove // import comments
These comments were added to enforce using the correct import path for
our packages ("github.com/docker/docker", not "github.com/moby/moby").
However, when working in go module mode (not GOPATH / vendor), they have
no effect, so their impact is limited.

Remove these imports in preparation of migrating our code to become an
actual go module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-30 15:59:20 +02:00
Sebastiaan van Stijn
5f4da92972 pkg/platform: remove // import comments
These comments were added to enforce using the correct import path for
our packages ("github.com/docker/docker", not "github.com/moby/moby").
However, when working in go module mode (not GOPATH / vendor), they have
no effect, so their impact is limited.

Remove these imports in preparation of migrating our code to become an
actual go module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-30 15:59:20 +02:00
Sebastiaan van Stijn
7a703f3772 pkg/pidfile: remove // import comments
These comments were added to enforce using the correct import path for
our packages ("github.com/docker/docker", not "github.com/moby/moby").
However, when working in go module mode (not GOPATH / vendor), they have
no effect, so their impact is limited.

Remove these imports in preparation of migrating our code to become an
actual go module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-30 15:59:20 +02:00
Sebastiaan van Stijn
511cf09e75 pkg/namesgenerator: remove // import comments
These comments were added to enforce using the correct import path for
our packages ("github.com/docker/docker", not "github.com/moby/moby").
However, when working in go module mode (not GOPATH / vendor), they have
no effect, so their impact is limited.

Remove these imports in preparation of migrating our code to become an
actual go module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-30 15:59:19 +02:00
Sebastiaan van Stijn
864e3f9348 pkg/longpath: remove // import comments
These comments were added to enforce using the correct import path for
our packages ("github.com/docker/docker", not "github.com/moby/moby").
However, when working in go module mode (not GOPATH / vendor), they have
no effect, so their impact is limited.

Remove these imports in preparation of migrating our code to become an
actual go module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-30 15:59:19 +02:00
Sebastiaan van Stijn
cc329af619 pkg/jsonmessage: remove // import comments
These comments were added to enforce using the correct import path for
our packages ("github.com/docker/docker", not "github.com/moby/moby").
However, when working in go module mode (not GOPATH / vendor), they have
no effect, so their impact is limited.

Remove these imports in preparation of migrating our code to become an
actual go module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-30 15:59:19 +02:00
Sebastiaan van Stijn
0c70c762b2 pkg/streamformatter: remove // import comments
These comments were added to enforce using the correct import path for
our packages ("github.com/docker/docker", not "github.com/moby/moby").
However, when working in go module mode (not GOPATH / vendor), they have
no effect, so their impact is limited.

Remove these imports in preparation of migrating our code to become an
actual go module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-30 15:59:19 +02:00
Sebastiaan van Stijn
fd8b6a24ab pkg/tarsum: remove // import comments
These comments were added to enforce using the correct import path for
our packages ("github.com/docker/docker", not "github.com/moby/moby").
However, when working in go module mode (not GOPATH / vendor), they have
no effect, so their impact is limited.

Remove these imports in preparation of migrating our code to become an
actual go module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-30 15:59:19 +02:00
Sebastiaan van Stijn
17845556f2 pkg/system: remove // import comments
These comments were added to enforce using the correct import path for
our packages ("github.com/docker/docker", not "github.com/moby/moby").
However, when working in go module mode (not GOPATH / vendor), they have
no effect, so their impact is limited.

Remove these imports in preparation of migrating our code to become an
actual go module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-30 15:59:19 +02:00
Sebastiaan van Stijn
18a1b61b49 pkg/sysinfo: remove // import comments
These comments were added to enforce using the correct import path for
our packages ("github.com/docker/docker", not "github.com/moby/moby").
However, when working in go module mode (not GOPATH / vendor), they have
no effect, so their impact is limited.

Remove these imports in preparation of migrating our code to become an
actual go module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-30 15:59:18 +02:00
Sebastiaan van Stijn
126246ae39 pkg/plugins: remove // import comments
These comments were added to enforce using the correct import path for
our packages ("github.com/docker/docker", not "github.com/moby/moby").
However, when working in go module mode (not GOPATH / vendor), they have
no effect, so their impact is limited.

Remove these imports in preparation of migrating our code to become an
actual go module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-30 15:59:18 +02:00
Sebastiaan van Stijn
0380c952a6 pkg/parsers: remove // import comments
These comments were added to enforce using the correct import path for
our packages ("github.com/docker/docker", not "github.com/moby/moby").
However, when working in go module mode (not GOPATH / vendor), they have
no effect, so their impact is limited.

Remove these imports in preparation of migrating our code to become an
actual go module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-30 15:59:18 +02:00
Sebastiaan van Stijn
4800a9b50d pkg/ioutils: remove // import comments
These comments were added to enforce using the correct import path for
our packages ("github.com/docker/docker", not "github.com/moby/moby").
However, when working in go module mode (not GOPATH / vendor), they have
no effect, so their impact is limited.

Remove these imports in preparation of migrating our code to become an
actual go module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-30 15:59:18 +02:00
Sebastiaan van Stijn
ca3982adea pkg/homedir: remove // import comments
These comments were added to enforce using the correct import path for
our packages ("github.com/docker/docker", not "github.com/moby/moby").
However, when working in go module mode (not GOPATH / vendor), they have
no effect, so their impact is limited.

Remove these imports in preparation of migrating our code to become an
actual go module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-30 15:59:17 +02:00
Sebastiaan van Stijn
c93f18e0b8 pkg/fileutils: remove // import comments
These comments were added to enforce using the correct import path for
our packages ("github.com/docker/docker", not "github.com/moby/moby").
However, when working in go module mode (not GOPATH / vendor), they have
no effect, so their impact is limited.

Remove these imports in preparation of migrating our code to become an
actual go module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-30 15:59:17 +02:00
Sebastiaan van Stijn
6a9f7c543c pkg/authorization: remove // import comments
These comments were added to enforce using the correct import path for
our packages ("github.com/docker/docker", not "github.com/moby/moby").
However, when working in go module mode (not GOPATH / vendor), they have
no effect, so their impact is limited.

Remove these imports in preparation of migrating our code to become an
actual go module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-30 15:59:17 +02:00
Sebastiaan van Stijn
a4411f497f errdefs: remove // import comments
These comments were added to enforce using the correct import path for
our packages ("github.com/docker/docker", not "github.com/moby/moby").
However, when working in go module mode (not GOPATH / vendor), they have
no effect, so their impact is limited.

Remove these imports in preparation of migrating our code to become an
actual go module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-30 15:59:17 +02:00
Sebastiaan van Stijn
0ea03c4add opts: remove // import comments
These comments were added to enforce using the correct import path for
our packages ("github.com/docker/docker", not "github.com/moby/moby").
However, when working in go module mode (not GOPATH / vendor), they have
no effect, so their impact is limited.

Remove these imports in preparation of migrating our code to become an
actual go module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-30 15:59:16 +02:00
Sebastiaan van Stijn
7ce4e9685a oci: remove // import comments
These comments were added to enforce using the correct import path for
our packages ("github.com/docker/docker", not "github.com/moby/moby").
However, when working in go module mode (not GOPATH / vendor), they have
no effect, so their impact is limited.

Remove these imports in preparation of migrating our code to become an
actual go module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-30 15:59:16 +02:00
Sebastiaan van Stijn
23009a700a testutil: remove // import comments
These comments were added to enforce using the correct import path for
our packages ("github.com/docker/docker", not "github.com/moby/moby").
However, when working in go module mode (not GOPATH / vendor), they have
no effect, so their impact is limited.

Remove these imports in preparation of migrating our code to become an
actual go module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-30 15:59:16 +02:00
Sebastiaan van Stijn
fe1bc3e7fd runconfig: remove // import comments
These comments were added to enforce using the correct import path for
our packages ("github.com/docker/docker", not "github.com/moby/moby").
However, when working in go module mode (not GOPATH / vendor), they have
no effect, so their impact is limited.

Remove these imports in preparation of migrating our code to become an
actual go module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-30 15:59:16 +02:00
Sebastiaan van Stijn
4656712b82 restartmanager: remove // import comments
These comments were added to enforce using the correct import path for
our packages ("github.com/docker/docker", not "github.com/moby/moby").
However, when working in go module mode (not GOPATH / vendor), they have
no effect, so their impact is limited.

Remove these imports in preparation of migrating our code to become an
actual go module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-30 15:59:15 +02:00
Sebastiaan van Stijn
134f20c828 reference: remove // import comments
These comments were added to enforce using the correct import path for
our packages ("github.com/docker/docker", not "github.com/moby/moby").
However, when working in go module mode (not GOPATH / vendor), they have
no effect, so their impact is limited.

Remove these imports in preparation of migrating our code to become an
actual go module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-30 15:59:15 +02:00
Sebastiaan van Stijn
97b20f6b79 registry: remove // import comments
These comments were added to enforce using the correct import path for
our packages ("github.com/docker/docker", not "github.com/moby/moby").
However, when working in go module mode (not GOPATH / vendor), they have
no effect, so their impact is limited.

Remove these imports in preparation of migrating our code to become an
actual go module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-30 15:59:15 +02:00
Sebastiaan van Stijn
2548254317 quota: remove // import comments
These comments were added to enforce using the correct import path for
our packages ("github.com/docker/docker", not "github.com/moby/moby").
However, when working in go module mode (not GOPATH / vendor), they have
no effect, so their impact is limited.

Remove these imports in preparation of migrating our code to become an
actual go module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-30 15:59:15 +02:00
Sebastiaan van Stijn
66055ea07c plugin: remove // import comments
These comments were added to enforce using the correct import path for
our packages ("github.com/docker/docker", not "github.com/moby/moby").
However, when working in go module mode (not GOPATH / vendor), they have
no effect, so their impact is limited.

Remove these imports in preparation of migrating our code to become an
actual go module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-30 15:59:15 +02:00
Sebastiaan van Stijn
3bbb38f1d2 volume: remove // import comments
These comments were added to enforce using the correct import path for
our packages ("github.com/docker/docker", not "github.com/moby/moby").
However, when working in go module mode (not GOPATH / vendor), they have
no effect, so their impact is limited.

Remove these imports in preparation of migrating our code to become an
actual go module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-30 15:59:14 +02:00
Sebastiaan van Stijn
021dd75bc4 libcontainerd: remove // import comments
These comments were added to enforce using the correct import path for
our packages ("github.com/docker/docker", not "github.com/moby/moby").
However, when working in go module mode (not GOPATH / vendor), they have
no effect, so their impact is limited.

Remove these imports in preparation of migrating our code to become an
actual go module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-30 15:59:14 +02:00
Sebastiaan van Stijn
fe34e89992 layer: remove // import comments
These comments were added to enforce using the correct import path for
our packages ("github.com/docker/docker", not "github.com/moby/moby").
However, when working in go module mode (not GOPATH / vendor), they have
no effect, so their impact is limited.

Remove these imports in preparation of migrating our code to become an
actual go module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-30 15:59:14 +02:00
Sebastiaan van Stijn
9abf9f2d0d internal: remove // import comments
These comments were added to enforce using the correct import path for
our packages ("github.com/docker/docker", not "github.com/moby/moby").
However, when working in go module mode (not GOPATH / vendor), they have
no effect, so their impact is limited.

Remove these imports in preparation of migrating our code to become an
actual go module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-30 15:59:14 +02:00
Sebastiaan van Stijn
4970333621 integration: remove // import comments
These comments were added to enforce using the correct import path for
our packages ("github.com/docker/docker", not "github.com/moby/moby").
However, when working in go module mode (not GOPATH / vendor), they have
no effect, so their impact is limited.

Remove these imports in preparation of migrating our code to become an
actual go module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-30 15:59:14 +02:00
Sebastiaan van Stijn
a4b0d32fa6 integration-cli: remove // import comments
These comments were added to enforce using the correct import path for
our packages ("github.com/docker/docker", not "github.com/moby/moby").
However, when working in go module mode (not GOPATH / vendor), they have
no effect, so their impact is limited.

Remove these imports in preparation of migrating our code to become an
actual go module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-30 15:59:13 +02:00
Sebastiaan van Stijn
7eecd04c7b image: remove // import comments
These comments were added to enforce using the correct import path for
our packages ("github.com/docker/docker", not "github.com/moby/moby").
However, when working in go module mode (not GOPATH / vendor), they have
no effect, so their impact is limited.

Remove these imports in preparation of migrating our code to become an
actual go module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-30 15:59:13 +02:00
Sebastiaan van Stijn
c1a3c51d9e dockerversion: remove // import comments
These comments were added to enforce using the correct import path for
our packages ("github.com/docker/docker", not "github.com/moby/moby").
However, when working in go module mode (not GOPATH / vendor), they have
no effect, so their impact is limited.

Remove these imports in preparation of migrating our code to become an
actual go module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-30 15:59:13 +02:00
Sebastiaan van Stijn
c7cb2d9783 distribution: remove // import comments
These comments were added to enforce using the correct import path for
our packages ("github.com/docker/docker", not "github.com/moby/moby").
However, when working in go module mode (not GOPATH / vendor), they have
no effect, so their impact is limited.

Remove these imports in preparation of migrating our code to become an
actual go module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-30 15:59:13 +02:00
Sebastiaan van Stijn
5318877858 daemon: remove // import comments
These comments were added to enforce using the correct import path for
our packages ("github.com/docker/docker", not "github.com/moby/moby").
However, when working in go module mode (not GOPATH / vendor), they have
no effect, so their impact is limited.

Remove these imports in preparation of migrating our code to become an
actual go module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-30 15:59:13 +02:00
Sebastiaan van Stijn
076e98e8f3 daemon/links, daemon/network: remove // import comments
These comments were added to enforce using the correct import path for
our packages ("github.com/docker/docker", not "github.com/moby/moby").
However, when working in go module mode (not GOPATH / vendor), they have
no effect, so their impact is limited.

Remove these imports in preparation of migrating our code to become an
actual go module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-30 15:59:12 +02:00
Sebastiaan van Stijn
2b42088bd5 daemon/listeners: remove // import comments
These comments were added to enforce using the correct import path for
our packages ("github.com/docker/docker", not "github.com/moby/moby").
However, when working in go module mode (not GOPATH / vendor), they have
no effect, so their impact is limited.

Remove these imports in preparation of migrating our code to become an
actual go module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-30 15:59:12 +02:00
Sebastiaan van Stijn
241e0bca8b daemon/events: remove // import comments
These comments were added to enforce using the correct import path for
our packages ("github.com/docker/docker", not "github.com/moby/moby").
However, when working in go module mode (not GOPATH / vendor), they have
no effect, so their impact is limited.

Remove these imports in preparation of migrating our code to become an
actual go module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-30 15:59:12 +02:00
Sebastiaan van Stijn
27956106d5 daemon/config: remove // import comments
These comments were added to enforce using the correct import path for
our packages ("github.com/docker/docker", not "github.com/moby/moby").
However, when working in go module mode (not GOPATH / vendor), they have
no effect, so their impact is limited.

Remove these imports in preparation of migrating our code to become an
actual go module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-30 15:59:12 +02:00
Sebastiaan van Stijn
69c34390c0 daemon/logger: remove // import comments
These comments were added to enforce using the correct import path for
our packages ("github.com/docker/docker", not "github.com/moby/moby").
However, when working in go module mode (not GOPATH / vendor), they have
no effect, so their impact is limited.

Remove these imports in preparation of migrating our code to become an
actual go module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-30 15:59:12 +02:00
Sebastiaan van Stijn
7d4caf4ba8 daemon/images: remove // import comments
These comments were added to enforce using the correct import path for
our packages ("github.com/docker/docker", not "github.com/moby/moby").
However, when working in go module mode (not GOPATH / vendor), they have
no effect, so their impact is limited.

Remove these imports in preparation of migrating our code to become an
actual go module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-30 15:59:12 +02:00
Sebastiaan van Stijn
9876c9fbcf daemon/graphdriver: remove // import comments
These comments were added to enforce using the correct import path for
our packages ("github.com/docker/docker", not "github.com/moby/moby").
However, when working in go module mode (not GOPATH / vendor), they have
no effect, so their impact is limited.

Remove these imports in preparation of migrating our code to become an
actual go module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-30 15:59:11 +02:00
Sebastiaan van Stijn
986ec3f877 daemon/cluster: remove // import comments
These comments were added to enforce using the correct import path for
our packages ("github.com/docker/docker", not "github.com/moby/moby").
However, when working in go module mode (not GOPATH / vendor), they have
no effect, so their impact is limited.

Remove these imports in preparation of migrating our code to become an
actual go module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-30 15:59:11 +02:00
Sebastiaan van Stijn
89aa33001e container: remove // import comments
These comments were added to enforce using the correct import path for
our packages ("github.com/docker/docker", not "github.com/moby/moby").
However, when working in go module mode (not GOPATH / vendor), they have
no effect, so their impact is limited.

Remove these imports in preparation of migrating our code to become an
actual go module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-30 15:59:11 +02:00
Sebastiaan van Stijn
d469079338 cmd: remove // import comments
These comments were added to enforce using the correct import path for
our packages ("github.com/docker/docker", not "github.com/moby/moby").
However, when working in go module mode (not GOPATH / vendor), they have
no effect, so their impact is limited.

Remove these imports in preparation of migrating our code to become an
actual go module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-30 15:59:11 +02:00
Sebastiaan van Stijn
c6bbc3bb6e builder: remove // import comments
These comments were added to enforce using the correct import path for
our packages ("github.com/docker/docker", not "github.com/moby/moby").
However, when working in go module mode (not GOPATH / vendor), they have
no effect, so their impact is limited.

Remove these imports in preparation of migrating our code to become an
actual go module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-30 15:59:11 +02:00
Sebastiaan van Stijn
4856e8ffad client: remove // import comments
These comments were added to enforce using the correct import path for
our packages ("github.com/docker/docker", not "github.com/moby/moby").
However, when working in go module mode (not GOPATH / vendor), they have
no effect, so their impact is limited.

Remove these imports in preparation of migrating our code to become an
actual go module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-30 15:59:10 +02:00
Sebastiaan van Stijn
bf9d739561 api: remove // import comments
These comments were added to enforce using the correct import path for
our packages ("github.com/docker/docker", not "github.com/moby/moby").
However, when working in go module mode (not GOPATH / vendor), they have
no effect, so their impact is limited.

Remove these imports in preparation of migrating our code to become an
actual go module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-30 15:59:01 +02:00
Sebastiaan van Stijn
cee6f64ac7 Merge pull request #50112 from thaJeztah/libnet_overlayutils_overflow
libnet/d/overlay/overlayutils: prevent uint32 overflow
2025-05-30 15:56:00 +02:00
Sebastiaan van Stijn
f1f9950e4a Merge pull request #50111 from thaJeztah/fluentd_overflow
daemon/logger/fluentd: cap max-retries to MaxInt32
2025-05-30 15:55:32 +02:00
Sebastiaan van Stijn
fca97dae9d libnet/d/overlay/overlayutils: prevent uint32 overflow
CodeQL was complaining about the conversion to uint32

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-30 14:00:14 +02:00
Sebastiaan van Stijn
3d8195a20f daemon/logger/fluentd: cap max-retries to MaxInt32
CodeQL was warning about a potential overflow; the default value
was set to MaxInt32 in 13086f387b,
which documented that higher values caused problems, so cap it
to that value as maximum.

45873be4ae/daemon/logger/fluentd/fluentd.go (L45-L47)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-30 13:50:55 +02:00
Paweł Gronowski
404f29c42d gha/bin-image: Don't push sha tags
This change eliminates the automatic creation of image tags in the
format `moby/moby-bin:sha-ad132f5` for every push.

They're not too useful, produce noise and use a lot of space.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-05-30 11:43:05 +02:00
Paweł Gronowski
45873be4ae Merge pull request #50105 from jsternberg/revert-build-dangling
Revert "containerd: images overridden by a build are kept dangling"
2025-05-30 08:53:59 +00:00
Jonathan A. Sternberg
7994426e61 Revert "containerd: images overridden by a build are kept dangling"
This reverts commit 50a856157c.

Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com>
2025-05-29 13:23:45 -05: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
Cory Snider
f144264bae Merge pull request #50090 from corhere/libn/overlay-netip
libnetwork/d/overlay: use netip types more
2025-05-29 14:12:28 -04:00
Rob Murray
a2652d4b81 Don't set up iptables chain DOCKER-USER when using nftables
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-05-29 19:12:23 +01:00
Rob Murray
768cfaeb62 Merge pull request #50050 from robmry/nftables_internal_dns
nftables: rules for the internal DNS resolver
2025-05-29 19:11:27 +01:00
Rob Murray
d3289dda4b Add nftables NAT rules for internal DNS resolver
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-05-29 17:20:25 +01:00
Sebastiaan van Stijn
7a0bf747f5 Merge pull request #50038 from ctalledo/fix-for-50037
Update worker.Platforms() in builder-next worker.
2025-05-29 16:09:38 +02:00
Rob Murray
b43afbf898 Merge pull request #50098 from robmry/remove_docker-user_return_rule
iptables: Drop explicit RETURN rule from DOCKER-USER
2025-05-29 11:27:54 +01:00
Cesar Talledo
c299ba3b38 Update worker.Platforms() in builder-next worker.
Use platform MatchComparer when checking for matching platforms.

Also, add unit test to ensure the merging of defined and host-supported
platforms works correctly.

Signed-off-by: Cesar Talledo <cesar.talledo@docker.com>
2025-05-28 14:47:59 -07:00
Shang Mu
6889039d76 Fix silent stop on error due to using output redirection together with set -eu.
Signed-off-by: Shang Mu <smu@princeton.edu>
2025-05-28 13:23:52 -04:00
Rob Murray
d6620915db portallocator: always check for ports allocated for 0.0.0.0/::
We set SO_REUSEADDR on sockets used for host port mappings by
docker-proxy - which means it's possible to bind the same port
on a specific address as well as 0.0.0.0/::.

For TCP sockets, an error is raised when listen() is called on
both sockets - and the port allocator will be called again to
avoid the clash (if the port was allocated from a range, otherwise
the container will just fail to start).

But, for UDP sockets, there's no listen() - so take more care
to avoid the clash in the portallocator.

The port allocator keeps a set of allocated ports for each of
the host IP addresses it's seen, including 0.0.0.0/::. So, if a
mapping to 0.0.0.0/:: is requested, find a port that's free in
the range for each of the known IP addresses (but still only
mark it as allocated against 0.0.0.0/::). And, if a port is
requested for specific host addresses, make sure it's also
free in the corresponding 0.0.0.0/:: set (but only mark it as
allocated against the specific addresses - because the same
port can be allocated against a different specific address).

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-05-28 14:00:33 +01:00
Paweł Gronowski
0e2cc22d36 Merge pull request #50049 from robmry/nftables_env_var_enable
nftables: enable using env var
2025-05-28 12:58:21 +00:00
Paweł Gronowski
e37efd4c2d Merge pull request #50068 from mmorel-35/github.com/containerd/errdefs
refactor: replace uses of errdefs package
2025-05-28 12:57:15 +00:00
Rob Murray
1d6b471ce2 Merge pull request #50092 from thaJeztah/bump_dev_cli
Dockerfile: update cli to v28.2.0-rc.2
2025-05-28 13:42:07 +01:00
Paweł Gronowski
5cc94a552d Merge pull request #50094 from thaJeztah/rm_non_compliant_registry_fallback
remove fallback for non-OCI-compliant docker.pkg.github.com registry
2025-05-28 12:10:12 +00:00
Paweł Gronowski
8330a083d5 Merge pull request #50097 from vvoland/seccomp-lsm
seccomp: Require CAP_SYS_ADMIN for lsm_* syscalls
2025-05-28 12:05:57 +00:00
Paweł Gronowski
027588eba0 builder: Pass cdi cache instead of CDISpecDirs
Instead of passing the dirs for buildkit to configure the same cache
instance, just pass the shared CDI cache instance.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-05-28 13:31:45 +02:00
Paweł Gronowski
bc6bc7aafa daemon/cdi: Log not found dirs as INFO
Avoid logging warnings when default CDI directory does not exist:
```
WARN[2025-05-26T14:27:54.008196418Z] CDI setup error /var/run/cdi: failed to monitor for changes: no such file or directory
WARN[2025-05-26T14:27:54.008209168Z] CDI setup error /etc/cdi: failed to monitor for changes: no such file or directory
```

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-05-28 13:31:42 +02:00
Paweł Gronowski
9856bf52a2 daemon: Configure default CDI cache
And share it with BuildKit

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-05-28 13:31:40 +02:00
Rob Murray
ae2fc2ddd1 PortAllocator: Use netip.Addr instead of string as map key
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-05-28 11:38:59 +01:00
Rob Murray
19dc38f79b Listen on mapped host ports before mapping more ports
Because we set SO_REUSEADDR on sockets for host ports, if there
are port mappings for INADDR_ANY (the default) as well as for
specific host ports - bind() cannot be used to detect clashes.

That means, for example, on daemon startup, if the port allocator
returns the first port in its ephemeral range for a specific host
adddress, and the next port mapping is for 0.0.0.0 - the same port
is returned and both bind() calls succeed. Then, the container
fails to start later when listen() spots the problem and it's too
late to find another port.

So, bind and listen to each set of ports as they're allocated
instead of just binding.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-05-28 11:38:59 +01:00
Rob Murray
dc519a0f18 iptables: Drop explicit RETURN rule from DOCKER-USER
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-05-28 11:11:56 +01:00
Paweł Gronowski
148a19b6d6 seccomp: Require CAP_SYS_ADMIN for lsm_* syscalls
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-05-28 11:47:08 +02:00
Paweł Gronowski
0ab8108b57 seccomp: Fix typo in lsm_set_self_attr
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-05-28 11:23:56 +02:00
Rob Murray
21a165de23 Use env-var DOCKER_FIREWALL_BACKEND=nftables to enable nftables
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-05-28 09:57:26 +01:00
Matthieu MOREL
637e8142ce clean up golangci-lint config for deprectated errdefs.*
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-05-28 05:42:45 +00:00
Matthieu MOREL
37caf3881a volume: replace uses of errdefs package
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-05-28 05:41:53 +00:00
Matthieu MOREL
08768e4d9d testutil: replace uses of errdefs package
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-05-28 05:41:39 +00:00
Matthieu MOREL
416dc8c1bf runconfig: replace uses of errdefs package
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-05-28 05:41:24 +00:00
Matthieu MOREL
8803b58259 refernce: replace uses of errdefs package
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-05-28 05:41:10 +00:00
Matthieu MOREL
dcf253ffe2 plugin: replace uses of errdefs package
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-05-28 05:40:55 +00:00
Matthieu MOREL
8561016335 libnetwork: replace uses of errdefs package
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-05-28 05:40:38 +00:00
Matthieu MOREL
f06c450a8e libcontainerd: replace uses of errdefs package
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-05-28 05:40:24 +00:00
Matthieu MOREL
528f2284ee integration-cli: replace uses of errdefs package
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-05-28 05:40:06 +00:00
Matthieu MOREL
14852fcd82 integration: replace uses of errdefs package
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-05-28 05:39:50 +00:00
Matthieu MOREL
a1a789dbd0 image: replace uses of errdefs package
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-05-28 05:39:34 +00:00
Matthieu MOREL
6ee53a6831 errdefs: replace uses of errdefs package
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-05-28 05:39:19 +00:00
Matthieu MOREL
083ccfa486 distribution: replace uses of errdefs package
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-05-28 05:39:02 +00:00
Matthieu MOREL
55da8ea276 daemon: replace uses of errdefs package
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-05-28 05:38:39 +00:00
Matthieu MOREL
364d8d8b31 container: replace uses of errdefs package
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-05-28 05:38:15 +00:00
Matthieu MOREL
415fc7b41e builder: replace uses of errdefs package
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-05-28 05:37:58 +00:00
Matthieu MOREL
f0eaf228c1 api: replace uses of errdefs package
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-05-28 05:37:31 +00:00
Sebastiaan van Stijn
f98b7005d2 remove fallback for non-OCI-compliant docker.pkg.github.com registry
The legacy `docker.pkg.github.com` registry provided by GitHub was not
OCI compliant, and did not suport pull by digest (among others). Commit
495d623ae5 added fallback code to detect
"not found" errors when pulling by digest, in which case we would fall
back to pulling by `name:tag`.

GitHub deprecated the legacy registry, and it was [sunset on Feb 24th, 2025][1]
in favor of GitHub Container Registry (GHCR) (ghcr.io).

This reverts commit 495d623ae5, removing the
fallback logic.

[1]: https://github.blog/changelog/2025-01-23-legacy-docker-registry-closing-down/

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-27 23:34:37 +02:00
Sebastiaan van Stijn
048199f191 Dockerfile: update cli to v28.2.0-rc.2
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-27 22:54:09 +02:00
Sebastiaan van Stijn
5d7550e9ef Merge pull request #50048 from robmry/nftables_integ_tests
nftables: integration test updates
2025-05-27 21:49:59 +02:00
Cory Snider
d188df0039 libn/d/overlay: use netip types more
The netip types are really useful for tracking state in the overlay
driver as they are hashable, unlike net.IP and friends, making them
directly useable as map keys. Converting between netip and net types is
fairly trivial, but fewer conversions is more ergonomic.

The NetworkDB entries for the overlay peer table encode the IP addresses
as strings. We need to parse them to some representation before
processing them further. Parse directly into netip types and pass those
values around to cut down on the number of conversions needed.

The peerDB needs to marshal the keys and entries to structs of hashable
values to be able to insert them into the SetMatrix. Use netip.Addr in
peerEntry so that peerEntry values can be directly inserted into the
SetMatrix without conversions. Use a hashable struct type as the
SetMatrix key to avoid having to marshal the whole struct to a string
and parse it back out.

Use netip.Addr as the map key for the driver's encryption map so the
values do not need to be converted to and from strings. Change the
encryption configuration methods to take netip types so the peerDB code
can pass netip values directly.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-05-27 13:47:11 -04:00
Cory Snider
0317f773a6 libnetwork/internal/setmatrix: make keys generic
Make the SetMatrix key's type generic so that e.g. netip.Addr values can
be used as matrix keys.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-05-27 13:29:41 -04:00
Rob Murray
7ea613d780 Merge pull request #50088 from corhere/libn/stateless-neighbor
libnetwork/osl: stop tracking neighbor entries
2025-05-27 18:01:22 +01:00
Rob Murray
e48ea1c6e0 Make integration tests ready for nftables
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-05-27 17:50:03 +01:00
Rob Murray
f9f0db0789 Add nftables support to testutil SetFilterForwardPolicies
Because nftables tables/chain aren't fixed, like they are
in iptables - this change makes an assumption about the
bridge driver's naming.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-05-27 17:50:03 +01:00
Rob Murray
7ea0e60dde Skip test TestBridgeINCRouted in rootless mode
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-05-27 17:50:03 +01:00
Cory Snider
0d6e7cd983 libnetwork/osl: stop tracking neighbor entries
The Namespace keeps some state for each inserted neighbor-table entry
which is used to delete the entry (and any related entries) given only
the IP and MAC address of the entry to delete. This state is not
strictly required as the retained data is a pure function of the
parameters passed to AddNeighbor(), and the kernel can inform us whether
an attempt to add a neighbor entry would conflict with an existing
entry. Get rid of the neighbor state in Namespace. It's just one more
piece of state that can cause lots of grief if it falls out of sync with
ground truth. Require callers to call DeleteNeighbor() with the same
aguments as they had passed to AddNeighbor(). Push the responsibility
for detecting attempts to insert conflicting entries into the neighbor
table onto the kernel by using (*netlink.Handle).NeighAdd() instead of
NeighSet().

Modernize the error messages and logging in DeleteNeighbor() and
AddNeighbor().

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-05-27 11:46:21 -04:00
Cory Snider
9866738736 libnetwork/osl: remove superfluous locks in Namespace
The isDefault and nlHandle fields are immutable once the Namespace is
constructed.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-05-27 11:46:13 -04:00
Cory Snider
b6d76eb572 libn/osl: refactor func (*Namespace) AddNeighbor
Scope local variables as narrowly as possible.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-05-27 11:30:30 -04:00
Cory Snider
3bdf99d127 libn/osl: drop unused AddNeighbor force parameter
func (*Namespace) AddNeighbor is only ever called with the force
parameter set to false. Remove the parameter and eliminate dead code.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-05-27 11:30:30 -04:00
Paweł Gronowski
f834a0bd82 vendor: github.com/miekg/dns v1.1.66
full diff: https://github.com/miekg/dns/compare/v1.1.61...v1.1.66

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-05-27 15:09:09 +02:00
Paweł Gronowski
458e69fc2e Merge pull request #49896 from vvoland/ai-models-pull
run/pull: Warn/reject AI model images
2025-05-27 12:18:59 +00:00
Paweł Gronowski
67535a4454 Merge pull request #50084 from thaJeztah/q_ctr_c_let_me_out_of_here_wq_wq_wq
Dockerfile: install nano as alternative to vim
2025-05-27 11:11:17 +00:00
Paweł Gronowski
034298520b Merge pull request #50080 from corhere/libn/joinleavestartmu
libnetwork: don't reinvent mutexes
2025-05-27 10:11:28 +00:00
Paweł Gronowski
4da3b4bf2d run/pull: Warn/reject AI model images
Add checks in both containerd-based and distribution-based image pull
code paths to detect and AI model images early in the pull process.

These are not yet supported directly by the Engine and need to be
handled by the `docker model` CLI plugin.

For distribution-based pull, reject the AI models pulls.

For containerd image service only emit a warning.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-05-27 12:02:21 +02:00
Paweł Gronowski
f5f3be4f9a Merge pull request #49957 from thaJeztah/bind_dir_auto
Makefile: set BIND_DIR to "." by default
2025-05-27 09:04:51 +00:00
Paweł Gronowski
da92a28a53 Merge pull request #50079 from thaJeztah/bump_dockerfile_tools
Dockerfile: bump buildx v0.24.0, compose v2.36.2
2025-05-27 08:59:44 +00:00
Sebastiaan van Stijn
339be4e2ae Dockerfile: install nano as alternative to vim
I'm horrible at vim, and use nano as my go-to editor for quick changes.
Let's install nano in the dev-container as alternative to vim for those
like me, who are not so vim-savvy ^O^C^C:wq:

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-27 10:29:19 +02:00
Sebastiaan van Stijn
26db31fdab Merge pull request #50069 from vvoland/cut-api
docs/api: Cut docs for API v1.50
2025-05-26 21:57:45 +02:00
Paweł Gronowski
588a05a1ce docs/api: Cut docs for API v1.50
Used by the upcoming v28.2.0 release.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-05-26 19:37:21 +02:00
Cory Snider
94daa36f03 libnetwork: don't reinvent mutexes
The (*Sandbox).joinLeaveStart() and .joinLeaveEnd() methods implement an
exclusive lock which is almost functionally identical to
(*sync.Mutex).Lock() and .Unlock(), respectively. The only notable
differences are that joinLeaveStart allocates, and calling
joinLeaveEnd() more times than joinLeaveStart() is a silent no-op
instead of a fatal error.

The construction of the joinLeaveStart/End methods is shaped like a
condition variable which uses channels for waiting and broadcasting.
The condition being waited for is that the joinLeaveDone struct field is
nil, i.e. that the lock has not been acquired by another goroutine.
As the condition is being checked and set while in a critical section,
it is a mutex implemented in terms of mutexes and channels. Replace the
home-grown mutex with a plain sync.Mutex.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-05-26 13:21:20 -04:00
Sebastiaan van Stijn
a9649e7a5d Merge pull request #49982 from vvoland/c8d-image-remove-platform
c8d/delete: Add support for deleting specific platforms
2025-05-26 18:47:34 +02:00
Sebastiaan van Stijn
cd2702e04e Dockerfile: update compose to v2.36.2
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-26 18:37:39 +02:00
Sebastiaan van Stijn
01fec904e4 Dockerfile: update buildx to v0.24.0
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-26 18:35:26 +02:00
Paweł Gronowski
d0ad1357a1 Merge pull request #48457 from thaJeztah/api_remove_deprecated_fields
image-inspect: remove Config fields that are not part of the image
2025-05-26 16:04:57 +00:00
Paweł Gronowski
072483f9d7 c8d/delete: Require --force when deleting platforms
When deleting specific platforms from a multi-platform image, there's
potential risk as platform-specific content might be shared across
images/containers.

For now, require `force` parameter to make the user aware.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-05-26 17:43:10 +02:00
Paweł Gronowski
30da69d694 c8d/delete: Support deleting specific platforms
This change adds the ability to delete a specific platform from a
multi-platform image.

Previously, image deletion was an all-or-nothing operation - when
deleting a multi-platform image, all platforms would be removed
together. This change allows users to selectively remove individual
platforms from a multi-architecture image while keeping other platforms
intact.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-05-26 17:43:10 +02:00
Paweł Gronowski
acf6b6542e daemon/images: Make ImageDelete take opts struct
Pass whole `RemoveOptions` struct instead of individual `force` and
`prune` parameters.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-05-26 17:43:09 +02:00
Paweł Gronowski
871675be9b c8d/delete: Extract untagReferences
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-05-26 17:43:08 +02:00
Paweł Gronowski
153b16ad27 c8d: Extract memoryLabelStore
Move to an internal testutils package

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-05-26 17:43:07 +02:00
Paweł Gronowski
536b35299b Merge pull request #50077 from vvoland/update-syscalls
profile/seccomp: Update to kernel v6.13 (libseccomp v2.6.0, containerd)
2025-05-26 15:17:58 +00:00
Paweł Gronowski
d15f59243a Merge pull request #50074 from thaJeztah/update_systemd_units
contrib: systemd: update deprecated StartLimit options
2025-05-26 15:15:54 +00:00
Sebastiaan van Stijn
d7cca3f997 docs/api: update deprecation version for erroneous fields
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-26 17:14:44 +02:00
Sebastiaan van Stijn
4dc961d0e9 image-inspect: remove Config fields that are not part of the image
commit af0cdc36c7 marked these fields as
deprecated and to be removed in API v1.47 (which was targeted for v28.0).
We shipped v1.47 with the v27.2 release, but did not yet remove the erroneous
fields, so the version to deprecate was updated to v1.48 through
3df03d8e66

This patch removes fields that are not part of the image by replacing the
type with the Config struct from the docker image-spec.

    curl -s --unix-socket /var/run/docker.sock http://localhost/v1.50/images/alpine/json | jq .Config
    {
      "Env": [
        "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
      ],
      "Cmd": [
        "/bin/sh"
      ]
    }

    curl -s --unix-socket /var/run/docker.sock http://localhost/v1.49/images/alpine/json | jq .Config
    {
      "Hostname": "",
      "Domainname": "",
      "User": "",
      "AttachStdin": false,
      "AttachStdout": false,
      "AttachStderr": false,
      "Tty": false,
      "OpenStdin": false,
      "StdinOnce": false,
      "Env": [
        "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
      ],
      "Cmd": [
        "/bin/sh"
      ],
      "Image": "",
      "Volumes": null,
      "WorkingDir": "",
      "Entrypoint": null,
      "OnBuild": null,
      "Labels": null
    }

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-26 17:14:37 +02:00
Paweł Gronowski
0ec3278d48 profiles/seccomp: kernel v6.13
reference: seccomp/libseccomp@42b5968 (libseccomp v2.6.0)
           containerd/containerd@1a4c3210

- v6.13:
  * getxattrat, listxattrat, removexattrat, setxattrat (torvalds/linux@6140be9)

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-05-26 15:45:09 +02:00
Paweł Gronowski
6aa8288cfb profiles/seccomp: kernel v6.12
reference: seccomp/libseccomp@f01e675 (libseccomp v2.6.0)
           containerd/containerd@6180d62

- v6.8:
  * listmount (torvalds/linux@b4c2bea)
  * lsm_get_self_attr, lsm_set_self_attrs (torvalds/linux@a04a119)
  * lsm_list_modules (torvalds/linux@ad4aff9)
  * statmount (torvalds/linux@46eae99)

- v6.9:
  * mseal (torvalds/linux@8be7258)

- v6.11:
  * uretprobe (torvalds/linux@190fec7)

- v6.12:
  * riscv_hwprobe (torvalds/linux@3db80c9)

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-05-26 15:45:03 +02:00
Sebastiaan van Stijn
b1c0bfa225 Merge pull request #50076 from thaJeztah/createCDICache_fix_err_capitalization
daemon: createCDICache: fix error-capitalization
2025-05-26 15:28:59 +02:00
Sebastiaan van Stijn
e03ac1fad9 daemon: createCDICache: fix error-capitalization
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-26 14:44:15 +02:00
Sebastiaan van Stijn
a5a3a74a79 Merge pull request #50064 from thaJeztah/registry_errdefs
registry: replace uses of errdefs package
2025-05-26 14:40:09 +02:00
Sebastiaan van Stijn
7263ae74cd contrib: systemd: update deprecated StartLimit options
These were originally added in 7b9ecb9700.

The `StartLimitBurst` and `StartLimitInterval` options used to be
options for `[Service]`, but were moved to the `[Unit]` in systemd 229,
and systemd 230 respectively. The `StartLimitInterval` was renamed to
`StartLimitIntervalSec`, which either takes a number (using "seconds" as
default unit) or an optional unit;

- 6bf0f408e4
- f0367da7d1

We kept these deprecated options to provide compatibility with older distros
that not yet had systemd 230, but all distros we support are now on versions
of systemd that support the new options;

    docker run --rm registry.access.redhat.com/ubi8/ubi systemctl --version
    systemd 239 (239-82.el8_10.5)
    +PAM +AUDIT +SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD +IDN2 -IDN +PCRE2 default-hierarchy=legacy

    docker run -it --rm debian:
    apt-get update && apt-get install -y systemd
    ...
    systemctl --version
    systemd 247 (247.3-7+deb11u6)
    +PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +ZSTD +SECCOMP +BLKID +ELFUTILS +KMOD +IDN2 -IDN +PCRE2 default-hierarchy=unified

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-26 13:49:57 +02:00
Akihiro Suda
158c04fac8 Merge pull request #50070 from thaJeztah/bump_cgroups
vendor: github.com/opencontainers/cgroups v0.0.2
2025-05-26 19:52:30 +09:00
Sebastiaan van Stijn
6021139a9f Merge pull request #50055 from thaJeztah/fix_fluent_migration
daemon: restore: fix fluentd-async-connect migration for downgrades
2025-05-26 12:14:07 +02:00
Sebastiaan van Stijn
888cbfddf2 vendor: github.com/opencontainers/cgroups v0.0.2
- Mark some fields with `omitempty` JSON attribute.
- Modernize code by using new Go features.
- systemd: write rounded CPU quota to cgroupfs.

full diff: https://github.com/opencontainers/cgroups/compare/v0.0.1...v0.0.2

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-26 11:30:39 +02:00
Sebastiaan van Stijn
42970fc461 registry: replace uses of errdefs package
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-24 13:14:08 +02:00
Akihiro Suda
926a4dd23c Merge pull request #50041 from thaJeztah/bump_containerd_api_1.9
vendor: github.com/containerd/containerd/api v1.9.0
2025-05-24 17:55:24 +09:00
Sebastiaan van Stijn
979f18691a daemon: restore: fix fluentd-async-connect migration for downgrades
The "fluentd-async-connect" option was deprecated in 20.10 through
cc1f3c750e, and removed in 28.0 trough
49ec488036, which added migration code
on daemon startup.

However, the migration code _copied_ the deprecated option to the new
("fluentd-async") option, preserving the old field. Doing so could cause
an issue if a user would downgrade the daemon to a previous release, as
the changes in cc1f3c750e invalidate a config
that has both fields set (see [daemon/logger/fluentd/fluentd.go#L198-L200]);

    if cfg[asyncKey] != "" && cfg[asyncConnectKey] != "" {
        return config, errors.Errorf("conflicting options: cannot specify both '%s' and '%s", asyncKey, asyncConnectKey)
    }

This patch updates the migration code to remove the deprecated option.

[daemon/logger/fluentd/fluentd.go#L198-L200]: cc1f3c750e/daemon/logger/fluentd/fluentd.go (L198-L200)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-23 14:47:50 +02:00
Sebastiaan van Stijn
32c5774524 Merge pull request #48038 from thaJeztah/builder_allow_buildkit
api/server/router/build: BuilderVersion: allow buildkit on Windows
2025-05-22 14:13:50 +02:00
Sebastiaan van Stijn
56d5a46c0f Merge pull request #49740 from profnandaa/wcow-builder-next
builder-next: add buildkit executor for wcow
2025-05-22 13:42:28 +02:00
Sebastiaan van Stijn
c6b9bb00f9 api/server/router/build: BuilderVersion: allow buildkit on Windows
Commit 7b153b9e28 changed the daemon to
advertise the recommended builder to use to V2 (BuildKit) for Linux
daemons, and V1 (Legacy Builder) for Windows daemons. For Linux daemons
we allowed the default to be overridden through the "features" field
in the daemon config (daemon.json), but for Windows we hard-coded it
to be V1, and no option to override.

With work in progress on implementing support for Windows in BuildKit,
we should remove this hardcoded assumption, and allow the default to
be overridden to advertise that BuildKit is supported.

Note that BuildKit on Windows is still very much a "work in progress",
and enabling it in the daemon may not even work, so users should not
try to enable this feature; a warning-level log is added to make it
visible that the feature is enabled.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-22 12:36:47 +02:00
Paweł Gronowski
f4ffeb8c38 Merge pull request #50047 from thaJeztah/re_enable_integrationcli_check
validation: re-enable check for changes in integration-cli"
2025-05-22 08:41:22 +00:00
Sebastiaan van Stijn
dddc943a6a Merge pull request #49977 from robmry/nftables_util_updates
nftables: util updates, including table reload
2025-05-22 02:15:34 +02:00
Sebastiaan van Stijn
560299a16f validation: re-enable check for changes in integration-cli"
This reverts commit a891e4e3e1.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-22 01:13:16 +02:00
Sebastiaan van Stijn
b3160e88bf Merge pull request #50036 from thaJeztah/buildkit_rm_schema1
builder-next: remove support for deprecated schema1 images
2025-05-21 23:44:12 +02:00
Sebastiaan van Stijn
7148c6a5f5 Merge pull request #42300 from thaJeztah/carry_39384_remove_v2_schema1_push
Remove support for pulling v2 schema1
2025-05-21 23:43:41 +02:00
Paweł Gronowski
b590eff717 Merge pull request #50046 from crazy-max/buildkit-0.22.0
vendor: update buildkit to v0.22.0
2025-05-21 17:24:27 +00:00
CrazyMax
e354e42e14 vendor: update buildkit to v0.22.0
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2025-05-21 18:31:50 +02:00
Rob Murray
0facb0cd63 Merge pull request #49969 from robmry/firewaller_wsl2_param
Make WSL2Mirrored into a Firewaller param
2025-05-21 15:32:04 +01:00
Sebastiaan van Stijn
61a1a297c0 Merge pull request #50042 from vvoland/daemon-create-platformnil
daemon/create: Simplify `GetImage` args
2025-05-21 16:01:08 +02:00
Paweł Gronowski
94b5e85c10 Merge pull request #50039 from vvoland/netlink-1.3.1
vendor: github.com/vishvananda/netlink v1.3.1
2025-05-21 11:03:11 +00:00
Paweł Gronowski
a2ada6b258 daemon/create: Simplify GetImage args
`opts.params.Platform` is always nil inside this branch so we can omit
it from the `GetImage` call to make it less confusing.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-05-21 12:50:27 +02:00
Paweł Gronowski
894244cc37 Merge pull request #50030 from vvoland/client-c8dhttp
client: Use containerd errdefs to convert http errors
2025-05-21 10:29:26 +00:00
Sebastiaan van Stijn
2c57455339 vendor: github.com/containerd/containerd/api v1.9.0
full diff: https://github.com/containerd/containerd/compare/api/v1.8.0...api/v1.9.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-21 12:19:52 +02:00
Paweł Gronowski
a3ce441ae0 client: Use containerd errdefs to convert http errors
Previously, we were using our own `FromStatusCode` function to map HTTP
status codes to Docker error types. Switch to the containerd code.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-05-21 11:41:23 +02:00
Paweł Gronowski
86187b2606 vendor: github.com/vishvananda/netlink v1.3.1
full diff: https://github.com/vishvananda/netlink/compare/655392bc778a...v1.3.1

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-05-21 11:26:17 +02:00
Paweł Gronowski
a3bee4156f Merge pull request #49973 from ctalledo/fix-for-48659
Replace platforms.Format with platforms.FormatAll in user-visible messages and logs.
2025-05-21 08:03:34 +00:00
Sebastiaan van Stijn
e8c269843c builder-next: remove support for deprecated schema1 images
the core/remotes/docker/schema1 package is deprecated and removed
in containerd v2.1; remove its use as we already deprecated these
images for "docker pull" and elsewhere.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-20 23:33:39 +02:00
Anthony Nandaa
a9ec07a005 builder-next: add buildkit executor for wcow
WCOW support on Buildkit is now coming to maturity. As part
of making this generally available, integrating it in
Docker Engine is critical for it's adoption.

This commit adds the buildkit execuitor for WCOW as the
next-builder (backend) for building Windows containers.

This will be an opt-in feature, with the end users setting
DOCKER_BUILDKIT=1 environment variable to use it.

The integration tests bit has also been handled.
https://github.com/moby/buildkit/pull/5956,
BUILDKIT_REF has been set to `master` for now, so
that the tests can run successfully. On the next
release, we will revert this back to using releases.

Signed-off-by: Anthony Nandaa <profnandaa@gmail.com>
2025-05-20 00:14:09 +03:00
Sebastiaan van Stijn
8601b22f5d Merge pull request #50032 from vvoland/vendor-buildkit
vendor: github.com/moby/buildkit v0.22.0-rc2
2025-05-19 22:15:20 +02:00
Sebastiaan van Stijn
dfcf95540f Merge pull request #50019 from vvoland/client-cerrdefs
client: use containerd errdefs checks
2025-05-19 22:14:15 +02:00
Paweł Gronowski
e655763837 client/volume: use containerd errdefs checks
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-05-19 20:37:39 +02:00
Paweł Gronowski
6bde39b729 client/utils: use containerd errdefs checks
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-05-19 20:37:39 +02:00
Paweł Gronowski
144363fea2 client/task_list_test: use containerd errdefs checks
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-05-19 20:37:37 +02:00
Paweł Gronowski
6cd9eaf5ab client/task_inspect_test: use containerd errdefs checks
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-05-19 20:37:05 +02:00
Paweł Gronowski
68a8a8f3c8 client/swarm: use containerd errdefs checks
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-05-19 20:37:03 +02:00
Paweł Gronowski
0b4495463f client/service: use containerd errdefs checks
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-05-19 20:36:36 +02:00
Paweł Gronowski
ad4a3d32c6 client/secret: use containerd errdefs checks
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-05-19 20:34:08 +02:00
Paweł Gronowski
df96159df0 client/request: use containerd errdefs checks
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-05-19 20:34:08 +02:00
Paweł Gronowski
7e8b26ecb9 client/plugin: use containerd errdefs checks
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-05-19 20:34:08 +02:00
Paweł Gronowski
2356f435a6 client/node: use containerd errdefs checks
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-05-19 20:34:04 +02:00
Paweł Gronowski
4a830df491 client/network: use containerd errdefs checks
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-05-19 20:32:24 +02:00
Paweł Gronowski
8f2bf4aef5 client/info_test: use containerd errdefs checks
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-05-19 20:32:24 +02:00
Paweł Gronowski
a1035ec59b client/image: use containerd errdefs checks
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-05-19 20:32:23 +02:00
Paweł Gronowski
370b7e65fc client/events_test: use containerd errdefs checks
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-05-19 20:32:23 +02:00
Paweł Gronowski
27e64d3bdb client/distribution_inspect_test: use containerd errdefs checks
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-05-19 20:32:23 +02:00
Paweł Gronowski
f030c7bf10 client/disk_usage_test: use containerd errdefs checks
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-05-19 20:32:23 +02:00
Paweł Gronowski
c75ca8ef10 client/container: use containerd errdefs checks
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-05-19 20:32:23 +02:00
Paweł Gronowski
eafa2266f6 client/config: use containerd errdefs checks
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-05-19 20:32:22 +02:00
Paweł Gronowski
685fa0bb91 client/checkpoint: use containerd errdefs checks
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-05-19 20:32:22 +02:00
Cesar Talledo
bb41e5a32e Replace platforms.Format with platforms.FormatAll in functional code.
Signed-off-by: Cesar Talledo <cesar.talledo@docker.com>
2025-05-19 11:07:28 -07:00
Sebastiaan van Stijn
cbeec12d12 Merge pull request #50027 from thaJeztah/move_service_types
api/types: move swarm-related types to api/types/swarm
2025-05-19 19:59:07 +02:00
Paweł Gronowski
9319fefe35 vendor: github.com/moby/buildkit v0.22.0-rc2
full diff: https://github.com/moby/buildkit/compare/v0.22.0-rc1...v0.22.0-rc2

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-05-19 18:49:10 +02:00
Cesar Talledo
cf11cd1aac Replace platforms.Format with platforms.FormatAll in user-visible messages and logs.
Use FormatAll in user-visible messages and logs, since it includes the image's
platform OS version (when set).

Fixes https://github.com/moby/moby/issues/48659.

Signed-off-by: Cesar Talledo <cesar.talledo@docker.com>
2025-05-19 08:47:44 -07:00
Sebastiaan van Stijn
0b1c7a8306 api/types: move ServiceUpdateOptions to api/types/swarm
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-19 16:30:33 +02:00
Sebastiaan van Stijn
31d62930f7 api/types: move ServiceCreateOptions to api/types/swarm
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-19 16:30:31 +02:00
Sebastiaan van Stijn
5ad0867236 api/types: move TaskListOptions to api/types/swarm
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-19 16:30:03 +02:00
Sebastiaan van Stijn
7e8f630bec api/types: move SwarmUnlockKeyResponse to api/types/swarm
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-19 13:43:19 +02:00
Sebastiaan van Stijn
f008d85edc api/types: move NodeListOptions, NodeRemoveOptions to types/swarm
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-19 13:43:16 +02:00
Sebastiaan van Stijn
b13528522a api/types: move ServiceListOptions, ServiceInspectOptions to types/swarm
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-19 13:41:59 +02:00
Sebastiaan van Stijn
7937f0846c Merge pull request #50025 from thaJeztah/move_builder_options
api/types: move build-related types to api/types/build
2025-05-19 13:40:40 +02:00
Sebastiaan van Stijn
7f4bf1229a Merge pull request #50024 from thaJeztah/move_secret_config_types
api/types: move config and secret options to api/types/swarm
2025-05-19 13:40:21 +02:00
Paweł Gronowski
02fe3a8dd1 Merge pull request #50018 from vvoland/client-gotesttools
client: Use gotest.tools style assertions
2025-05-19 11:38:05 +00:00
Paweł Gronowski
5e8fd897e1 client/volume: use gotest.tools-style asserts
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-05-19 12:04:10 +02:00
Paweł Gronowski
9432eff6bc client/utils_test: use gotest.tools-style asserts
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-05-19 12:04:09 +02:00
Paweł Gronowski
adf7ecc366 client/task_list_test: use gotest.tools-style asserts
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-05-19 12:04:09 +02:00
Paweł Gronowski
b781699ee2 client/task_inspect_test: use gotest.tools-style asserts
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-05-19 12:04:08 +02:00
Paweł Gronowski
d8ee5caf9a client/swarm: use gotest.tools-style asserts
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-05-19 12:04:08 +02:00
Paweł Gronowski
a6cd40de6b client/service: use gotest.tools-style asserts
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-05-19 12:04:08 +02:00
Paweł Gronowski
3658dae265 client/secret: use gotest.tools-style asserts
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-05-19 12:04:07 +02:00
Paweł Gronowski
2e65796c86 client/request_test: use gotest.tools-style asserts
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-05-19 12:04:07 +02:00
Paweł Gronowski
44f30261da client/plugin: use gotest.tools-style asserts
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-05-19 12:04:07 +02:00
Paweł Gronowski
832efcd672 client/options_test: use gotest.tools-style asserts
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-05-19 12:04:07 +02:00
Paweł Gronowski
88453254af client/node: use gotest.tools-style asserts
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-05-19 12:04:06 +02:00
Paweł Gronowski
047343d070 client/network: use gotest.tools-style asserts
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-05-19 12:04:06 +02:00
Paweł Gronowski
6402a106e7 client/image: use gotest.tools-style asserts
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-05-19 12:04:06 +02:00
Paweł Gronowski
043c7fa539 client/hijack_test: use gotest.tools-style asserts
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-05-19 12:04:05 +02:00
Paweł Gronowski
a8ed3bd734 client/events_test: use gotest.tools-style asserts
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-05-19 12:04:05 +02:00
Paweł Gronowski
c88f921331 client/disk_usage_test: use gotest.tools-style asserts
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-05-19 12:04:05 +02:00
Paweł Gronowski
051dae4fdc client/container: use gotest.tools-style asserts
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-05-19 12:04:05 +02:00
Paweł Gronowski
cae3ccd34b client/config_create: use gotest.tools-style asserts
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-05-19 12:04:04 +02:00
Paweł Gronowski
bfc684d3f7 client/client_test: use gotest.tools-style asserts
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-05-19 12:04:04 +02:00
Paweł Gronowski
19f3259093 client/checkpoint: use gotest.tools-style asserts
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-05-19 12:04:04 +02:00
Sebastiaan van Stijn
a411a39be0 api/types: move ConfigCreateResponse, ConfigListOptions to types/swarm
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-19 09:39:23 +02:00
Sebastiaan van Stijn
23117afca8 api/types: move SecretCreateResponse, SecretListOptions to types/swarm
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-19 09:36:48 +02:00
Sebastiaan van Stijn
3d1e4d9002 api/types: move build-related types to api/types/build
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-19 09:30:27 +02:00
Sebastiaan van Stijn
94e84169ec Merge pull request #49949 from henry118/pushtag
Fix multiarch image push tag for containerd snapshotter
2025-05-19 06:57:59 +02:00
Sebastiaan van Stijn
bb7dbaafcd api/types: move BuildResult to api/types/build.Result
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-17 00:39:09 +02:00
Paweł Gronowski
4b9f0707a0 Merge pull request #50017 from thaJeztah/align_go_build_versions
align //go:build versions
2025-05-16 19:00:44 +00:00
Paweł Gronowski
71862f3303 Merge pull request #49904 from thaJeztah/deprecate_bridgenfip_fields_take2
API: /info: remove BridgeNfIptables, BridgeNfIp6tables fields (take 2)
2025-05-16 18:51:00 +00:00
Sebastiaan van Stijn
6505d3877c API: /info: remove BridgeNfIptables, BridgeNfIp6tables fields
The `BridgeNfIptables` and `BridgeNfIp6tables` fields in the
`GET /info` response were deprecated in API v1.48, and are now omitted
in API v1.50.

With this patch, old API version continue to return the field:

    curl -s --unix-socket /var/run/docker.sock http://localhost/v1.48/info | jq .BridgeNfIp6tables
    false

    curl -s --unix-socket /var/run/docker.sock http://localhost/v1.48/info | jq .BridgeNfIptables
    false

Omitting the field in API v1.50 and above

    curl -s --unix-socket /var/run/docker.sock http://localhost/v1.50/info | jq .BridgeNfIp6tables
    null

    curl -s --unix-socket /var/run/docker.sock http://localhost/v1.50/info | jq .BridgeNfIptables
    null

This reverts commit eacbbdeec6, and re-applies
a variant of 5d2006256f

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-16 19:49:52 +02:00
Paweł Gronowski
b45aa469ca Merge pull request #49897 from scalewithlee/49768-docker-stats-follow-up
Refactor CPU stats collection
2025-05-16 16:42:34 +00:00
Sebastiaan van Stijn
ede73684c4 Merge pull request #49968 from thaJeztah/dont_persist_removal_in_progress
container: don't persist State.RemovalInProgress on disk
2025-05-16 18:31:52 +02:00
Sebastiaan van Stijn
2ff42e192f Merge pull request #50012 from thaJeztah/deprecate_client_iserrnotfound
client: deprecate IsErrNotFound
2025-05-16 18:21:17 +02:00
Sebastiaan van Stijn
48733b0751 Merge pull request #47883 from dmcgowan/errdefs-check-containerd
Update errdefs package to use containerd/errdefs
2025-05-16 18:20:41 +02:00
Paweł Gronowski
81116f75de Merge pull request #49980 from vvoland/devices-discovery
daemon: Discover devices and include in system info
2025-05-16 16:08:17 +00:00
Paweł Gronowski
e190fdf286 Merge pull request #50015 from thaJeztah/move_prune_options
api/types: move build cache types to api/types/build
2025-05-16 16:06:07 +00:00
Sebastiaan van Stijn
114b8a4fa9 Remove unused image/v1 code
This image format is only used for docker save / docker load.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-16 18:00:06 +02:00
Sebastiaan van Stijn
7130cd4f16 Remove DockerSchema1RegistrySuite schema 2 version 1 tests
Also remove the DOCKER_ALLOW_SCHEMA1_PUSH_DONOTUSE from Jenkins

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-16 18:00:06 +02:00
Tibor Vass
7c09fa25fd distribution: remove v2 schema1 push
Manifest v2 schema1 was deprecated in 4866f5139a1 and this commit
removes the push code for v2 schema1.

This reverts commit f695e98cb7,
adjusted for changes that were made since

daemon: do not mkdir trust directory

Remove push tests and move UUID tests to integration

Partial revert of f23a51a860.

Only the schema1 push tests are removed but the schema1 pull tests
are still desired.

The UUID test is moved from integration-cli to integration.

Signed-off-by: Tibor Vass <tibor@docker.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-16 18:00:06 +02:00
Sebastiaan van Stijn
a891e4e3e1 validation: temporarily allows changes in integration-cli
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-16 18:00:06 +02:00
Sebastiaan van Stijn
2a96d2eb8d align //go:build versions
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-16 17:52:43 +02:00
Paweł Gronowski
c1b2be0399 client/info_test: Use gotest.tools asserts
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-05-16 17:03:31 +02:00
Paweł Gronowski
9095698a5c daemon: Discover devices and include in system info
Add ability for the device driver to implement a device discovery
mechanism and expose discovered devices in the `docker info` output.

Currently it's only implemented for CDI devices.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-05-16 17:03:29 +02:00
Paweł Gronowski
f95a7c47e8 api: bump API version to 1.50
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-05-16 17:03:28 +02:00
Paweł Gronowski
b70b496505 testutil/daemon: Don't use devcontainers daemon.json
Prevent the daemon spawned for integration tests from sourcing the
daemon configuration intended interactive dev shell usage.

Before this change, integration tests would fail to create a daemon
with different configuration provided via cli flags (like `--feature`)
if they're already specified in the default daemon.json.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-05-16 17:03:26 +02:00
Paweł Gronowski
23bbfea718 daemon: Fix error log when CDI cache creation failed
Logger was created but no consumed.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-05-16 17:03:25 +02:00
Lee Gaines
6d7a370fe5 Refactor CPU usage stats test to use go:embed
Refactor the system CPU usage testing approach for improved maintainability:

1. Extract the core CPU usage parsing logic into a new `readSystemCPUUsage`
   function that accepts an io.Reader, making it more testable and modular.

2. Use go:embed directive to embed the test data file at compile time,
   eliminating runtime file operations and making tests more reliable.

3. Simplify the test by removing global variable mocking in favor of a more
   direct approach with the new reader-based function.

4. Maintain full test coverage for the long "intr" line edge case which was
   crucial for the original bug fix, while making the test more maintainable.

This change preserves the original test behavior while improving code quality,
testability, and making the tests self-contained.

Signed-off-by: Lee Gaines <leetgaines@gmail.com>
2025-05-16 10:23:49 -04:00
Sebastiaan van Stijn
eefe68a37c api/types: move build cache types to api/types/build
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-16 16:23:32 +02:00
Sebastiaan van Stijn
7aa7369f1f client: deprecate IsErrNotFound
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-16 15:32:04 +02:00
Paweł Gronowski
c04dec1143 Merge pull request #49998 from thaJeztah/fix_linting
daemon: startIngressWorker: fix S1000: should use for range (staticcheck)
2025-05-16 11:44:56 +00:00
Paweł Gronowski
bcc7954343 Merge pull request #49707 from jsternberg/containerd-system-df
containerd: include present content size in layer disk usage calculation
2025-05-16 10:45:14 +00:00
Akihiro Suda
242985bcfc Merge pull request #50009 from thaJeztah/update_authors
update authors and mailmap
2025-05-16 15:32:48 +09:00
Sebastiaan van Stijn
a022e916c8 update authors and mailmap
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-16 01:06:19 +02:00
Sebastiaan van Stijn
fd1a78e0a3 Merge pull request #49942 from thaJeztah/exec_start_cleanups
daemon: Daemon.ContainerExecStart: rename err-return, and minor refactor
2025-05-15 23:51:11 +02:00
Sebastiaan van Stijn
994d2800c1 Merge pull request #49963 from vvoland/cdi-ga
daemon: Enable CDI by default
2025-05-15 23:49:40 +02:00
Sebastiaan van Stijn
63bcfab0ed Merge pull request #49932 from corhere/libn/networkdb-fixes
libnetwork/networkdb: fix logical race conditions
2025-05-15 23:05:55 +02:00
Cory Snider
66dab7ac65 Merge pull request #50007 from corhere/libn/fix-49402-harder
libnetwork/networkdb: use correct index in GetTableByNetwork
2025-05-15 16:23:53 -04:00
Paweł Gronowski
4cecce03f6 daemon: Enable CDI by default
CDI will now be enabled by default unless opted-out by setting `cdi`
feature to `false`.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-05-15 22:13:19 +02:00
Sebastiaan van Stijn
07466d2e9b daemon: Daemon.ContainerExecStart: rename err-return, and minor refactor
- rename the error-return to prevent accidental shadowing
- remove some intermediate variables
- usee a struct-literal for specs.Process
- optimize logging-code to not use chained "WithField"
- remove punctuation from error-message

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-15 22:09:56 +02:00
Sebastiaan van Stijn
5919ab26f0 Merge pull request #49992 from thaJeztah/snapshot_health
container: Snapshot.Health: change type to container.HealthStatus
2025-05-15 22:07:27 +02:00
Sebastiaan van Stijn
e7ccfae846 Merge pull request #49991 from thaJeztah/container_summary_state
api/types/container: Summary.State change type to ContainerState
2025-05-15 21:53:17 +02:00
Sebastiaan van Stijn
702d19e2c2 Merge pull request #49961 from corhere/addrplugin-adapter
d/cluster/convert: expose Addr() on plugins
2025-05-15 21:26:15 +02:00
Cory Snider
d5c370dee6 libnetwork/networkdb: use correct index in GetTableByNetwork
Commit ec65f2d21b has a typo: it switches
indexes[byTable] with indexes[byNetwork]. The indexes are not
equivalent. Switch it back.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-05-15 15:19:06 -04:00
Sebastiaan van Stijn
9d1b069a4b Merge pull request #50002 from mmorel-35/usestdlibvars
fix usestdlibvars
2025-05-15 20:14:29 +02:00
Cory Snider
270a4d41dc libn/networkdb: stop table events from racing network leaves
When a node leaves a network or the cluster, or memberlist considers the
node as failed, NetworkDB atomically deletes all table entries (for the
left network) owned by the node. This maintains the invariant that table
entries owned by a node are present in the local database indices iff
that node is an active cluster member which is participating in the
network the entries pertain to.

(*NetworkDB).handleTableEvent() is written in a way which attempts to
minimize the amount of time it is in a critical section with the mutex
locked for writing. It first checks under a read-lock whether both the
local node and the node where the event originated are participating in
the network which the event pertains to. If the check passes, the mutex
is unlocked for reading and locked for writing so the local database
state is mutated in a critical section. That leaves a window of time
between the participation check the write-lock being acquired for a
network or node event to arrive and be processed. If a table event for a
node+network races a node or network event which triggers the purge of
all table entries for the same node+network, the invariant could be
violated. The table entry described by the table event may be reinserted
into the local database state after being purged by the node's leaving,
resulting in an orphaned table entry which the local node will bulk-sync
to other nodes indefinitely.

It's not completely wrong to perform a pre-flight check outside of the
critical section. It allows for an early return in the no-op case
without having to bear the cost of synchronization. But such optimistic
concurrency control is only sound if the condition is double-checked
inside the critical section. It is tricky to get right, and this
instance of optimistic concurrency control smells like a case of
premature optimization. Move the pre-flight check into the critical
section to ensure that the invariant is maintained.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-05-15 12:57:37 -04:00
Matthieu MOREL
205ba05feb fix usestdlibvars
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-05-15 18:24:58 +02:00
Akihiro Suda
49e43afb47 Merge pull request #49997 from thaJeztah/bump_crun
Dockerfile: update crun to 1.21
2025-05-16 00:57:02 +09:00
Derek McGowan
23fa0ae74a Cleanup http status error checks
Use the errdefs resolver to ensure the status code is chosen from the
first outermost error. Remove duplicate containerd errdefs checks.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-05-15 08:05:53 -07:00
Derek McGowan
fadb571106 Update api status checks to use containerd/errdefs
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-05-15 08:05:53 -07:00
Derek McGowan
5c16f2d091 Use standard library interface to unwrap errors
The `Cause()` function is not part of the standard library and should
not be used or relied on. `pkg/errors` already has compatibility with
the standard library.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-05-15 08:05:52 -07:00
Derek McGowan
a90a9d899b Ignore deprecations for internal errdefs package
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-05-15 08:05:50 -07:00
Derek McGowan
f1bb44aeee Use containerd errdefs for error checks
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-05-15 08:00:13 -07:00
Sebastiaan van Stijn
ba2ddd75e4 Dockerfile: update crun to 1.21
full diff: https://github.com/containers/crun/compare/1.12...1.21

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-15 16:55:46 +02:00
Jonathan A. Sternberg
f07242f6d7 containerd: include present content size in disk usage calculations
The present content size is included in the image size usage and should
be included in the total size that the layer takes up on disk.

This prevents an issue where the reclaimable amount reported by the CLI
was a negative number.

This also updates the `/system/df` endpoint to use a new type that
computes information that was previously computed by the CLI. Computing
these in the server should require less work from the CLI and ensure
the calculations are more accurate because the CLI doesn't have to
reconstruct the numbers.

Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com>
2025-05-15 09:46:51 -05:00
Akihiro Suda
2c5f8c51c5 Merge pull request #49996 from thaJeztah/bump_compose
Dockerfile: update compose to v2.36.0
2025-05-15 23:46:25 +09:00
Akihiro Suda
2438415cb8 Merge pull request #49999 from thaJeztah/vendor_accelerated_container_image
vendor: github.com/containerd/accelerated-container-image v1.3.0
2025-05-15 23:46:12 +09:00
Sebastiaan van Stijn
3ded7b97d0 vendor: github.com/containerd/accelerated-container-image v1.3.0
no changes in vendored code

full diff: https://github.com/containerd/accelerated-container-image/compare/v1.2.3...v1.3.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-15 14:53:35 +02:00
Sebastiaan van Stijn
68e025a11b daemon: startIngressWorker: fix S1000: should use for range (staticcheck)
daemon/network.go:156:3: S1000: should use for range instead of for { select {} } (staticcheck)
            for {
            ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-15 14:49:34 +02:00
Sebastiaan van Stijn
493662ddd3 Merge pull request #49870 from mmorel-35/golangci-lint@v2
chore: bump golangci-lint to v2
2025-05-15 14:42:44 +02:00
Sebastiaan van Stijn
7bc6fd09da Dockerfile: update compose to v2.36.0
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-15 14:05:20 +02:00
Sebastiaan van Stijn
a6ad2f2157 Merge pull request #49988 from thaJeztah/flaky_TestPortMappedHairpinWindows
integration/networking: mark TestPortMappedHairpinWindows as flaky
2025-05-15 13:12:00 +02:00
Sebastiaan van Stijn
8cb41620fd Merge pull request #49990 from ereslibre/fix-restore-containers-with-cdi
fix: load the CDI driver before the dockerd daemon starts
2025-05-15 13:10:47 +02:00
Sebastiaan van Stijn
76b24759f0 container: Snapshot.Health: change type to container.HealthStatus
container.HealthStatus is a pseudo-type (alias for string) that was
introduced in 1e4bb14bcd.

Changing this field to use that type as a potential stepping-stone
towards making that type a distinct type.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-15 12:17:08 +02:00
Sebastiaan van Stijn
7a7d72e874 api/types/container: Summary.State change type to ContainerState
ContainerState is currently an alias for string, so this should not
be a disruptive change, but is a stepping-stone to make it a distinct
type in future.

Relates to b811829595

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-15 12:11:35 +02:00
Rafael Fernández López
8e57a019dc fix: load the CDI driver before the dockerd daemon starts
Signed-off-by: Rafael Fernández López <ereslibre@ereslibre.es>
2025-05-15 12:00:28 +02:00
Rob Murray
b87aecc50a Merge pull request #49985 from corhere/libn/set-primary-key-lock
libn/networkdb: SetPrimaryKey() under a write lock
2025-05-15 10:30:41 +01:00
Paweł Gronowski
c4dc09eac1 Merge pull request #49848 from jsternberg/remove-unlease-snapshots-from-deleted-configs
containerd: remove unleaseSnapshotsFromDeletedConfigs
2025-05-15 09:04:52 +00:00
Sebastiaan van Stijn
c2348c9fc3 Merge pull request #49986 from tonistiigi/buildkit-v0.22.0-rc1
vendor: update buildkit to v0.22.0-rc1
2025-05-15 11:01:53 +02:00
Sebastiaan van Stijn
b3ed54db81 integration/networking: mark TestPortMappedHairpinWindows as flaky
This test is failing frequently on Windows;

    === FAIL: github.com/docker/docker/integration/networking TestPortMappedHairpinWindows (12.37s)
        nat_windows_test.go:108: assertion failed: error is not nil: Post "http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.49/containers/1181d6510a2f55c742b7b183aa7324eddbc213cd15797428c4062dcb031fb825/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:"laughing_lederberg" id:"8605ebbc2c7c")

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-15 10:57:00 +02:00
Matthieu MOREL
7b5d2b4ec3 chore: bump golangci-lint to v2
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-05-15 10:00:16 +02:00
Tonis Tiigi
3d1cfb4de0 vendor: update buildkit to v0.22.0-rc1
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2025-05-14 17:16:15 -07:00
Cory Snider
c9b01e0c4c libn/networkdb: SetPrimaryKey() under a write lock
(*NetworkDB).SetPrimaryKey() acquires a read lock on the NetworkDB
instance. That seems sound on the surface as it is only reading from the
NetworkDB struct, not mutating it. However, concurrent calls to
(*memberlist.Keyring).UseKey() would get flagged by Go's race detector
due to some questionable locking in its implementation. Acquire an
exclusive lock in SetPrimaryKey so concurrent calls don't race each
other.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-05-14 19:45:14 -04:00
Paweł Gronowski
2e25c2b14f Merge pull request #49702 from jsternberg/containerd-dangling-build-image
containerd: images overridden by a build are kept dangling
2025-05-14 17:35:32 +00:00
Jonathan A. Sternberg
61646c8bfc containerd: remove unleaseSnapshotsFromDeletedConfigs
Removes workaround for https://github.com/moby/buildkit/issues/3797 now
that the underlying issue is fixed.

Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com>
2025-05-14 09:20:22 -05:00
Rob Murray
2154b9c646 Merge pull request #49976 from thaJeztah/fix_godoc
integration, libnetwork: fix some godoc comments (ST1020)
2025-05-14 10:50:53 +01:00
Rob Murray
350bb5197a nftables: attempt a table-reload after an Apply error
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-05-14 10:38:11 +01:00
Rob Murray
06afbe9618 Check nftables is enabled before applying updates
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-05-14 10:38:11 +01:00
Rob Murray
976f855f68 Add OTEL span for nftables updates
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-05-14 10:38:11 +01:00
Paweł Gronowski
c3f484dada Merge pull request #49965 from thaJeztah/container_state_const
api/types/container: add ContainerState and const for container state
2025-05-14 08:50:49 +00:00
Rob Murray
eeba428939 Make WSL2Mirrored a Firewaller param
The bridge driver should figure out whether it's running in
a mirrored WSL2 setup, and tell the firewaller.

So, move the WSL2-deciding code back into the bridge driver
and unit test it there. Use TestIptabler to check the rules
are constructed properly.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-05-14 09:38:32 +01:00
Rob Murray
9f1e3ae306 Merge pull request #49861 from robmry/bridge_test_firewaller
Unit test the bridge driver in terms of its firewaller
2025-05-14 09:30:02 +01:00
Sebastiaan van Stijn
1028b123e8 integration, libnetwork: fix some godoc comments (ST1020)
integration/internal/network/ops.go:137:1: ST1020: comment on exported function WithIPAMRange should be of the form "WithIPAMRange ..." (staticcheck)
    // WithIPAM adds an IPAM with the specified Subnet, IPRange and Gateway to the network
    ^
    libnetwork/bitmap/sequence.go:50:1: ST1020: comment on exported function New should be of the form "New ..." (staticcheck)
    // NewHandle returns a new Bitmap of ordinals in the interval [0, n).
    ^
    libnetwork/diagnostic/server.go:61:1: ST1020: comment on exported method HandleFunc should be of the form "HandleFunc ..." (staticcheck)
    // Handle registers the handler function for the given pattern,
    ^
    libnetwork/endpoint.go:388:1: ST1020: comment on exported method Key should be of the form "Key ..." (staticcheck)
    // endpoint Key structure : endpoint/network-id/endpoint-id
    ^
    libnetwork/network.go:574:1: ST1020: comment on exported method MarshalJSON should be of the form "MarshalJSON ..." (staticcheck)
    // TODO : Can be made much more generic with the help of reflection (but has some golang limitations)
    ^
    libnetwork/network.go:633:1: ST1020: comment on exported method UnmarshalJSON should be of the form "UnmarshalJSON ..." (staticcheck)
    // TODO : Can be made much more generic with the help of reflection (but has some golang limitations)
    ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-14 10:11:59 +02:00
Cory Snider
a3aea15257 libn/networkdb: Watch() without race conditions
NetworkDB's Watch() facility is problematic to use in practice. The
stream of events begins when the watch is started, so the watch cannot
be used to process table entries that existed beforehand. Either option
to process existing table entries is racy: walking the table before
starting the watch leaves a race window where events could be missed,
and walking the table after starting the watch leaves a race window
where created/updated entries could be processed twice.

Modify Watch() to initialize the channel with synthetic CREATE events
for all existing entries owned by remote nodes before hooking it up to
the live event stream. This way watchers observe an equivalent sequence
of events irrespective of whether the watch was started before or after
entries from remote nodes are added to the database. Remove the bespoke
and racy synthetic event replay logic for driver watches from the
libnetwork agent.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-05-13 14:09:51 -04:00
Cory Snider
ada8bc3695 libn/networkdb: record tombstones for all deletes
The gossip protocol which powers NetworkDB does not guarantee in-order
reception of events. This poses a problem with deleting entries: without
some mechanism to discard stale CREATE or UPDATE events received after a
DELETE, out-of-order reception of events could result in a deleted entry
being spuriously resurrected in the local NetworkDB state! NetworkDB
handles this situation by storing "tombstone" entries for a period of
time with the Lamport timestamps of the entries' respective DELETE
events. Out-of-order CREATE or UPDATE events will be ignored by virtue
of having older timestmaps than the tombstone entry, just like how it
works for entries that have not yet been deleted.

NetworkDB was only storing a tombstone if the entry was already present
in the local database at the time of the DELETE event. If the first
event received for an entry is a DELETE, no tombstone is stored. If a
stale CREATE/UPDATE event for the entry (with an older timestamp than
the DELETE) is subsequently received, NetworkDB erroneously creates a
live entry in the local state with stale data. Modify NetworkDB to store
tombstones for DELETE events irrespective of whether the entry was known
to NetworkDB beforehand so that it correctly discards out-of-order
CREATEs and UPDATEs in all cases.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-05-13 14:09:51 -04:00
Cory Snider
c68671d908 libn/networkdb: b'cast watch events from local POV
NetworkDB gossips changes to table entries to other nodes using distinct
CREATE, UPDATE and DELETE events. It is unfortunate that the wire
protocol distinguishes CREATEs from UPDATEs as nothing useful can be
done with this information. Newer events for an entry invalidate older
ones, so there is no guarantee that a CREATE event is broadcast to any
node before an UPDATE is broadcast. And due to the nature of gossip
protocols, even if the CREATE event is broadcast from the originating
node, there is no guarantee that any particular node will receive the
CREATE before an UPDATE. Any code which handles an UPDATE event
differently from a CREATE event is therefore going to behave in
unexpected ways in less than perfect conditions.

NetworkDB table watchers also receive CREATE, UPDATE and DELETE events.
Since the watched tables are local to the node, the events could all
have well-defined meanings that are actually useful. Unfortunately
NetworkDB is just bubbling up the wire-protocol event types to the
watchers. Redefine the table-watch events such that a CREATE event is
broadcast when an entry pops into existence in the local NetworkDB, an
UPDATE event is broadcast when an entry which was already present in the
NetworkDB state is modified, and a DELETE event is broadcast when an
entry which was already present in the NetworkDB state is marked for
deletion. DELETE events are broadcast with the same value as the most
recent CREATE or UPDATE event for the entry.

The handler for endpoint table events in the libnetwork agent assumed
incorrectly that CREATE events always correspond to adding a new active
endpoint and that UPDATE events always correspond to disabling an
endpoint. Fix up the handler to handle CREATE and UPDATE events using
the same code path, checking the table entry's ServiceDisabled flag to
determine which action to take.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-05-13 14:09:51 -04:00
Rob Murray
ba0ad9e80f Unit test the bridge driver in terms of its firewaller
Don't inspect iptables rules, because the driver's Firewaller won't
always be an iptabler.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-05-13 18:27:55 +01:00
Henry Wang
a7ef4a208d Fix multiarch image push tag for containerd snapshotter
Signed-off-by: Henry Wang <henwang@amazon.com>
2025-05-13 17:14:36 +00:00
Sebastiaan van Stijn
854f3f62db container: don't persist State.RemovalInProgress on disk
State.RemovalInProgress was originally non-exported when it was added in
[40945fc186][1], adding a comment that the
field should not be persisted to disk.

But when moved to a separate package in [6bb0d1816a][2],
it was was exported, without adding `json:"-"`. As a result, it's now persisted
to disk;

    cat /var/lib/docker/containers/e493924a99cad918cda8048f967032729105ee072d563d734125cec46e1b5885/config.v2.json | jq .State
    {
      "Running": true,
      "Paused": false,
      "Restarting": false,
      "OOMKilled": false,
      "RemovalInProgress": false,
      "Dead": false,
      "Pid": 5053,
      "ExitCode": 0,
      "Error": "",
      "StartedAt": "2025-05-13T12:12:15.115512564Z",
      "FinishedAt": "0001-01-01T00:00:00Z",
      "Health": null
    }

Note that this type is used internally, and (while similar) is not used for
API responses;

    docker inspect e493924a99cad918cda8048f967032729105ee072d563d734125cec46e1b5885 | jq .[].State
    {
      "Status": "running",
      "Running": true,
      "Paused": false,
      "Restarting": false,
      "OOMKilled": false,
      "Dead": false,
      "Pid": 5053,
      "ExitCode": 0,
      "Error": "",
      "StartedAt": "2025-05-13T12:12:15.115512564Z",
      "FinishedAt": "0001-01-01T00:00:00Z"
    }

However, interestingly, [`daemon.restore`][3] does take this field into account
while restoring containers, which seems that it depends on the field being
persisted to disk. That logic was added in [ce72473197][4].
That logic may be redundant if we no longer persist to disk, as the `State.Dead`
is already set when cleaning up a container in [`daemon.cleanupContainer`][5].

[1]: 40945fc186
[2]: 6bb0d1816a (diff-60173e67d15f3085dd09956b3ffa83566ae25fec61cfe08ddd2e1c37223e3be7R24)
[3]: d42d79dceb/daemon/daemon.go (L498-L514)
[4]: ce72473197
[5]: 294f0c36e4/daemon/delete.go (L124-L126)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-13 18:09:34 +02:00
Sebastiaan van Stijn
44b653ef99 container: deprecate IsValidStateString
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-13 15:03:42 +02:00
Sebastiaan van Stijn
e477df3b31 daemon/cluster/executor: use container.ContainerState consts
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-13 15:03:41 +02:00
Sebastiaan van Stijn
3bbdda696d use container.ContainerState consts in tests
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-13 15:03:34 +02:00
Sebastiaan van Stijn
b811829595 api/types/container: add ContainerState and const for container state
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-13 14:49:04 +02:00
Paweł Gronowski
294f0c36e4 Merge pull request #49943 from thaJeztah/cleanupContainer_cleanup_errs
daemon: rmLink, cleanupContainer: cleanup errors
2025-05-13 12:20:28 +00:00
Paweł Gronowski
d42d79dceb Merge pull request #49924 from dmcgowan/api-system-build-backend
Create api interface to define build usage backend
2025-05-13 11:41:49 +00:00
Paweł Gronowski
10ac996d64 Merge pull request #49960 from thaJeztah/TestPruneDontDeleteUsedDangling_noshadow
TestPruneDontDeleteUsedDangling: rename var that shadowed import
2025-05-13 11:19:23 +00:00
Paweł Gronowski
0d6d4456ea Merge pull request #49958 from thaJeztah/container_state_defer
container: use defer for locks
2025-05-13 11:02:25 +00:00
Paweł Gronowski
7828a65aeb Merge pull request #49956 from thaJeztah/container_state_godoc
container: update GoDoc for State
2025-05-13 10:18:37 +00:00
Paweł Gronowski
3af89f31f6 Merge pull request #49959 from thaJeztah/testing_use_native_tempdir_step2
use Go's native t.TempDir() in tests (step 2)
2025-05-13 09:07:41 +00:00
Cory Snider
8b6d6b9ad5 d/cluster/convert: expose Addr() on plugins
The swarmPlugin type does not implement the Swarm plugin.AddrPlugin
interface because it embeds an interface value which does not include
that method in its method set. (You can type-assert an interface value
to another interface which the concrete type implements, but a struct
embedding an interface value is not itself an interface value.) Wrap the
plugin with a different adapter type which exposes the Addr() method if
the concrete plugin implements it.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-05-12 20:28:47 -04:00
Sebastiaan van Stijn
d89cd570f0 Merge pull request #49867 from robmry/make_integration-cli_iptablesless
Remove/replace integration-cli tests that use iptables directly
2025-05-12 20:26:04 +02:00
Sebastiaan van Stijn
17702d9dcb Merge pull request #49862 from robmry/test_iptabler_params
Test iptabler params
2025-05-12 20:09:01 +02:00
Rob Murray
37259540e9 Remove/replace integration-cli tests that use iptables directly
In preparation for testing with an nftables backend.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-05-12 17:51:59 +01:00
Rob Murray
daeb080ff1 Test Iptabler params
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-05-12 17:30:40 +01:00
Sebastiaan van Stijn
ea2e147c4c TestPruneDontDeleteUsedDangling: rename var that shadowed import
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-12 18:03:58 +02:00
Rob Murray
cb38cc0fdd Merge pull request #49860 from robmry/firewaller_interface
Firewaller interface
2025-05-12 14:18:16 +01:00
Sebastiaan van Stijn
e824fed281 Merge pull request #49937 from corhere/libn/fix-49402
libn/networkdb: fix data race in GetTableByNetwork
2025-05-12 14:48:37 +02:00
Sebastiaan van Stijn
99368eeba2 Merge pull request #49948 from corhere/process-all-attachments
Fix possible overlapping IPs when ingressNA == nil
2025-05-12 14:46:36 +02:00
Sebastiaan van Stijn
02e800dcbb plugin: use t.TempDir
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-12 14:35:24 +02:00
Sebastiaan van Stijn
57b27f2e9e image: use t.TempDir and rename vars that shadowed
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-12 14:35:24 +02:00
Sebastiaan van Stijn
08c5ebe040 layer: use t.TempDir and minor cleanups
- Use strings.Cut
- Use strconv instead of fmt.Sprintf
- Rename vars that shadowed

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-12 14:35:21 +02:00
Sebastiaan van Stijn
239bf178b8 Merge pull request #49845 from thaJeztah/testing_use_native_tempdir_step1
use Go's native t.TempDir() in tests (step 1)
2025-05-12 14:34:58 +02:00
Sebastiaan van Stijn
f84694ebdc container: use defer for locks
Makes the code slightly more idiomatic. These paths avoided uses of
defer because they came with an overhead in older versions of Go,
but this overhead should now be neglectible.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-12 13:17:18 +02:00
Sebastiaan van Stijn
24f305b666 Makefile: set BIND_DIR to "." by default
Currently, it's needed to set `BIND_DIR=.` when starting the dev-container
in order to bind-mount the current source-code into the container. Omitting
that option only bind-mounts the "bundles" directory and copies the source
into the image before starting.

While there are some cases where (e.g.) a remote server is used for development,
and bind-mounting is not possible, those scenarios should be considered more
advanced, so let's make the common scenario easier to use.

With this patch, running `make shell` should build and run the dev-container
with the source-code mounted.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-12 13:15:05 +02:00
Paweł Gronowski
23825bc1fd Merge pull request #49893 from thaJeztah/move_more_container_types
container: deprecate IsValidHealthString
2025-05-12 10:51:10 +00:00
Sebastiaan van Stijn
4b6a9d23af cmd/dockerd/trap: use t.TempDir
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-12 12:14:35 +02:00
Paweł Gronowski
4c189b8fe8 Merge pull request #49174 from thaJeztah/bump_golang_1.24
update to go1.24.3
2025-05-12 10:10:05 +00:00
Sebastiaan van Stijn
ea37a1f040 integration/build: use t.TempDir
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-12 12:09:39 +02:00
Sebastiaan van Stijn
900bd88848 internal/directory: use t.TempDir
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-12 12:05:50 +02:00
Sebastiaan van Stijn
46baf7deb0 distribution: use t.TempDir
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-12 12:05:50 +02:00
Sebastiaan van Stijn
1b4ba20708 distribution/metadata: use t.TempDir, rename var that shadowed
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-12 12:05:50 +02:00
Sebastiaan van Stijn
735ccfbc6f pkg/stack: use t.TempDir
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-12 12:05:50 +02:00
Sebastiaan van Stijn
72a11b84d4 testutil/fakestorage: use t.TempDir
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-12 12:05:50 +02:00
Sebastiaan van Stijn
b38f73afe3 daemon: cleanupContainer: leave decorating container-id/name to caller
This function was decorating errors with the container name, but within its
own context wouldn't be aware how the delete was referenced. This could
result in a container deleted by "ID" to produce an error with the container
Name. Some errors were also decorated before storing as "removalError" on
the container object itself.

The removalError was originally added in f963500c54,
before which the error was returned. Now that it's part of the container's
state itself, adding the container's ID is probably not very useful.

This patch reduces the scope of decorating the errors to the error-condition
itself, leaving it to the caller to decorate them further with the container
ID or Name (if any).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-12 11:05:39 +02:00
Sebastiaan van Stijn
d44b2e4bd7 daemon: cleanupContainer: use state-fields instead of string form
This code only needed to know whether the container was paused; for other
states ("restarting", "running"), it's still used to be included in the
error string.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-12 11:02:57 +02:00
Sebastiaan van Stijn
4a00ce10fa daemon: rmLink, cleanupContainer: rename args that shadowed import
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-12 10:58:50 +02:00
Sebastiaan van Stijn
1cf7d7ea4b hack/make/.binary: update link to go source for "pie" support
Keeping it up to date, in case the situation changes.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-12 10:31:24 +02:00
Sebastiaan van Stijn
e991c7185d update to go1.24.3
release notes: https://go.dev/doc/go1.24

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-12 10:31:00 +02:00
Sebastiaan van Stijn
89ee292709 container: update GoDoc for State
Better describe that various states are not mutually exclusive.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-12 10:28:20 +02:00
Sebastiaan van Stijn
7979b3d46b Merge pull request #49911 from aaithal/fluentd-write-timeout
fluentd: add write timeout log option
2025-05-10 16:12:09 +02:00
Anirudh Aithal
7dae7c54dd fluentd: add write timeout log option
Currently, there's no mechanism to specify a write timeout value for
fluentd connections. This means that writes can forever be blocked if
the downstream connections is unhealthy. This commit makes this value
configurable via a new fluentd log option called "fluentd-write-timeout".

Signed-off-by: Anirudh Aithal <aithal@amazon.com>
2025-05-09 12:32:24 -07:00
Sebastiaan van Stijn
c8db8ca6b2 Merge pull request #49946 from robmry/modprobe_rootless_test_integration
Try to load br_netfilter on the test host for rootless test-integration
2025-05-09 20:17:30 +02:00
Sebastiaan van Stijn
31e992cccd Merge pull request #49944 from thaJeztah/container_fix_waitcondition
container: State.Wait(): don't use deprecated type
2025-05-09 20:03:33 +02:00
Sebastiaan van Stijn
97be6333e6 Merge pull request #49939 from corhere/libn/networkdb-broadcast-overflow
libn/networkdb: don't exceed broadcast size limit
2025-05-09 19:20:38 +02:00
Cory Snider
56ad941564 Fix possible overlapping IPs when ingressNA == nil
Logic was added to the Swarm executor in commit 0d9b0ed678
to clean up managed networks whenever the node's load-balancer IP
address is removed or changed in order to free up the address in the
case where the container fails to start entirely. Unfortunately, due to
an oversight the function returns early if the Swarm is lacking
an ingress network. Remove the early return so that load-balancer IP
addresses for all the other networks are freed as appropriate,
irrespective of whether an ingress network exists in the Swarm.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-05-09 12:51:08 -04:00
Rob Murray
dc1d23c646 Revert "rootless: skip tests that need br-netfilter loaded"
Shouldn't be needed, the top level Makefile will try to modprobe.

This reverts commit 4c4810e5d2.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-05-09 17:31:38 +01:00
Rob Murray
4b9092aa27 Load br-netfilter for rootless test-integration
If kernel module br_netfilter isn't loaded on the test host
before rootless test-integration tests that need it, the
rootless daemon hits a permission error when trying to do
the load. So, try to load the module before going rootless.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-05-09 17:31:38 +01:00
Sebastiaan van Stijn
62694ab30c Merge pull request #49813 from p5/systemd-sysusers
Add systemd-sysusers contrib configuration
2025-05-09 18:25:29 +02:00
Sebastiaan van Stijn
9b19172c7f Merge pull request #49868 from thaJeztah/exec_validate_user
docker exec: fail early on exec create if specified user doesn't exist
2025-05-09 17:00:50 +02:00
Rob Murray
f848191e40 Merge pull request #49901 from robmry/active_endpoints_error_error
Active endpoints error error
2025-05-09 09:29:33 +01:00
Tianon Gravi
6f477852a1 Merge pull request #47366 from thaJeztah/less_output_vars
reduce named (error)-returns and some minor linting-fixes
2025-05-08 21:18:27 +00:00
Sebastiaan van Stijn
7957a28859 container: remove GoDoc for deprecated aliases.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-08 21:59:08 +02:00
Sebastiaan van Stijn
fe403362b4 container: State.Wait(): don't use deprecated type
The container.WaitCondition type was deprecated in
100102108b, but this use of the
deprecated alias was left behind.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-08 21:56:07 +02:00
Robert Sturla
0bd82bfac2 chore: add systemd-sysusers configuration
Part of https://github.com/docker/docker-ce-packaging/issues/1186

Adds the required systemd-sysusers configuration to the
moby/moby repo.  This will be used by downstream package
maintainers (RPM, DEB etc) as a replacement to the
`groupadd` postinstall commands.

It's generally recommended to use sysusers since it is
more of a declarative method of defining these service
accounts and groups.

This configuration file specifies a group ("g") named
"docker" should be created with an automatic GID
allocation ("-").

Signed-off-by: Robert Sturla <robertsturla@outlook.com>
2025-05-08 18:26:17 +01:00
Sebastiaan van Stijn
df662ebc59 container: deprecate IsValidHealthString
Introduce a ValidateHealthStatus utility in api/types/container to
validate if a given HealthState is valid.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-08 16:52:52 +02:00
Sebastiaan van Stijn
f9c4601760 volume/mounts: MountPoint.Setup: rename output-var, and simplify err-handling
Rename the ouput variable to prevent accidental shadowing, and simplify how
we check for the `syscall.ENOTDIR` error; `errors.Is()` will already unwrap
the error, so no type-casting is needed;

    package main

    import (
        "errors"
        "fmt"
        "os"
        "syscall"
    )

    func main() {
        err := &os.PathError{Op: "mkdir", Path: "/hello/world", Err: syscall.ENOTDIR}
        if errors.Is(err, syscall.ENOTDIR) {
            fmt.Println(err)
        }
    }

While at it, also improve the code-comment that outlines the intent.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-08 14:33:11 +02:00
Sebastiaan van Stijn
6ac3afe483 volume: remove/rename err-returns
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-08 14:33:11 +02:00
Sebastiaan van Stijn
986988a394 testutil/daemon: Daemon.StopWithError: rename output-var to prevent shadowing
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-08 14:33:11 +02:00
Sebastiaan van Stijn
3606712e2d testutil: remove named returns
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-08 14:33:11 +02:00
Sebastiaan van Stijn
fe2d323c82 registry: remove/rename err-returns, and minor refactor
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-08 14:33:10 +02:00
Sebastiaan van Stijn
79b1b561a3 registry/resumable: remove named err-return, fix minor linting issue
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-08 14:33:10 +02:00
Sebastiaan van Stijn
e67b6bfc69 plugin: remove/rename err-returns
Prevent accidentally shadowing these errors, which are used in defers, and
while at it, also fixed some linting warnings about unhandled errors.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-08 14:33:10 +02:00
Sebastiaan van Stijn
943dfa985d oci: remove named err-return
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-08 14:33:10 +02:00
Sebastiaan van Stijn
0b169d34e4 libnetwork: remove named (err)-returns
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-08 14:33:10 +02:00
Sebastiaan van Stijn
154230cdd7 libnetwork/portallocator: getDynamicPortRange: fix err-handling on freeBSD
The function used a `cmdErr` error, but it was discarded when returning an
error. Also removing the named "err" return variable.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-08 14:33:09 +02:00
Sebastiaan van Stijn
962fd8bc41 libnetwork/ipams/remote: inline decodeToMap
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-08 14:33:09 +02:00
Sebastiaan van Stijn
cfdfbfab9b libnetwork/drivers/remote: inline decodeToMap
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-08 14:33:09 +02:00
Sebastiaan van Stijn
152db74d96 libcontainerd: remove/rename err-returns
Prevent accidentally shadowing these errors, which are used in defers.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-08 14:33:09 +02:00
Sebastiaan van Stijn
f87dcbe350 layer: remove/rename err-returns and remove naked returns
- rename error-output variables to prevent shawdowing
- remove naked returns
- rename some (err) variables for clarity
- remove redundant assertNotDirectoryError utility

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-08 14:33:09 +02:00
Sebastiaan van Stijn
6981aad790 internal/testutils: remove named returns
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-08 14:33:09 +02:00
Sebastiaan van Stijn
d1c58bdbbe integration-cli: remove/rename err-returns and remove naked returns
Prevent accidentally shadowing these errors, which are used in defers, and
remove naked returns.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-08 14:33:08 +02:00
Sebastiaan van Stijn
1b317b0323 distribution: remove named err-returns and minor refactor
- remove named err-returns to prevent accidental shadowing
- fix some minor linting issues (unhandled errors)
- update code depending on "errors.Wrap" behavior. which ignores
  nil-errors, which can be easily overlooked when rewriting to
  native go error-wrapping (fmt.Errorf()).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-08 14:33:08 +02:00
Sebastiaan van Stijn
e205701266 Merge pull request #49938 from corhere/libn/fix-networkdb-loopback-tests
libnetwork/networkdb: fix most flaky loopback tests
2025-05-08 13:33:45 +02:00
Sebastiaan van Stijn
49a0770c7a Merge pull request #49925 from 17neverends/refactor_metrics
Optimization methods in internal\metrics\metrics.go
2025-05-08 01:13:40 +02:00
Sebastiaan van Stijn
69ee71225e Merge pull request #49919 from dmcgowan/api-image-unused-reference-store
Remove unused reference store in image api
2025-05-07 23:25:48 +02:00
17neverends
1244685329 Optimization methods in internal\metrics\metrics.go
Signed-off-by: 17neverends <ionianrise@gmail.com>
2025-05-07 23:56:17 +03:00
Rob Murray
1b1a5a6878 Merge pull request #49940 from robmry/flaky_tests_rootless_and_firewalld
Skip tests that recently started failing in rootless/firewalld
2025-05-07 21:48:29 +01:00
Rob Murray
84ef7e4899 Allow TestIsolated/ipv6 to unexpectedly pass
This test normally fails due to a known issue, but it
has recently started passing in CI ... not sure why, it
still fails locally - so, allow it to unexpeectedly
pass, but collect some debug info to try to undertand
why.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-05-07 19:57:27 +01:00
Rob Murray
4c4810e5d2 rootless: skip tests that need br-netfilter loaded
Skip tests that have recently started failing in rootless
mode with error:

failed to start daemon: Error initializing network controller:
  error creating default "bridge" network:
    cannot restrict inter-container communication or run
    without the userland proxy:
      stat /proc/sys/net/bridge/bridge-nf-call-iptables:
        no such file or directory:
          set environment variable DOCKER_IGNORE_BR_NETFILTER_ERROR=1 to ignore

(Perhaps we can ensure the module is loaded before starting
the rootless env - or work out why the failures have only
recently started, and put-back whatever changed. But, for
now, I think we need to skip.)

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-05-07 19:51:07 +01:00
Cory Snider
dacf445614 libn/networkdb: don't exceed broadcast size limit
NetworkDB uses a hierarchy of queues to prioritize messages for
broadcast. Unfortunately the logic to pull from multiple queues is
flawed. The length of the messages pulled from the first queue is not
taken into account when pulling messages from the second queue. A list
of messages up to tiwce as long as the limit could be returned! Messages
beyond the limit will be truncated unceremoniously by memberlist.

Memberlist broadcast queues assume that all messages returned from a
GetBroadcasts call will be broadcasted to other nodes in the cluster.
Messages are popped from the queue once they have hit their retransmit
limit. On a busy system messages may be broadcast fewer times than
intended, possibly even being dropped without ever being broadcast!

Subtract the length of messages pulled from the first queue from the
broadcast size limit so the limit is not exceeded when pulling from the
second queue.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-05-07 12:32:54 -04:00
Cory Snider
697c17ca95 libn/networkdb: take most tests off flaky list
The loopback-test fixes seem to be sufficient to resolve the flakiness
of all the tests aside from TestFlakyNetworkDBIslands.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-05-07 11:51:29 -04:00
Cory Snider
90ec2c209b libn/networkdb: listen only on loopback in tests
NetworkDB defaults to binding to the unspecified address for gossip
communications, with no advertise address set. In this configuration,
the memberlist instance listens on all network interfaces and picks one
of the host's public IP addresses as the advertise address.
The NetworkDB unit tests don't override this default, leaving them
vulnerable to flaking out as a result of rogue network traffic
perturbing the test, or the inferred advertise address not being useable
for loopback testing. And macOS prompts for permission to allow the test
executable to listen on public interfaces every time it is rebuilt.

Modify the NetworkDB tests to explicitly bind to, advertise, and join
ports on 127.0.0.1 to make the tests more robust to flakes in CI and
more convenient to run locally.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-05-07 11:38:12 -04:00
Cory Snider
e3f9edd348 libn/networkdb: advertise the configured bind port
The NetworkDB unit tests instantiate clusters which communicate over
loopback where every "node" listens on a distinct localhost port. The
tests make use of a NetworkDB configuration knob to set the port. When
the NetworkDB configuration's BindPort field is set to a nonzero value,
its memberlist instance is configured to bind to the specified port
number. However, the advertise port is left at the
memberlist.DefaultLANConfig() default value of 7946. Because of this,
nodes would be unable to contact any of the other nodes in the cluster
learned by gossip as the gossiped addresseses specify the wrong ports!
The flaky tests passed as often as they did thanks to the robustness of
the memberlist module: NetworkDB gossip and and memberlist node
liveness-probe pings to unreachable nodes can all be relayed through
the reachable nodes, the nodes on the bootstrap join list.

Make the NetworkDB unit tests less flaky by setting each node's
advertise port to the bind port.

The daemon is unaffected by this oversight as it unconditionally uses
the default listen port of 7946, which aligns with the advertise port.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-05-07 11:38:12 -04:00
Cory Snider
ec65f2d21b libn/networkdb: fix data race in GetTableByNetwork
The function was accessing the index map without holding the mutex, so
it would race any mutation to the database indexes. Fetch the reference
to the tree's root while holding a read lock. Since the radix tree is
immutable, taking a reference to the root is equivalent to starting a
read-only database transaction, providing a consistent view of the data
at a snapshot in time, even as the live state is mutated concurrently.

Also optimize the WalkTable function by leveraging the immutability of
the radix tree.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-05-07 11:28:17 -04:00
Rob Murray
d71afd73bf Merge pull request #49931 from robmry/commit_cory
Move Cory from Reviewers to Committers
2025-05-07 13:10:03 +01:00
Rob Murray
d0af7c3c08 Move Cory from Reviewers to Committers
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-05-06 20:49:41 +01:00
Rob Murray
b0777be89e Use firewaller.IPVersion instead of iptables.IPVersion for gwmode
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-05-06 10:18:22 +01:00
Rob Murray
3cbb1ae736 Move filter-FORWARD DROP setting to the firewaller
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-05-06 10:18:22 +01:00
Rob Murray
44843d9917 Pass context to more places
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-05-06 10:18:22 +01:00
Rob Murray
a9bf151260 Put Iptabler behind a Firewaller interface.
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-05-06 10:18:22 +01:00
Derek McGowan
92e497b9dc Create api interface to define build usage backend
Avoid importing buildkit builder into api package when only a single
backend function is needed.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-05-04 23:18:35 -07:00
Derek McGowan
aef409dfb2 Remove unused reference store in image api
The image api already defines the backend used and does
not directly use the reference store backend. It also should not
directly use the reference store backend.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-05-03 21:59:55 -07:00
Austin Vazquez
453c165be7 Merge pull request #49910 from austinvazquez/update-branches-and-tags-05-01-2025
project: update status of branches for Moby 28.x
2025-05-02 22:19:00 -07:00
Austin Vazquez
9eec936eb0 project: update status of branches for Moby 28.x
Signed-off-by: Austin Vazquez <austin.vazquez.dev@gmail.com>
2025-05-02 22:22:18 -06:00
Sebastiaan van Stijn
d3579b9582 Merge pull request #49885 from mmorel-35/fix-staticcheck
fix staticcheck linting issues for golangci-lint v2
2025-05-01 17:08:40 +02:00
Matthieu MOREL
9315b15dc6 fix(ST1006): Poorly chosen receiver name
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-05-01 14:30:59 +02:00
Matthieu MOREL
70139978d3 fix(ST1016): Use consistent method receiver names
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-01 14:30:52 +02:00
Matthieu MOREL
9e9b6cc42e fix(ST1019): Importing the same package multiple times
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-01 14:17:59 +02:00
Matthieu MOREL
27bf320a72 fix(ST1017): Don’t use Yoda conditions
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-05-01 14:17:59 +02:00
Matthieu MOREL
98fa4bcfeb fix(exhaustive): missing cases in switch of type snapshots.Kind
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-01 14:17:58 +02:00
Matthieu MOREL
95af77d038 fix(ST1015): A switch’s default case should be the first or last case
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-01 14:17:58 +02:00
Matthieu MOREL
f770f6c5ec fix(QF1012): Use fmt.Fprintf(x, ...) instead of x.Write(fmt.Sprintf(...))
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-05-01 14:17:58 +02:00
Matthieu MOREL
a88c49f38e fix(QF1011): Omit redundant type from variable declaration
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-01 14:17:58 +02:00
Matthieu MOREL
4f9214c156 fix(QF1007): Merge conditional assignment into variable declaration
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-01 14:17:49 +02:00
Matthieu MOREL
be54c79d9c fix(QF1006): Lift if+break into loop condition
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-01 14:17:42 +02:00
Matthieu MOREL
2cce9a51ca fix(QF1004): Use strings.ReplaceAll instead of strings.Replace with n == -1
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-05-01 14:16:45 +02:00
Matthieu MOREL
e2e7f9964f fix(QF1003): Convert if/else-if chain to tagged switch
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-01 14:16:45 +02:00
Matthieu MOREL
b0711d5fe9 fix(QF1001): Apply De Morgan’s law
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-01 14:16:44 +02:00
Matthieu MOREL
7d8df25d16 fix misused error
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-05-01 14:16:44 +02:00
Matthieu MOREL
fef139ccc1 fix import
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-05-01 14:16:44 +02:00
Sebastiaan van Stijn
e547b63e1a Merge pull request #49899 from jsternberg/buildkit-gc-enabled-default
config: set buildkit gc enabled to default to true
2025-05-01 13:18:59 +02:00
Sebastiaan van Stijn
4ae3705d06 Merge pull request #49895 from thaJeztah/linting_fix_noshadow
fix various "no shadow" linting issues (govet)
2025-05-01 13:09:38 +02:00
Akihiro Suda
ef15c13611 Merge pull request #49881 from thaJeztah/bump_md2man
man: vendor github.com/cpuguy83/go-md2man/v2 v2.0.7
2025-05-01 19:22:41 +09:00
Akihiro Suda
6f3ccaf311 Merge pull request #49880 from thaJeztah/bump_cobra
vendor: github.com/spf13/cobra v1.9.1
2025-05-01 19:20:42 +09:00
Akihiro Suda
5e1171a508 Merge pull request #49882 from thaJeztah/bump_runtime_spec
vendor: github.com/opencontainers/runtime-spec v1.2.1
2025-05-01 19:20:08 +09:00
Sebastiaan van Stijn
76adb8f5c3 Merge pull request #49894 from thaJeztah/daemon_less_output_vars
daemon/*: reduce named (error)-returns, naked returns, and some minor linting-fixes
2025-05-01 10:19:50 +02:00
Rob Murray
fa23123741 Merge pull request #49832 from robmry/trusted_interfaces
Allow direct routing to container ports from trusted interfaces
2025-05-01 08:50:36 +01:00
Rob Murray
44a3453d73 Add daemon option --allow-direct-routing
Per-network option com.docker.network.bridge.trusted-host-interfaces
accepts a list of interfaces that are allowed to route
directly to a container's published ports in a bridge
network with nat enabled.

This daemon level option disables direct access filtering,
enabling direct access to published ports on container
addresses in all bridge networks, via all host interfaces.

It overlaps with short-term env-var workaround:
  DOCKER_INSECURE_NO_IPTABLES_RAW=1
- it does not allow packets sent from outside the host to reach
  ports published only to 127.0.0.1
- it will outlive iptables (the workaround was initially intended
  for hosts that do not have kernel support for the "raw" iptables
  table).

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-04-30 20:59:28 +01:00
Rob Murray
c16caabe36 Add TestNetworkConfigurationMarshalling
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-04-30 20:59:28 +01:00
Rob Murray
a94643a1b3 bridge: add option com.docker.network.bridge.trusted_host_interfaces
trusted_host_interface have access to published ports on container
addresses - enabling direct routing to the container via those
interfaces.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-04-30 20:59:28 +01:00
Sebastiaan van Stijn
fb4e0bcd2a Merge pull request #49902 from jsternberg/buildkit-update
vendor: github.com/moby/buildkit v0.21.1
2025-04-30 18:59:05 +02:00
Rob Murray
33f5b9e963 Don't add stub Endpoint/Network object to cache on Sandbox restore
On Sandbox restore if an Endpoint (or Network) can't be loaded from
the store and the container is to be preserved (live-restore), stub
Network and Endpoint objects are created and added to the cache. But
then the Endpoint is just dropped - leaving the stub objects in
cache.

If not-live-restore, the Sandbox is reconstructed do that it can be
deleted by sb.delete(force=true). But, the only thing sb.delete does
with the Endpoint in this case is call ep.Delete. And, ep.Delete
doesn't do anything if the Network and Endpoint can't both be loaded
from the store. So, again, the stub objects are left in the in-memory
cache and nothing that might have needed tidying up got tidied up.

So, whether live-restoring or not, just log an error and ignore an
Endpoint if it can't be loaded from disk.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-04-30 15:26:14 +01:00
Rob Murray
c129c0fa9f Improve logging and readability of Controller.sandboxRestore
- Use structured logging.
  - Which means ids are logged consistently.
- Use variable 'isRestore' instead of extra map lookups.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-04-30 12:42:26 +01:00
Rob Murray
5d8192fcce Report endpoint id as well as name in ActiveEndpointsError
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-04-30 12:42:26 +01:00
Jonathan A. Sternberg
9aa66be7ec vendor: github.com/moby/buildkit v0.21.1
Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com>
2025-04-29 14:49:26 -05:00
Jonathan A. Sternberg
a79d081aa5 config: set buildkit gc enabled to default to true
This will use the default settings for buildkit gc unless explicitly
disabled by setting `enabled: false` in the gc configuration.

Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com>
2025-04-29 14:05:57 -05:00
Paweł Gronowski
b0e8932009 Merge pull request #49892 from thaJeztah/bump_go_winres
Dockerfile.windows: update github.com/tc-hib/go-winres to v0.3.3
2025-04-29 08:26:01 +00:00
Sebastiaan van Stijn
19ccb75c62 daemon: remove/rename err-returns and remove naked returns
Prevent accidentally shadowing these errors, which are used in defers, and
remove naked returns.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-28 15:50:03 +02:00
Sebastiaan van Stijn
9ed975a247 daemon: NewDaemon: rename err-return
Prevent accidentally shadowing the error, which is used in a defer.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-28 15:50:02 +02:00
Sebastiaan van Stijn
3e586094fc daemon: parseXXVersion: rewrite to be slightly more iodiomatic
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-28 15:50:02 +02:00
Sebastiaan van Stijn
2145cf6309 daemon: Daemon.ContainerStatPath, ContainerArchivePath: minor refactor
- remove named error-returns
- make error-handling slightly more idiomatic (check for non-nil errors)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-28 15:50:02 +02:00
Sebastiaan van Stijn
6da1ff6bf9 builder/builder-next: fix vars that shadowed (govet)
builder/builder-next/adapters/containerimage/pull.go:912:3: shadow: declaration of "now" shadows declaration at line 905 (govet)
            now := time.Now()
            ^
    builder/builder-next/adapters/snapshot/layer.go:52:4: shadow: declaration of "diffIDs" shadows declaration at line 28 (govet)
                diffIDs, err := s.EnsureLayer(gctx, info.Parent)
                ^
    builder/builder-next/worker/worker.go:577:3: shadow: declaration of "now" shadows declaration at line 570 (govet)
            now := time.Now()
            ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-28 15:42:06 +02:00
Sebastiaan van Stijn
692610414a pkg/plugins: fix vars that shadowed (govet)
pkg/plugins/plugins.go:325:4: shadow: declaration of "pl" shadows declaration at line 315 (govet)
                pl, err := loadWithRetry(name, false)
                ^
    pkg/plugins/pluginrpc-gen/parser.go:153:4: shadow: declaration of "iface" shadows declaration at line 135 (govet)
                iface, ok := spec.Type.(*ast.InterfaceType)
                ^
    pkg/plugins/pluginrpc-gen/parser_test.go:61:2: shadow: declaration of "arg" shadows declaration at line 40 (govet)
        arg := f.Args[0]
        ^
    pkg/plugins/pluginrpc-gen/parser_test.go:165:2: shadow: declaration of "arg" shadows declaration at line 40 (govet)
        arg := f.Args[0]
        ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-28 15:42:06 +02:00
Sebastiaan van Stijn
0fcd23ec13 daemon/logger/loggertest: fix vars that shadowed (govet)
daemon/logger/loggertest/logreader.go:548:14: shadow: declaration of "open" shadows declaration at line 545 (govet)
                case err, open := <-lw.Err:
                          ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-28 15:41:08 +02:00
Sebastiaan van Stijn
4c57ffaca7 api/server/router/build: fix vars that shadowed (govet)
api/server/router/build/build_routes.go:212:6: shadow: declaration of "bs" shadows declaration at line 200 (govet)
            if bs, err := parseBytesFromFormValue("max-used-space"); err != nil {
               ^
    api/server/router/build/build_routes.go:218:6: shadow: declaration of "bs" shadows declaration at line 200 (govet)
            if bs, err := parseBytesFromFormValue("min-free-space"); err != nil {
               ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-28 15:36:30 +02:00
Sebastiaan van Stijn
eef5c75276 api/server/router/network: fix vars that shadowed (govet)
api/server/router/network/network_routes.go:148:14: shadow: declaration of "nwv" shadows declaration at line 146 (govet)
                } else if nwv, ok := listByFullName[nwk.ID]; ok {
                          ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-28 15:23:51 +02:00
Sebastiaan van Stijn
7edd83a1b3 libnetwork: fix vars that shadowed, and slight refactor (govet)
libnetwork/network.go:637:6: shadow: declaration of "v" shadows declaration at line 634 (govet)
            if v, ok := n.generic[netlabel.GenericData]; ok {
               ^
    libnetwork/service_linux.go:125:7: shadow: declaration of "ep" shadows declaration at line 86 (govet)
                if ep := sb.getGatewayEndpoint(); ep != nil {
                   ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-28 15:23:51 +02:00
Sebastiaan van Stijn
7dbe2f1fb6 libnetwork/portallocator: fix vars that shadowed (govet)
libnetwork/portallocator/portallocator_test.go:151:7: shadow: declaration of "i" shadows declaration at line 150 (govet)
            for i := 0; i <= p.end-p.begin; i++ {
                ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-28 15:23:51 +02:00
Sebastiaan van Stijn
357b136ee9 libnetwork/drivers: fix vars that shadowed (govet)
libnetwork/drivers/overlay/peerdb.go:126:4: shadow: declaration of "peerEntryDB" shadows declaration at line 46 (govet)
                peerEntryDB := entryDBList[0]
                ^
    libnetwork/drivers/bridge/port_mapping_linux.go:862:3: shadow: declaration of "rule" shadows declaration at line 843 (govet)
            rule := iptRule{ipv: ipv, table: iptables.Mangle, chain: "POSTROUTING", args: args}
            ^
    libnetwork/drivers/macvlan/macvlan_network.go:116:3: shadow: declaration of "networkList" shadows declaration at line 68 (govet)
            networkList := d.getNetworks()
            ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-28 15:23:50 +02:00
Sebastiaan van Stijn
f831618e5b libnetwork/networkdb: fix vars that shadowed (govet)
also moved the variables closer to where they're used

    libnetwork/networkdb/cluster.go:414:4: shadow: declaration of "nid" shadows declaration at line 397 (govet)
                nid := params[0]
                ^
    libnetwork/networkdb/networkdb.go:514:4: shadow: declaration of "nid" shadows declaration at line 506 (govet)
                nid := params[0]
                ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-28 15:23:50 +02:00
Sebastiaan van Stijn
f633e8f03f libnetwork/cmd/diagnostic: fix vars that shadowed (govet)
libnetwork/cmd/diagnostic/main.go:198:5: shadow: declaration of "resp" shadows declaration at line 147 (govet)
                    resp, err := http.Get(fmt.Sprintf(deleteEntry, ip, port, network, tableName, k))
                    ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-28 15:23:47 +02:00
Sebastiaan van Stijn
190ad0610d daemon/logger: remove/rename err-returns and linting warnings
Prevent accidentally shadowing these errors, which are used in defers, and
while at it, also fixed some linting warnings about unhandled errors, and
defers created in a loop.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-28 15:06:35 +02:00
Sebastiaan van Stijn
ba15bbc422 daemon/images: rename err-returns to prevent shadowing
Prevent accidentally shadowing the error, which is used in a defer, and
while at it, also fixed some linting warnings about unhandled errors.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-28 15:06:34 +02:00
Sebastiaan van Stijn
48220008d8 daemon/graphdriver: remove/rename err-returns and remove naked returns
Prevent accidentally shadowing these errors, which are used in defers, and
while at it, also fixed some linting warnings about unhandled errors.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-28 15:06:34 +02:00
Sebastiaan van Stijn
088c180a9e daemon/containerd: remove named err-returns
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-28 15:06:34 +02:00
Sebastiaan van Stijn
dc79403f7b daemon/cluster: remove/rename err-returns and remove naked returns
Prevent accidentally shadowing these errors, which are used in defers.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-28 15:06:31 +02:00
Rob Murray
8d5177b229 Merge pull request #49876 from thaJeztah/pseudo_type_healthstatus
api/types/container: define HealthStatus "pseudo" type
2025-04-28 13:43:50 +01:00
Sebastiaan van Stijn
533f0a0f75 Merge pull request #49877 from thaJeztah/pkg_less_output_vars
pkg/*: reduce named (error)-returns and some minor linting-fixes
2025-04-28 14:41:14 +02:00
Sebastiaan van Stijn
9b62592bfe Dockerfile.windows: update github.com/tc-hib/go-winres to v0.3.3
full diff: https://github.com/tc-hib/go-winres/compare/v0.3.1...v0.3.3
diff of github.com/tc-hib/winres v0.2.1; https://github.com/tc-hib/winres/compare/v0.1.6...v0.2.1

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-28 14:34:17 +02:00
Paweł Gronowski
9ee1716c41 Merge pull request #49874 from dmcgowan/container-types-to-api
Use container status values from api
2025-04-28 12:31:46 +00:00
Sebastiaan van Stijn
bf8673db87 Merge pull request #49889 from ChengyuZhu6/hack
hack: Update broken link from README
2025-04-28 14:20:17 +02:00
Paweł Gronowski
1437cf558e Merge pull request #49878 from thaJeztah/api_builder_client_less_output_vars
api, builder, client, container: reduce named (error)-returns, naked returns and some minor linting-fixes
2025-04-28 12:15:38 +00:00
Sebastiaan van Stijn
d6b2aec809 pkg/progress: remove named err-return
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-28 14:15:19 +02:00
Sebastiaan van Stijn
029f267d9b pkg/pidfile: remove named err-returns
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-28 14:15:19 +02:00
Sebastiaan van Stijn
fdbf246889 pkg/parsers: remove named err-returns
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-28 14:15:18 +02:00
Sebastiaan van Stijn
b0f93d5283 pkg/fileutils: remove named err-returns
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-28 14:15:11 +02:00
Sebastiaan van Stijn
ab8e3da82c pkg/stdcopy: remove/rename err-returns
Prevent accidentally shadowing these errors, which are used in defers, and
while at it, also fixed some linting warnings about unhandled errors.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-28 14:14:51 +02:00
Sebastiaan van Stijn
d17a62592f pkg/ioutils: remove named err-returns
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-28 14:14:37 +02:00
Sebastiaan van Stijn
f193ff1317 pkg/broadcaster: remove named err-returns
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-28 14:14:17 +02:00
Paweł Gronowski
e4bf3995d7 Merge pull request #49879 from thaJeztah/volume_use_tempdir
volume/*: use Go's native t.TempDir() in tests
2025-04-28 11:59:20 +00:00
ChengyuZhu6
91f6e00ffa hack: Update broken links from README
Update referencesin hack/README.md from outdated docker URLs to the correct location at /docs/contributing/test.md.

Signed-off-by: ChengyuZhu6 <hudson@cyzhu.com>
2025-04-28 18:57:05 +08:00
Paweł Gronowski
fac076ccf9 Merge pull request #49875 from thaJeztah/use_health_consts
use consts for health-status in tests
2025-04-28 09:52:12 +00:00
Sebastiaan van Stijn
7868d3ee3e vendor: github.com/opencontainers/runtime-spec v1.2.1
full diff: https://github.com/opencontainers/runtime-spec/compare/v1.2.0...v1.2.1

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-26 19:02:07 +02:00
Derek McGowan
100102108b Use container status values from api
Alias and deprecate the status types and constants from the root
container package. The root container package is intended for use
within the daemon and no the api package.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-04-26 07:58:09 -07:00
Sebastiaan van Stijn
878de14c8d man: vendor github.com/cpuguy83/go-md2man/v2 v2.0.7
full diff: https://github.com/cpuguy83/go-md2man/compare/v2.0.6...v2.0.7

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-26 16:22:46 +02:00
Sebastiaan van Stijn
11f65b566d vendor: github.com/spf13/cobra v1.9.1
full diff: https://github.com/spf13/cobra/compare/v1.8.1...v1.9.1

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-26 16:17:55 +02:00
Sebastiaan van Stijn
ea7152e493 volume/local: use t.TempDir
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-26 16:07:56 +02:00
Sebastiaan van Stijn
4b41198e3c volume/mounts: use t.TempDir
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-26 16:07:56 +02:00
Sebastiaan van Stijn
2b869baea3 volume/service: use t.TempDir
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-26 16:07:56 +02:00
Sebastiaan van Stijn
88f6dd72e5 volume/service: rename interface that collided with vars
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-26 16:07:56 +02:00
Sebastiaan van Stijn
3b4e21081f container: remove unused named-returns
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-26 15:47:11 +02:00
Sebastiaan van Stijn
35167dc616 client: Client: PluginInstall, PluginUpgrade: remove/rename err-returns
Prevent accidentally shadowing these errors, which are used in defers, and
while at it, also fixed some linting warnings about unhandled errors.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-26 15:47:11 +02:00
Sebastiaan van Stijn
bb57656932 builder/remotecontext: remove unused named and "naked" returns
Also renamed some vars for clarity, renamed a error-returns to prevent
shadowing, and fixed some linter warnings about unhandled errors.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-26 15:47:11 +02:00
Sebastiaan van Stijn
5416f2d57c builder/dockerfile: remove unused named and "naked" returns
Also renamed some vars for clarity, renamed a error-returns to prevent
shadowing, and fixed some linter warnings about unhandled errors.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-26 15:47:10 +02:00
Sebastiaan van Stijn
f38b1fa30d builder/builder-next: SanitizeRepoAndTags: remove named err return
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-26 15:47:10 +02:00
Sebastiaan van Stijn
c025dd74f0 builder/builder-next: wrapRC.Read: remove intermediate err-var
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-26 15:47:10 +02:00
Sebastiaan van Stijn
49d5b2cc8e builder/builder-next: puller.resolve: rename err-return
Prevent accidentally shadowing the error, which is used in a defers, and
while at it, also fixed some linting warnings about unhandled errors and
shadowed vars.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-26 15:47:10 +02:00
Sebastiaan van Stijn
3f2296cfc1 api/server/router: remove named (err) returns
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-26 15:47:05 +02:00
Sebastiaan van Stijn
1e4bb14bcd api/types/container: define HealthStatus "pseudo" type
It currently is an alias for string, but may become a distinct type in future.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-26 15:26:26 +02:00
Sebastiaan van Stijn
c690e0076a use consts for health-status in tests
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-26 15:05:26 +02:00
Sebastiaan van Stijn
91473ce253 api/server/backend/build: sanitizeRepoAndTags: remove named err return
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-26 13:18:04 +02:00
Sebastiaan van Stijn
c5031c8632 api/types/time: remove named err return
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-26 13:18:03 +02:00
Sebastiaan van Stijn
890d48de19 Merge pull request #49869 from thaJeztah/builder_use_native_tempdir
builder: use t.TempDir() in tests
2025-04-26 13:11:37 +02:00
Rob Murray
19e79906cb Merge pull request #49866 from robmry/drop_enable_ipv_opt_if_overridden
Drop "-o com.docker.network.enable_ipv[46]" if overridden
2025-04-25 15:56:22 +01:00
Jonathan A. Sternberg
50a856157c containerd: images overridden by a build are kept dangling
The build exporter now clears the image tags and always exported to a
dangling image. It then uses the image tagger to perform the tagging
which causes the dangling image to be removed and the naming message to
be sent correctly.

An additional progress message is sent to indicate the renaming.

Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com>
2025-04-25 09:29:45 -05:00
Sebastiaan van Stijn
eee14cff72 builder/remotecontext: use t.TempDir
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-25 15:27:33 +02:00
Sebastiaan van Stijn
5749bc242a builder/dockerfile: use t.TempDir, rename vars that shadowed
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-25 15:27:33 +02:00
Sebastiaan van Stijn
b54a038bec docker exec: fail early on exec create if specified user doesn't exist
Before this patch, and error would be produced when starting the exec,
but the CLI would wait for the exec to complete, timing out after 10
seconds (default). With this change, an error is returned immediately
when creating the exec.

Note that "technically" this check may have some TOCTOU issues, because
'/etc/passwd' and '/etc/groups' may be mutated by the container in between
creating the exec and starting it.

This is very likely a corner-case, but something we can consider changing
in future (either allow creating an invalid exec, and checking before
starting, or checking both before create and before start).

With this patch:

    printf 'FROM alpine\nRUN rm -f /etc/group' | docker build -t nogroup -
    ID=$(docker run -dit nogroup)

    time docker exec -u 0:root $ID echo hello
    Error response from daemon: unable to find group root: no matching entries in group file

    real	0m0.014s
    user	0m0.010s
    sys	0m0.003s

    # numericc uid/gid (should not require lookup);
    time docker exec -u 0:0 $ID echo hello
    hello

    real	0m0.059s
    user	0m0.007s
    sys	0m0.008s

    # no user specified (should not require lookup);
    time docker exec $ID echo hello
    hello

    real	0m0.057s
    user	0m0.013s
    sys	0m0.008s

    docker rm -fv $ID

    # container that does have a valid /etc/groups

    ID=$(docker run -dit alpine)
    time docker exec -u 0:root $ID echo hello
    hello

    real	0m0.063s
    user	0m0.010s
    sys	0m0.009s

    # non-existing user or group
    time docker exec -u 0:blabla $ID echo hello
    Error response from daemon: unable to find group blabla: no matching entries in group file

    real	0m0.013s
    user	0m0.004s
    sys	0m0.009s

    docker rm -fv $ID

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-25 15:24:00 +02:00
Sebastiaan van Stijn
82fc83ec41 Merge pull request #49863 from robmry/test_legacy_link
Add TestLegacyLink
2025-04-25 14:50:22 +02:00
Rob Murray
37725b5eae Drop "-o com.docker.network.enable_ipv[46]" if overridden
When a network is created with "-o com.docker.network.enable_ipv4'
(including via "default-network-opts" in daemon config), and
EnableIPv4 is present in the API request (including when CLI option
"--ipv4" is used) - the top-level API value is used and the '-o'
is ignored.

But, the "-o" still shows up in Options in inspect output, which is
confusing if the values are different.

So, drop the "-o" if the top-level API option is set. Ditto IPv6.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-04-25 11:21:13 +01:00
Sebastiaan van Stijn
5ccaf18e8c Merge pull request #49857 from vvoland/todo-build
integration/build: Unskip TestBuildEmitsImageCreateEvent for c8d
2025-04-24 21:25:27 +02:00
Rob Murray
8d0c272e4a Add TestLegacyLink
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-04-24 20:03:17 +01:00
Sebastiaan van Stijn
b466483877 Merge pull request #49776 from vvoland/vpnkit-moby
Dockerfile: Fetch vpnkit from moby org
2025-04-24 16:19:06 +02:00
Rob Murray
e7599dad7e Merge pull request #49829 from robmry/block_direct_routing_per_container
iptables: Direct routing DROP rules per-container, not per-port
2025-04-24 14:59:06 +01:00
Paweł Gronowski
dfd59c0a95 Dockerfile: Fetch vpnkit from moby org
`moby/vpnkit` now officially pushes a binary image to `moby/vpnkit-bin`
repository on Docker Hub.
Use it to fetch the vpnkit binary.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-04-24 14:11:00 +02:00
Paweł Gronowski
af0232d52b integration/build: Unskip TestBuildEmitsImageCreateEvent for c8d
The issue is now fixed.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-04-24 13:38:11 +02:00
Rob Murray
a0ff0a361e iptables: Direct routing DROP rules per-container, not per-port
Commit 27adcd5 ("libnet/d/bridge: drop connections to lo mappings, and
direct remote connections") introduced an iptables rule to drop 'direct'
remote connections made to the container's IP address - for each
published port on the container.

The normal filter-FORWARD rules would then drop packets sent directly to
unpublished ports. This rule was only created along with the rest of port
publishing (when a container's endpoint was selected as its gateway). Until
then, all packets addressed directly to the container's ports were dropped
by the filter-FORWARD rules.

But, the rule doesn't need to be per-port. Just drop packets sent
directly to a container's address unless they originate on the host.

That means fewer rules, that can be created along with the endpoint (then
directly-routed get dropped at the same point whether or not the endpoint
is currently the gateway - very slightly earlier than when it's not the
gateway).

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-04-24 12:00:44 +01:00
Rob Murray
c333c0df17 Merge pull request #49843 from thaJeztah/remotecontext_deprecate_rel
builder/remotecontext: Deprecate Rel()
2025-04-23 15:11:50 +01:00
Rob Murray
59920a733f Merge pull request #49823 from robmry/integration_test_bridge_addrs
Reset default bridge addresses after integration tests
2025-04-23 14:45:02 +01:00
Rob Murray
0451e4fa18 Merge pull request #49788 from robmry/iptabler_package
Move bridge driver iptables code into its own package
2025-04-23 12:32:22 +01:00
Paweł Gronowski
31c7a10822 Merge pull request #49846 from thaJeztah/fix_duplicate_import
fix duplicate import, and force consistent alias for bolt
2025-04-23 10:39:05 +00:00
Rob Murray
dea236e0ce Split iptabler into multiple files
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-04-23 10:41:15 +01:00
Rob Murray
282b3f7b97 Move bridge driver iptables code into its own package
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-04-23 10:41:15 +01:00
Rob Murray
8c36a22e79 Rename function insertMirroredWSL2Rule
It's now shouldInsertMirroredWSL2Rule, because it's a test and
doesn't do the insertion.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-04-23 10:41:15 +01:00
Rob Murray
aa4abaf820 Use firewaller (iptabler) structs in iptables unit tests
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-04-23 10:41:14 +01:00
Rob Murray
75c60598b7 Move clearConntrackEntries to bridge_linux.go
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-04-23 10:41:14 +01:00
Sebastiaan van Stijn
6997452eb5 Merge pull request #49817 from AkihiroSuda/fix-49816
CI: deduplicate execution of unit tests
2025-04-22 14:17:29 +02:00
Sebastiaan van Stijn
42d149e45d fix duplicate import, and force consistent alias for bolt
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-22 11:31:10 +02:00
Sebastiaan van Stijn
972c3918c5 Merge pull request #43340 from thaJeztah/testing_remove_defers
testing: remove some defer cleanup in favor of test.Cleanup()
2025-04-22 09:43:12 +02:00
Akihiro Suda
c3a7df35e7 Merge pull request #49838 from thaJeztah/remotecontext_clean
builder/remotecontext: MakeGitContext: use "WithFields" for logs
2025-04-20 06:50:32 +09:00
Akihiro Suda
784da88b15 Merge pull request #49839 from thaJeztah/dockerfile_updates
Dockerfile: update cli to v28.1.1, buildx v0.33.0, compose v0.35.1, syntax: docker/dockerfile:1
2025-04-20 06:49:30 +09:00
Akihiro Suda
7305bf47b8 Merge pull request #49844 from thaJeztah/bump_tar_split
vendor: github.com/vbatts/tar-split v0.12.1
2025-04-20 06:48:40 +09:00
Sebastiaan van Stijn
eede75c9d4 testing: remove some defer cleanup in favor of test.Cleanup()
gotest.tools v3.0.1 and up support Go's native test.Cleanup(), which
means that manually calling the cleanup functions in a defer is no
longer needed.

Some of these could probably be replaced by Go's native `t.TempDir()`,
but keeping that for a follow-up exercise.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-19 16:35:24 +02:00
Sebastiaan van Stijn
e3a0f2e690 vendor: github.com/vbatts/tar-split v0.12.1
archive/tar: fix for CVE-2022-2879

full diff: https://github.com/vbatts/tar-split/compare/v0.11.6...v0.12.1

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-19 12:28:51 +02:00
Sebastiaan van Stijn
bcc720abde builder/remotecontext: MakeGitContext: use "WithFields" for logs
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-18 18:11:40 +02:00
Sebastiaan van Stijn
54a556a5ef builder/remotecontext: Deprecate Rel()
This function was added in 684633f734, because
Go stdlib's filepath.Rel did not support Windows UUID paths (and UNC paths).

UNC paths were fixed in https://golang.org/cl/253197 (go1.17), and I think
UUID paths were also supported now.

To verify the behavior I temporarily added a unit-test to compare between
stdlib and this implementation, and it all looks to work, so we can deprecate
and remove this function. Deprecating first, but there's no (known) external
users of this, so we can likely remove in an upcoming minor (or patch) release.

    func TestRel(t *testing.T) {
        testCases := []struct {
            doc      string
            base     string
            target   string
            expected string
        }{
            {
                doc:      "UNC path",
                base:     `\\server\share`,
                target:   `\\server\share\folder\file.txt`,
                expected: `folder\file.txt`,
            },
            {
                doc:      "UUID path",
                base:     `\\?\Volume{b75e2c83-0000-0000-0000-602f00000000}\data`,
                target:   `\\?\Volume{b75e2c83-0000-0000-0000-602f00000000}\data\file.txt`,
                expected: `file.txt`,
            },
            {
                doc:      "subdirectory",
                base:     `C:\Projects`,
                target:   `C:\Projects\Go\main.go`,
                expected: `Go\main.go`,
            },
            {
                doc:      "same directory",
                base:     `C:\Projects`,
                target:   `C:\Projects`,
                expected: `.`,
            },
            {
                doc:      "parent directory",
                base:     `C:\Projects\Go`,
                target:   `C:\Projects`,
                expected: `..`,
            },
        }

        for _, tc := range testCases {
            t.Run(tc.doc, func(t *testing.T) {
                actual, err := remotecontext.Rel(tc.base, tc.target)
                if err != nil {
                    t.Fatal(err)
                }
                if actual != tc.expected {
                    t.Errorf("expected: %q, got: %q", tc.expected, actual)
                }

                // Try with stdlib
                actual, err = filepath.Rel(tc.base, tc.target)
                if err != nil {
                    t.Fatal(err)
                }
                if actual != tc.expected {
                    t.Errorf("expected: %q, got: %q", tc.expected, actual)
                }
            })
        }
    }

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-18 18:04:43 +02:00
Sebastiaan van Stijn
2808e59f4c Dockerfile: update compose to v2.35.1
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-18 18:00:48 +02:00
Sebastiaan van Stijn
a75be33ba0 Dockerfile: update buildx to v0.23.0
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-18 18:00:48 +02:00
Sebastiaan van Stijn
dd36139b1a Dockerfile: update cli to v28.1.1
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-18 18:00:42 +02:00
Sebastiaan van Stijn
f1e3ed0c48 Dockerfile: don't pin syntax to 1.7
The syntax was pinned for 1.7 in f696e0d2a7
possibly because it was not yet promoted as "latest stable" at the
time.

I don't think we need to pin to an old version, and just go with
the latest, so that we can use the latest features provided.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-18 18:00:13 +02:00
Akihiro Suda
01f442b84d Merge pull request #49588 from thaJeztah/bump_go_build_tags
update go:build tags to go1.23 to align with vendor.mod
2025-04-18 13:25:23 +09:00
Akihiro Suda
e03c0f03e7 Merge pull request #49834 from thaJeztah/cleanup_ignore
cleanup ignore files
2025-04-18 13:24:33 +09:00
Akihiro Suda
8dde918e77 Merge pull request #49837 from thaJeztah/bump_containerd_2.0.5
vendor: github.com/containerd/containerd v2.0.5, golang.org/x/oauth2 v0.29.0
2025-04-18 13:04:42 +09:00
Akihiro Suda
e70ce7a35b Merge pull request #49833 from vvoland/rootless-iptables-check
contrib/rootless-setuptool: Fix iptables detection
2025-04-18 08:56:51 +09:00
Sebastiaan van Stijn
fc8361c078 vendor: github.com/containerd/containerd v2.0.5
full diff: https://github.com/containerd/containerd/compare/v2.0.4...v2.0.5

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-17 22:01:00 +02:00
Sebastiaan van Stijn
62f51e4367 vendor: golang.org/x/oauth2 v0.29.0
notable changes

- oauth2.go: use a more straightforward return value
- oauth2: Deep copy context client in NewClient
- jws: improve fix for CVE-2025-22868

full diff: https://github.com/golang/oauth2/compare/v0.27.0...v0.29.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-17 22:00:44 +02:00
Sebastiaan van Stijn
bbbb0036df cleanup ignore files
- We now only use winresources for the dockerd binary, so we can
  reduce some uses of wildcards
- Use explicit ("/") to indicate these should only be ignored
  relative to the root of the repository and build-context
- Remove remnant ignore for rpm builds

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-17 19:25:47 +02:00
Paweł Gronowski
ead379a464 contrib/rootless-setuptool: Fix iptables detection
Fix a logical error in the rootless setup tool where the iptables error
handling was incorrectly placed. The code was setting
`faced_iptables_error=1` even when iptables was available, causing
unnecessary error messages and setup suggestions.

This patch correctly moves the error handling into the `else` branch so
that we only report iptables errors when the command is actually
unavailable.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-04-17 19:23:15 +02:00
Sebastiaan van Stijn
7c52c4d92e update go:build tags to go1.23 to align with vendor.mod
Go maintainers started to unconditionally update the minimum go version
for golang.org/x/ dependencies to go1.23, which means that we'll no longer
be able to support any version below that when updating those dependencies;

> all: upgrade go directive to at least 1.23.0 [generated]
>
> By now Go 1.24.0 has been released, and Go 1.22 is no longer supported
> per the Go Release Policy (https://go.dev/doc/devel/release#policy).
>
> For golang/go#69095.

This updates our minimum version to go1.23, as we won't be able to maintain
compatibility with older versions because of the above.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-17 15:43:19 +02:00
Rob Murray
6573a13e4a Merge pull request #49827 from robmry/warn_no_ext_nameservers
Warn when no external DNS nameservers are found
2025-04-17 14:08:01 +01:00
Rob Murray
619f1ddd05 Warn when no external DNS nameservers are found
Since commit 925b484 ("No fallback nameservers for internal
resolver"), if the host's resolv.conf has no nameservers and
no servers are supplied via config, the internal resolver will
not use Google's DNS - so the container will not be able to
resolve external DNS requests.

That can happen when container's are "restart-always" and the
docker daemon starts before the host's DNS is configured.

So, to highlight the issue (which may not be an error, but
probably is), include a warning in the container's resolv.conf
file.

Also, log a warning - logs currently say "No non-localhost DNS
nameservers are left in resolv.conf. Using default external
servers". But, that's misleading because it's from an initial
resolv.conf setup, before the internal resolver configured without
those fallbacks - we'll drop the fallbacks completely once the
default bridge has an internal resolver).

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-04-17 10:51:06 +01:00
Rob Murray
6083fad7df Reset default bridge addresses after integration tests
CI runs a docker daemon, and some tests run their own. That tramples
the CI daemon's default bridge.

If a test leaves the bridge with only a link-local IPv6 address (for
example), subsequent tests are likely to fail - even if they also
start their own daemon because, by default the default bridge
network's config is based on an existing bridge device.

So, remember the bridge's addresses at the start of each test, and
restore them afterwards.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-04-16 22:50:19 +01:00
Rob Murray
c2b7abacf8 Use setupTest instead of testutil.StartSpan in tests
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-04-16 21:59:34 +01:00
Rob Murray
d4e0d6f2a1 Integration tests: use different docker0 addresses
So that, if they leak from a test, it's possible to work out
which test.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-04-16 19:59:11 +01:00
Paweł Gronowski
3f46cadf39 Merge pull request #49805 from thaJeztah/vendor_goarchive
vendor: github.com/moby/go-archive v0.1.0
2025-04-16 12:07:48 +00:00
Sebastiaan van Stijn
b57d41c4bf Merge pull request #49799 from thaJeztah/apparmor_cleanups
profiles/apparmor: add some optimisations and tests
2025-04-16 13:21:25 +02:00
Sebastiaan van Stijn
29edd17909 Merge pull request #49815 from z63d/docs-api-image-tarball-format
docs/api: update image tarball format
2025-04-16 13:05:21 +02:00
Sebastiaan van Stijn
fd550344b1 vendor: github.com/moby/go-archive v0.1.0
full diff: https://github.com/moby/go-archive/compare/21f3f3385ab7...v0.1.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-16 13:00:13 +02:00
Akihiro Suda
fd5e772aec CI: deduplicate execution of unit tests
Fix issue 49816

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2025-04-16 19:59:15 +09:00
Paweł Gronowski
2834da861b Merge pull request #49814 from thaJeztah/initlayer_rm_idtools
daemon/initlayer: Setup: remove uses of idtools.Identity
2025-04-16 09:42:35 +00:00
Paweł Gronowski
1f43ad3a16 Merge pull request #49782 from thaJeztah/container_rm_idtools
container: Container.SetupWorkingDirectory: remove use of pkg/idtools
2025-04-16 09:41:35 +00:00
Kaita Nakamura
b8067d159f docs/api: update image tarball format
Signed-off-by: Kaita Nakamura <kaita.nakamura0830@gmail.com>
2025-04-16 18:02:08 +09:00
Sebastiaan van Stijn
a38ca9a548 daemon/initlayer: Setup: remove uses of idtools.Identity
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-16 09:58:24 +02:00
Rob Murray
9c9a6cb941 Merge pull request #49812 from robmry/endpoint_count_for_downgrade
Store an endpoint count for networks, for downgrade
2025-04-15 21:59:50 +01:00
Rob Murray
380ded6309 Store an endpoint count for networks, for downgrade
Since commit 51d7f95 ("libnet: remove struct endpointCnt") an
endpoint count for networks has not been persisted.

But, on downgrade to a version older than that commit, the
missing field caused daemon startup to fail.

So, create the count in the store - it only needs to exist, it's
no longer maintained as a count of endpoints. On downgrade, the
count is probably zero anyway (the daemon is stopped), but the
older daemon fixes it up on startup if necessary.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-04-15 17:59:34 +01:00
Sebastiaan van Stijn
c58a765707 Merge pull request #49809 from crazy-max/buildkit-0.21.0
vendor: update buildkit to v0.21.0
2025-04-15 18:20:39 +02:00
CrazyMax
ae0331d8f5 vendor: update buildkit to v0.21.0
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2025-04-15 17:04:25 +02:00
Paweł Gronowski
b2d06baf9b Merge pull request #49806 from robmry/missing_firewaller_error_check
bridge: Add a missing error check for firewaller setup
2025-04-15 13:06:27 +00:00
Rob Murray
57bf7a8c70 bridge: Add a missing error check for firewaller setup
It got lost in commit 29e0db2 ("Factor out top-level iptables
setup into its own object").

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-04-15 12:05:10 +01:00
Paweł Gronowski
bb8fcf3031 Merge pull request #49802 from vvoland/TestStopContainerWithTimeout-noparallel
integration/TestStopContainerWithTimeout: Attempt to fix flakiness
2025-04-14 15:19:25 +00:00
Paweł Gronowski
c49ce64514 integration/TestStopContainerWithTimeout: Attempt to fix flakiness
Temporarily remove Parallel.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-04-14 12:31:52 +02:00
Akihiro Suda
aa51a79ef9 Merge pull request #49800 from thaJeztah/seccomp_stdlib
profiles/seccomp: use stdlib for asserting, remove "// import" comments
2025-04-13 00:51:57 +09:00
Sebastiaan van Stijn
ecde7b9b7c Merge pull request #49797 from jsternberg/buildkit-rc2
vendor: github.com/moby/buildkit v0.21.0-rc2
2025-04-12 14:25:17 +02:00
Sebastiaan van Stijn
7eda35fd05 profiles/apparmor: IsLoaded: optimize
- Use a bufio.Scanner to read the profiles
- Use strings.Cut

Before/After:

    BenchmarkIsLoaded-10  2258	    508049 ns/op    244266 B/op    10004 allocs/op
    BenchmarkIsLoaded-10  5680	    208703 ns/op      4264 B/op	       4 allocs/op

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-12 13:34:13 +02:00
Sebastiaan van Stijn
0462b5e318 profiles/apparmor: add BenchmarkIsLoaded
go test -bench=. ./profiles/apparmor/
    goos: linux
    goarch: arm64
    pkg: github.com/docker/docker/profiles/apparmor
    BenchmarkIsLoaded-10    	    2258	    508049 ns/op	  244266 B/op	   10004 allocs/op
    PASS
    ok  	github.com/docker/docker/profiles/apparmor	1.210s

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-12 13:34:13 +02:00
Sebastiaan van Stijn
b23d267cb5 profiles/apparmor: add basic unit-test for IsLoaded
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-12 13:34:12 +02:00
Sebastiaan van Stijn
0dd5959eeb profiles/apparmor: InstallDefault: slight cleanup and optimization
The existing code was more complicated than needed. By default, the daemon
runs "unconfined", but we try to detect the current profile that's set.
When failing to do so (error, or detected profile is empty), we assume
the default ("unconfined").

This patch simplifies the logic;

- Set the default ("unconfined")
- Only update the default when we successfully found the current profile
  (no error occurred, and the profile is not empty).

While updating, also;

- Replaced use of `strings.SplitN` for `strings.Cut`, which is more
  efficient, and doesn't allocate.
- Move constructing the profileData closer to where it's used.
- Remove intermediate var.
- Combine defers and change the order (close file first, before removing),
  and suppress errors to keep linters happy.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-12 13:34:12 +02:00
Sebastiaan van Stijn
0bb761698c profiles/apparmor: loadprofile: fix double command in error message
`exec.Cmd.Path` already contains the command that was executed, so we
were printing the command twice. However, `exec.Cmd` implements a stringer
interface, which provides a readable version of the command that was
executed, so use that instead. While updating, lso change backticks in
the error for regular quotes.

Before:

    running `/usr/sbin/apparmor_parser apparmor_parser -Kr /no/such/file` failed with output: Cache read/write disabled: interface file missing. (Kernel needs AppArmor 2.4 compatibility patch.)
    Warning: unable to find a suitable fs in /proc/mounts, is it mounted?
    Use --subdomainfs to override.

    error: exit status 1

After:

    running '/usr/sbin/apparmor_parser -Kr /no/such/file' failed with output: Cache read/write disabled: interface file missing. (Kernel needs AppArmor 2.4 compatibility patch.)
    Warning: unable to find a suitable fs in /proc/mounts, is it mounted?
    Use --subdomainfs to override.

    error: exit status 1

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-12 13:34:12 +02:00
Sebastiaan van Stijn
8e1c366773 profiles/apparmor: remove "// import" comments
We are considering moving the apparmor profile to a separate module,
so removing these comments in preparation. These comments are ignored
already when building in go module mode, so have little benefits.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-12 13:34:12 +02:00
Sebastiaan van Stijn
1fa6a46c5d profiles/seccomp: remove "// import" comments
We are considering moving the seccomp profile to a separate module,
so removing these comments in preparation. These comments are ignored
already when building in go module mode, so have little benefits.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-12 10:46:03 +02:00
Sebastiaan van Stijn
89604f1df1 profiles/seccomp: use stdlib for asserting
We are considering moving the seccomp profile to a separate module,
so reducing the list of dependencies for this package.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-12 10:26:10 +02:00
Jonathan A. Sternberg
14623770e1 vendor: github.com/moby/buildkit v0.21.0-rc2
Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com>
2025-04-11 14:02:47 -05:00
Paweł Gronowski
250792c1a5 Merge pull request #49795 from thaJeztah/revert_info_changes
Revert "API: /info: remove BridgeNfIptables, BridgeNfIp6tables fields"
2025-04-11 13:17:24 +00:00
Sebastiaan van Stijn
eacbbdeec6 Revert "API: /info: remove BridgeNfIptables, BridgeNfIp6tables fields"
This reverts commit 5d2006256f, which
caused some issues in the docker/cli formatting code that needs some
investigating.

Let's (temporarily) revert this while we look what's wrong.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-11 14:47:10 +02:00
Paweł Gronowski
73520a5ab7 Merge pull request #49793 from vvoland/cut-api
docs/api: add documentation for API v1.49
2025-04-11 11:40:21 +00:00
Paweł Gronowski
36f87754c2 Merge pull request #49794 from vvoland/update-authors
Update AUTHORS
2025-04-11 11:40:06 +00:00
Paweł Gronowski
ece7e02b86 Update AUTHORS
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-04-11 13:08:52 +02:00
Paweł Gronowski
adb9e9135a docs/api: add documentation for API v1.49
Copy the swagger / OpenAPI file to the documentation. This is the API
version used by the upcoming v28.1.0 release.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-04-11 13:01:02 +02:00
Paweł Gronowski
f3d6830d27 Merge pull request #49783 from thaJeztah/deprecate_bridgenfip_fields
API: /info: remove BridgeNfIptables, BridgeNfIp6tables fields
2025-04-11 10:46:59 +00:00
Paweł Gronowski
cdad178d02 Merge pull request #49789 from akerouanton/trace-containerCreate-labels
daemon: containerCreate, containerStart: add filtered labels to OTel span
2025-04-11 10:34:02 +00:00
Paweł Gronowski
fb2983ab0d Merge pull request #49677 from vvoland/integration-cli-bump-cli
integration-cli: Update default CLI version to v18.06.3-ce
2025-04-11 10:32:36 +00:00
Sebastiaan van Stijn
a6928fd396 Merge pull request #49787 from thaJeztah/bump_registry
Dockerfile: update registry to v3.0.0
2025-04-10 22:13:58 +02:00
Sebastiaan van Stijn
511cd1c0a7 Merge pull request #49785 from thaJeztah/fix_debug_logs
api/server/middleware: fix debug-logs missing form-data
2025-04-10 21:54:00 +02:00
Sebastiaan van Stijn
e2b95a9525 Merge pull request #49770 from dmcgowan/containerd-registry-error-handling
Add registry error handling for push and pull
2025-04-10 21:32:56 +02:00
Albin Kerouanton
099d3ee008 daemon: containerStart: add filtered labels to OTel span
Like for containerCreate, filter the list of container labels based on
`DOCKER_OTEL_INCLUDE_CONTAINER_LABEL_ATTRS` and put that list in the
OTel span.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-04-10 19:12:25 +02:00
Albin Kerouanton
0c5e816638 daemon: trace containerCreate
This commit adds a new OTel span to `(*Daemon).containerCreate()` and
puts filtered container labels in the span attributes.

The filter is based on a comma-separated list of labels provided through
the `DOCKER_OTEL_INCLUDE_CONTAINER_LABEL_ATTRS` environment variable.
This label might be removed at any point in time if we figure out a
better way to filter labels, or if that span becomes unecessary.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-04-10 19:12:25 +02:00
Rob Murray
3fc5bfd565 Merge pull request #49778 from robmry/fix_delete_legacy_link
Fix removal of legacy links
2025-04-10 15:16:00 +01:00
Sebastiaan van Stijn
f96dc9d1a5 Dockerfile: update registry to v3.0.0
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-10 15:54:11 +02:00
Rob Murray
4d35864c3d Fix removal of legacy links
It's possible to remove a legacy link from running containers.
When that happens, the Sandbox's Endpoints are removed and
re-added.

Since commit 65120d5 ("Create bridge veth in container netns")
the veth device has been created in the container's netns. When
that happens, a flag is set on the Endpoint to note that it
does not need to be moved into the netns.

But, during the Leave/Join (Sandbox.Refresh) the veth is moved
out of the netns. So, clear the flag during the Leave, to note
that it needs to be moved back in during the Join.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-04-10 14:22:40 +01:00
Sebastiaan van Stijn
5d2006256f API: /info: remove BridgeNfIptables, BridgeNfIp6tables fields
The `BridgeNfIptables` and `BridgeNfIp6tables` fields in the
`GET /info` response were deprecated in API v1.48, and are now omitted
in API v1.49.

With this patch, old API version continue to return the field:

    curl -s --unix-socket /var/run/docker.sock http://localhost/v1.48/info | jq .BridgeNfIp6tables
    false

    curl -s --unix-socket /var/run/docker.sock http://localhost/v1.48/info | jq .BridgeNfIptables
    false

Omitting the field in API v1.49 and above

    curl -s --unix-socket /var/run/docker.sock http://localhost/v1.49/info | jq .BridgeNfIp6tables
    null

    curl -s --unix-socket /var/run/docker.sock http://localhost/v1.49/info | jq .BridgeNfIptables
    null

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-10 14:26:42 +02:00
Sebastiaan van Stijn
499e15d4ab api/server/middleware: fix debug-logs missing form-data
This was introduced in c817ea2159, but overlooked
that the logs were now produced before (for POST requests) the form-data was
handled and added to the "fields" variable.

This patch changes the logic to wrap the handler and make sure logs are
created before, and after the handler is called (the "form-data" is always
added before the handler is called).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-10 14:22:31 +02:00
Paweł Gronowski
325076df0c Merge pull request #49765 from robmry/iptables_bridge_driver_level_rules
Put bridge driver's top-level iptables config in a separate object
2025-04-10 11:08:51 +00:00
Sebastiaan van Stijn
97688e8d06 container: Container.SetupWorkingDirectory: remove use of pkg/idtools
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-10 12:30:34 +02:00
Sebastiaan van Stijn
3e993060ee Merge pull request #48556 from thaJeztah/deprecate_info_expected_version_step2
api: info: omit deprecated "Commit.Expected" fields on API >= 1.49
2025-04-10 12:29:48 +02:00
Sebastiaan van Stijn
91ba210bc8 Merge pull request #49666 from thaJeztah/legacy_errors
api, client: produce human-readable errors for unsupported API versions (< v1.24)
2025-04-10 12:08:56 +02:00
Sebastiaan van Stijn
bfbd1004f4 Merge pull request #49762 from thaJeztah/remove_deprecated_AllowNondistributableArtifacts
registry: remove deprecated ServiceConfig.AllowNondistributableArtifacts
2025-04-10 12:08:14 +02:00
Paweł Gronowski
5f9d99b4cc integration-cli/swarm: Update to use gotest.tools
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-04-10 11:39:18 +02:00
Paweł Gronowski
ea6c76ee03 integration-cli/TestSwarmInit: Skip failing part on CLI after 18.06
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-04-10 11:39:16 +02:00
Paweł Gronowski
fab94808f5 integration-cli: Update default CLI version to v18.06.3-ce
This updates the Docker CLI version used for integration-cli tests from
v17.06.2-ce to v18.06.3-ce.

v18.06 is the first one that supports enabling BuildKit.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-04-10 11:39:13 +02:00
Tianon Gravi
6df89e7961 Merge pull request #49775 from dmcgowan/remove-ubuntu-20.04
Update remaining Ubuntu 20.04 GHA uses to 22.04 and 24.04
2025-04-10 00:05:30 +00:00
Sebastiaan van Stijn
466dda63dc Merge pull request #49747 from jsternberg/buildkit-vendor
vendor: github.com/moby/buildkit v0.21.0-rc1
2025-04-10 01:18:47 +02:00
Derek McGowan
6c73266a71 Add registry error handling for push and pull
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-04-09 14:19:27 -07:00
Jonathan A. Sternberg
ae3a1ac602 vendor: github.com/moby/buildkit v0.21.0-rc1
Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com>
2025-04-09 14:37:09 -05:00
Derek McGowan
cd89a35ea0 Run CLI tests with cgroups v2
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-04-09 11:05:14 -07:00
Sebastiaan van Stijn
da039bf8e6 Merge pull request #49777 from thaJeztah/bump_x_deps
vendor: update golang.org/x/.. dependencies
2025-04-09 18:05:11 +02:00
Sebastiaan van Stijn
58eabf4b36 Merge pull request #49759 from thaJeztah/migrate_archive_squashed_alt_step2
replace uses of idtools.MkdirAllAndChown, MkdirAllAndChownNew
2025-04-09 17:04:34 +02:00
Albin Kerouanton
888c14749d Merge pull request #47733 from krissetto/otel-test-stack
otel: simple OTEL collector/Jaeger/Aspire stack for testing purposes
2025-04-09 16:25:42 +02:00
Sebastiaan van Stijn
7435e4a1be registry: remove deprecated ServiceConfig.AllowNondistributableArtifacts
This option was deprecated in 1932091e21, and
is no longer used. It was only kept to allow priniting a deprecation warning
if the config would happen to have the field set.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-09 15:26:50 +02:00
Sebastiaan van Stijn
ba03cd7a63 daemon/config: add test for deprecated daemon.json fields
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-09 15:26:50 +02:00
Albin Kerouanton
27e7c650b8 Merge pull request #49773 from akerouanton/improve-has-active-endpoints-error
libnet: add ep name in 'has active endpoints' error
2025-04-09 15:14:37 +02:00
Sebastiaan van Stijn
d72e434d30 vendor: golang.org/x/mod v0.24.0
full diff: https://github.com/golang/mod/compare/v0.22.0...v0.24.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-09 14:28:37 +02:00
Sebastiaan van Stijn
224b393eb3 vendor: golang.org/x/net v0.39.0
full diff: https://github.com/golang/net/compare/v0.36.0...v0.39.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-09 14:26:51 +02:00
Sebastiaan van Stijn
b1ac2a53ed vendor: golang.org/x/crypto v0.37.0
full diff: https://github.com/golang/crypto/compare/v0.35.0...v0.37.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-09 14:25:29 +02:00
Sebastiaan van Stijn
a8af27bbae vendor: golang.org/x/text v0.24.0
no changes in vendored files

full diff: https://github.com/golang/text/compare/v0.22.0...v0.24.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-09 14:23:48 +02:00
Sebastiaan van Stijn
7d49b014b6 vendor: golang.org/x/sync v0.13.0
full diff: https://github.com/golang/sync/compare/v0.11.0...v0.13.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-09 14:20:16 +02:00
Sebastiaan van Stijn
9d04c28def vendor: golang.org/x/time v0.11.0
full diff: https://github.com/golang/time/compare/v0.6.0...v0.11.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-09 14:18:22 +02:00
Sebastiaan van Stijn
cdb3590e1a vendor: golang.org/x/sys v0.32.0
full diff: https://github.com/golang/sys/compare/v0.31.0...v0.32.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-09 14:16:30 +02:00
Christopher Petito
970fc1b6f7 Basic compose file for testing OTEL bits
Signed-off-by: Christopher Petito <chrisjpetito@gmail.com>
2025-04-09 13:48:04 +02:00
Sebastiaan van Stijn
d8a5e8928b replace uses of idtools.MkdirAllAndChown, MkdirAllAndChownNew
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-09 12:04:42 +02:00
Sebastiaan van Stijn
d96d20d45f update golangci-lint exceptions
These are no longer needed since d0154d3e59

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-09 12:00:50 +02:00
Rob Murray
29e0db25e7 Factor out top-level iptables setup into its own object
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-04-09 10:54:14 +01:00
Sebastiaan van Stijn
bcbcbb73fa Merge pull request #49743 from dmcgowan/update-archive-to-go-archive
Update archive to use github.com/moby/go-archive
2025-04-09 11:51:14 +02:00
Paweł Gronowski
5172617617 Merge pull request #49774 from akerouanton/fix-ContainerStart-trace
libnet/osl: independent OTel trace for advertiseAddrs
2025-04-09 09:29:48 +00:00
Albin Kerouanton
45daa6de06 Merge pull request #49769 from akerouanton/trace-bridge-createNetwork
libnet/d/bridge: trace createNetwork
2025-04-09 11:28:53 +02:00
Albin Kerouanton
241d685574 libnet: add ep name in 'has active endpoints' error
There have been numerous reports of the "has active endpoints" error
over the years. Historically, there were some faulty code paths that
could lead to this error, but we believe they all have been fixed by
now.

However, users are still facing this error from time to time. Either
because they forgot that some containers are still running, or because
we still have bugs lying around.

To help users figure whether this error is legitimate, and what triggers
it, add endpoint names (which are just container names) to the error
message.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-04-09 10:53:56 +02:00
Albin Kerouanton
489cd7edfc api, daemon, libnet: add a 'trigger' baggage member
Add an OTel span processor copying the 'trigger' baggage member
propagated through contexts to all children spans. It's used to identify
what triggered a trace / span (API call, libnet init, etc...)

All code paths that call libnet's `NewNetwork` set this baggage member
with a unique value.

For instance, this can be used to distinguish bridge's `createNetwork`
spans triggered by daemon / libnet initialization from custom network
creation triggerd by an API call.

Two util functions are added to wrap `baggage.New` and
`baggage.NewMemberRaw` to make it easier to deal with baggage and
members by panicking on error. These should not be used with dynamic
values.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-04-09 08:45:33 +02:00
Albin Kerouanton
31ac5cb6d9 libnet: New: plumb context
Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-04-09 08:45:33 +02:00
Albin Kerouanton
667c7d70b3 libnet/d/bridge: trace network setup steps
Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-04-09 08:45:33 +02:00
Albin Kerouanton
eaae4b5fb6 libnet/d/bridge: put span prefix in var
Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-04-09 08:45:33 +02:00
Albin Kerouanton
78be7ebad7 libnet/d/bridge: trace createNetwork
Plumb context from the API down to libnet driver method `CreateNetwork`,
and add an OTel span to the bridge driver's `createNetwork` method.
Include a few attributes describing the network configuration (e.g.
IPv4/IPv6, ICC, internal and MTU).

A new util function, `RecordStatus`, is added to the `otelutil` package
to easily record any error, and update the span status accordingly.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-04-09 08:45:33 +02:00
Albin Kerouanton
f8806f2b80 libnet/osl: independent OTel trace for advertiseAddrs
Since commit `eaa84bc`, when a container joins a network, we broadcast
unsolicited ARP/NAs to other containers connected to that network. The
initial advertisement is sent synchronously, and then remaining
advertisements (by default, 2) are sent asynchronously at a regular
interval (by default, 1 second).

An OTel span records the time spent sending subsequent advertisements,
but it's attached to the parent span `libnetwork.osl.AddInterface` so it
affects the overall latency reported by the trace.

The real latency (i.e. excluding the latency of that asynchronous
process), is pretty much what CLI users perceive, so it's an important
measure. It's available on the top-most span in the trace, but limiting
the trace to the real time taken by the Engine to process the HTTP
request seems better.

With this change, the initial advertisement is now tracked by a
dedicated span, and a new independent trace (containing a single span)
is created and linked to the 'initial' span / HTTP trace.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-04-09 08:43:34 +02:00
Derek McGowan
d0154d3e59 Update to use github.com/moby/go-archive
Update use of idtools to moby/user for archive and other deprecated uses

Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-04-08 17:35:05 -07:00
Derek McGowan
45f9d679f8 Update remaining Ubuntu 20.04 uses to 22.04 and 24.04
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-04-08 12:50:52 -07:00
Derek McGowan
57a042b77c deprecate pkg/(chroot)archive for github.com/moby/go-archive
- pkg/archive: deprecate, and add aliases
  Keeping the tests in this commit; also moves various utilities
  into a _test.go file, as they were now only used in tests.
- pkg/chrootarchive: deprecate and add aliase
  deprecate pkg/archive and add aliases
  keeping the tests in this commit
- Add temporary exceptions for deprecation linting errors, because
  this commit is to verify everything works with the aliases.
- remove tests that depend on un-exported types

    === RUN   TestDisablePigz
    --- FAIL: TestDisablePigz (0.00s)
    panic: interface conversion: io.Reader is *archive.readCloserWrapper, not *archive.readCloserWrapper (types from different packages) [recovered]

- pkg/archive, pkg/chrootarchive: remove test files

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-04-08 10:56:58 -07:00
Sebastiaan van Stijn
564abf9157 api: info: omit deprecated "Commit.Expected" fields on API >= 1.49
These fields were deprecated in ff191c58f7,
and are now omitted.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-08 15:15:58 +02:00
Sebastiaan van Stijn
ba12b2d0bc Merge pull request #49749 from thaJeztah/omit_non_distributable
api: /info: omit non-distributable-artifacts fields for API >= 1.49
2025-04-08 15:14:02 +02:00
Paweł Gronowski
cf1001d555 Merge pull request #48563 from crazy-max/dockerfile-dind
dockerfile: dind target to build docker image for testing
2025-04-08 10:33:40 +00:00
Rob Murray
1b187e0959 Merge pull request #49728 from robmry/bridge_driver_firewalld_reload
Stop firewalld reload re-creating rules for deleted networks
2025-04-08 11:18:34 +01:00
CrazyMax
f410dbda88 dockerfile: dind target to build docker image for testing
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2025-04-08 11:48:33 +02:00
Rob Murray
c3fa7c1779 Test that firewalld reload doesn't re-create deleted iptables rules
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-04-08 10:27:35 +01:00
Rob Murray
dbea045e0d Report firewalld reload time in Info.FirewallBackend
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-04-08 10:26:41 +01:00
Rob Murray
a527e5a546 Restore iptables for current networks on firewalld reload
Using iptables.OnReloaded to restore individual per-network rules
on firewalld reload means rules for deleted networks pop back in
to existence (because there was no way to delete the callbacks on
network-delete).

So, on firewalld reload, walk over current networks and ask them
to restore their iptables rules.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-04-08 10:26:41 +01:00
Rob Murray
9ba5c5d70e Merge pull request #49732 from robmry/nftables_primitives
Add utils for manipulating nftables rules
2025-04-08 09:25:41 +01:00
Akihiro Suda
3509feb1a5 Merge pull request #49763 from thaJeztah/registry_wire_up_contexts
registry: wire up contexts in some places, and remove some intermediate vars
2025-04-08 16:14:31 +09:00
Sebastiaan van Stijn
185651d26b Merge pull request #49767 from thaJeztah/vendor_atomicwriter
vendor: github.com/moby/sys/atomicwriter v0.1.0
2025-04-07 19:17:02 +02:00
Sebastiaan van Stijn
7d9c50db2b api: /info: omit non-distributable-artifacts fields for API >= 1.49
- registry.ServiceConfig: add a "ExtraFields" for outputting deprecated
  fields.
- remove uses of AllowNondistributableArtifactsCIDRs and AllowNondistributableArtifactsHostnames

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-07 19:12:09 +02:00
Paweł Gronowski
ebc6c065d2 Merge pull request #49761 from robmry/add_info_firewallbackend
Add Info.FirewallBackend
2025-04-07 17:00:45 +00:00
Paweł Gronowski
83278485c0 Merge pull request #49734 from Shaggy84675/49709-fix_system_cpu_usage_stat
Fix docker stats parsing with large amount of interrupts
2025-04-07 16:41:25 +00:00
Rob Murray
a0a86d0982 Add Info.FirewallBackend
Report FirewallBackend in "docker info".

It's currently "iptables" or "iptables+firewalld" on Linux, and
omitted on Windows.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-04-07 16:56:49 +01:00
Sebastiaan van Stijn
25a80bd48e vendor: github.com/moby/sys/atomicwriter v0.1.0
no changes in vendored files

full diff: https://github.com/moby/sys/compare/6e2523cbf3a1...atomicwriter/v0.1.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-07 17:44:43 +02:00
Paweł Gronowski
d7d91b6bc5 Merge pull request #49764 from akerouanton/fix-TestNetworkStore-TestEndpointStore
libnet: de-flake TestEndpointStore and TestNetworkStore
2025-04-07 15:31:16 +00:00
Sebastiaan van Stijn
96601d1211 Merge pull request #49586 from vvoland/image-inspect-platform
image/inspect: Add platform selection
2025-04-07 16:29:57 +02:00
Albin Kerouanton
4eebd2c920 libnet: TestNetworkStore: replace assert.Equal with Check
Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-04-07 16:25:00 +02:00
Patrik Leifert
e22d04e8a9 Improve CPU usage parsing and error reporting
This fix address issues where the scanner was unable to properly parse longer outputs from /proc/stat. This could happen on an ARM machine with large amount of CPU cores (and interrupts). By switching to reader we have more control over data parsing and dump unnecessary data

Signed-off-by: Patrik Leifert <patrikleifert@hotmail.com>
2025-04-07 16:19:02 +02:00
Albin Kerouanton
40650c6982 libnet: de-flake TestNetworkStore
Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-04-07 16:03:36 +02:00
Albin Kerouanton
1c79c893b1 libnet: de-flake TestEndpointStore
Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-04-07 16:03:03 +02:00
Paweł Gronowski
d9fd0c2db4 Merge pull request #49746 from vvoland/c8d-pull-progress-all
c8d/pull: Show progress for non-layer blobs
2025-04-07 12:40:46 +00:00
Sebastiaan van Stijn
8a5f141b0e registry: Service.lookupV2Endpoints: wire-up context
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-07 13:36:21 +02:00
Sebastiaan van Stijn
9d8c8382d3 registry: authorizeClient: wire-up context
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-07 13:35:03 +02:00
Sebastiaan van Stijn
8b920b2812 registry: loginV2: wire-up context
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-07 13:35:03 +02:00
Sebastiaan van Stijn
4642704ed7 registry: newTransport: remove intermediate var
Align closer to other code doing the same.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-07 13:35:03 +02:00
Paweł Gronowski
7acef8101e c8d/pull: Show progress for non-layer blobs
Use the same logic as push for determining whether a progress should be
shown for a blob.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-04-07 13:31:04 +02:00
Paweł Gronowski
da3b31fb2c Merge pull request #49736 from akerouanton/cache-endpoint-in-memory
libnet: Controller: cache networks & endpoints in-memory
2025-04-07 10:00:36 +00:00
Paweł Gronowski
4f7588f6ad Merge pull request #49724 from akerouanton/fix-duplicated-port-mappings
libnet: fix duplicated port mappings in overlay networks
2025-04-07 09:57:38 +00:00
Sebastiaan van Stijn
c95e17638f Merge pull request #49757 from thaJeztah/archive_fix_linting
pkg/archive: fix linting issues
2025-04-07 10:18:03 +02:00
Akihiro Suda
b3bafd4b78 Merge pull request #49753 from thaJeztah/idtools_replace
pkg/idtools: MkdirAllAndChownNew: improve deprecation message
2025-04-07 09:00:46 +01:00
Akihiro Suda
e7ab601ab9 Merge pull request #49750 from thaJeztah/bump_go_cmp
vendor: github.com/google/go-cmp v0.7.0
2025-04-07 08:59:43 +01:00
Sebastiaan van Stijn
b3791dea92 pkg/archive: fix linting issues
fix "struct literal uses unkeyed fields" (govet)

    pkg/archive/changes_test.go:123:18: composites: github.com/docker/docker/pkg/archive.Change struct literal uses unkeyed fields (govet)
        modifyChange := Change{"change", ChangeModify}
                        ^
    pkg/archive/changes_test.go:128:15: composites: github.com/docker/docker/pkg/archive.Change struct literal uses unkeyed fields (govet)
        addChange := Change{"change", ChangeAdd}
                     ^
    ...

fix various variables that shadowed types

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-07 08:48:53 +02:00
Akihiro Suda
27568e54ce Merge pull request #49751 from thaJeztah/bump_compress
vendor: github.com/klauspost/compress v1.18.0
2025-04-07 04:52:12 +01:00
Sebastiaan van Stijn
a427477220 pkg/idtools: MkdirAllAndChownNew: improve deprecation message
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-06 13:02:52 +02:00
Sebastiaan van Stijn
a91bcc677b vendor: github.com/klauspost/compress v1.18.0
full diff: https://github.com/klauspost/compress/compare/v1.17.11...v1.18.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-05 16:44:10 +02:00
Sebastiaan van Stijn
2c54f6f316 vendor: github.com/google/go-cmp v0.7.0
full diff: https://github.com/google/go-cmp/v0.6.0...v0.7.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-05 16:42:24 +02:00
Sebastiaan van Stijn
6cbca96bfa Merge pull request #49748 from thaJeztah/migrate_atomicwriter
deprecate pkg/atomicwriter, migrate to github.com/moby/sys/atomicwriter
2025-04-05 11:01:16 +02:00
Sebastiaan van Stijn
79b22645fc Merge pull request #49737 from thaJeztah/bump_golang_1.23.8
update to go1.23.8 (fix CVE-2025-22871)
2025-04-05 11:00:11 +02:00
Sebastiaan van Stijn
6422ff2804 deprecate pkg/atomicwriter, migrate to github.com/moby/sys/atomicwriter
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-04 23:07:00 +02:00
Sebastiaan van Stijn
872b6d5df9 Merge pull request #49738 from thaJeztah/bump_cdi
vendor: tags.cncf.io/container-device-interface v1.0.1
2025-04-04 22:43:21 +02:00
Sebastiaan van Stijn
d7b743b856 Merge pull request #49741 from thaJeztah/atomicwriter_stricter_validate
pkg/atomicwriter: disallow symlinks for now, add more tests and touch-up GoDoc
2025-04-04 20:11:23 +02:00
Sebastiaan van Stijn
43b7c78cbd Merge pull request #49566 from dmcgowan/update-moby-user-idtools
Update `github.com/moby/sys/user` and use of idtools
2025-04-04 18:31:19 +02:00
Sebastiaan van Stijn
5ea21c927c Merge pull request #49745 from thaJeztah/registry_cleanup_step3
registry: wire up context in some places
2025-04-04 17:43:49 +02:00
Sebastiaan van Stijn
f1ec5bf14f pkg/idtools: remove tests already covered in moby/sys/user
Removes all tests, except for TestGetRootUIDGID and TestToContainer, which
are the only once that have a local implementation that's not covered.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-04 08:24:09 -07:00
Derek McGowan
3fc36bcac4 Update daemon to use moby sys/user identity mapping
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-04-04 08:24:09 -07:00
Derek McGowan
b5c99c0e95 Update moby/sys/user to version which includes mapping
Update idtools to use Mkdir funcs from moby sys/user package
Add deprecation exception to golanci until move off idtools is complete

Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-04-04 08:22:05 -07:00
Sebastiaan van Stijn
0a83a476d8 registry: v1Endpoint.ping: pass through context
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-04 12:59:42 +02:00
Sebastiaan van Stijn
2a272a0c5d registry: newV1Endpoint: pass through context
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-04 12:59:42 +02:00
Sebastiaan van Stijn
f158d2e809 registry: ReadCertsDirectory: internalize, and pass context
- Split the implementation from the exported function (exported
  function is still used by the CLI for Docker Content Trust).
- Pass through context to allow handling context-cancellation
  once wired up in callers.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-04 12:59:36 +02:00
Sebastiaan van Stijn
11bf52e9e3 Merge pull request #49739 from thaJeztah/registry_cleanup_step2
registry: minor fixes and cleanups
2025-04-04 12:30:52 +02:00
Albin Kerouanton
51d7f95c4b libnet: remove struct endpointCnt
endpointCnt is a refcounter used to track how many endpoints use a
network, and how many networks references a config-only network. It's
stored separately from the network.

This is only used to determine if a network can be removed.

This commit removes the `endpointCnt` struct and all its references. The
refcounter is replaced by two lookups in the newly introduced `networks`
and `endpoints` caches added to the `Controller`.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-04-04 11:21:17 +02:00
Paweł Gronowski
68451d3c99 Merge pull request #49650 from jsternberg/containerd-dangling-image-on-load
containerd: ensure overwritten images from load are left dangling
2025-04-04 09:14:38 +00:00
Albin Kerouanton
d377cd3810 libnet: Controller: cache networks in-memory
The `Controller`'s store is used by:

- `deleteFromStore`
- `getNetworks`
- `getNetworksFromStore`
- `updateToStore`
- … and other methods that can't store / delete / retrieve a Network

Calls to `updateToStore` and `deleteFromStore` have been replaced with
`upsertNetwork` and `deleteNetwork`.

Both `getNetworks` and `getNetworksFromStore` call `cacheNetwork` to
ensure networks loaded from the datastore are kept in-memory.

Finally, `sandboxRestore` was instantiating `Network` itself. These are
cached too.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-04-04 10:03:02 +02:00
Albin Kerouanton
cc8bd2016e libnet: Controller: cache endpoints in-memory
The `Controller`'s store is used by:

- `deleteFromStore`
- `getEndpointFromStore`
- `getEndpointsFromStore`
- `updateToStore`
- … and other methods that can't store / delete / retrieve an Endpoint

Calls to `updateToStore` and `deleteFromStore` have been replaced with
`upsertEndpoint` and `deleteEndpoint`.

Both `getEndpointFromStore` and `getEndpointsFromStore` call
`cacheEndpoint` to ensure endpoints loaded from the datastore are kept
in-memory.

Finally, `sandboxRestore` was instantiating `Endpoint` itself. These are
cached too.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-04-04 10:03:02 +02:00
Sebastiaan van Stijn
4ad6854eb3 Merge pull request #49727 from robmry/rootlesskit_iptables_check
Rootless setup: check for module nf_tables
2025-04-04 01:06:14 +02:00
Sebastiaan van Stijn
c6cdfbf495 pkg/atomicwriter: return early if parent directory is invalid
Rewrite `validateDestination` to first check if the destination path
exists. This slightly simplifies the logic (allowing returning
early in each step of the validation) and slightly improves the
error produced.

Before this, the error confusingly would mention the full path
not being a directory. While this _does_ match what `os.Writefile`
would return, it's .. confusing:

    failed to stat output path: lstat ./not-a-dir/new-file.txt: not a directory

After this, the error would mention the directory that doesn't exist:

    invalid output path: stat ./not-a-dir: not a directory

A slight optimization is made as well, now checking for _both_ "."
and ".." as special case, as either path should exist given any current
working directory (unless the working directory has been deleted, but we'd
fail further down the line).

With this change in order, we can also merge `validateFileMode` into
`validateDestination`.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-03 21:57:13 +02:00
Sebastiaan van Stijn
00c988caa4 pkg/atomicwriter: add test for parent dir not being a directory
While the target-file does not have to exist, its parent must, and must
be a directory. This adds a test-case to verify the behavior if the
parent is not a directory.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-03 21:39:33 +02:00
Sebastiaan van Stijn
ad386f64e5 pkg/atomicwriter: error on unknown file-modes
Previously, we were silently discarding this situation and hoping that
it would work; let's produce an error instead (we can add additional
filemodes when they arrive and if we need them)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-03 21:39:32 +02:00
Sebastiaan van Stijn
ec82bc35c3 pkg/atomicwriter: disallow symlinked files for now
The implementation uses "os.Rename" to move the temporary file to
the destination, which does not follow symlinks, and because of this
would replace a symlink with a file.

We can consider adding support for symlinked files in future, so that
WriteFile can be used as a drop-in replacement for `os.WriteFile()`
but in the meantime, let's produce an error so that nobody can depend
on this.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-03 21:39:32 +02:00
Sebastiaan van Stijn
f3aebbf9d8 pkg/atomicwriter: add basic godoc for package
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-03 21:39:21 +02:00
Rob Murray
f80feba181 Rootlesskit: check for module nf_tables
CentOS 10 uses iptables-nft by default, and doesn't have
kernel module ip_tables - so dockerd-rootless-setuptool.sh
reports that the module is missing. It suggests installing
it (which isn't needed), or using --skip-iptables (which
disables iptables in daemon config).

So, unless "iptables --version" command reports "legacy",
check for kernel module "nf_tables" instead of "ip_tables".

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-04-03 20:25:35 +01:00
Paweł Gronowski
26e516dff4 Merge pull request #49720 from robmry/iptablesnetwork_per_port_rules
Include per-port rules in iptablesNetwork
2025-04-03 18:59:09 +00:00
Rob Murray
7d742ebf75 Add utils for manipulating nftables rules
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-04-03 16:47:30 +01:00
Paweł Gronowski
59169d0f97 image/inspect: Add platform selection
`GET /image/{name}/json` now supports `platform` parameter allowing to
specify which platform variant of a multi-platform image to inspect.

For servers that do not use containerd image store integration, this
option will cause an error if the requested platform doesn't match the
image's actual platform

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-04-03 13:57:51 +02:00
Sebastiaan van Stijn
d4e70f6325 vendor: tags.cncf.io/container-device-interface v1.0.1
full diff: https://github.com/cncf-tags/container-device-interface/compare/v0.8.1...v1.0.1

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-03 13:10:29 +02:00
Sebastiaan van Stijn
74b71c41ac update to go1.23.8 (fix CVE-2025-22871)
full diff: https://github.com/golang/go/compare/go1.23.7...go1.23.8
release notes: https://go.dev/doc/devel/release#go1.24.2

go1.23.8 (released 2025-04-01) includes security fixes to the net/http package,
as well as bug fixes to the runtime and the go command. See the Go 1.23.8
milestone on our issue tracker for details;

https://github.com/golang/go/issues?q=milestone%3AGo1.23.8+label%3ACherryPickApproved

From the mailing list:

Hello gophers,

We have just released Go versions 1.24.2 and 1.23.8, minor point releases.
These minor releases include 1 security fixes following the security policy:

- net/http: request smuggling through invalid chunked data
  The net/http package accepted data in the chunked transfer encoding
  containing an invalid chunk-size line terminated by a bare LF.
  When used in conjunction with a server or proxy which incorrectly
  interprets a bare LF in a chunk extension as part of the extension,
  this could permit request smuggling.
  The net/http package now rejects chunk-size lines containing a bare LF.
  Thanks to Jeppe Bonde Weikop for reporting this issue.
  This is CVE-2025-22871 and Go issue https://go.dev/issue/71988.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-03 12:30:00 +02:00
Sebastiaan van Stijn
fc58c829e8 registry: ParseRepositoryInfo: remove some intermediate vars
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-03 12:10:17 +02:00
Sebastiaan van Stijn
44b7a42fc6 registry: ReadCertsDirectory: return early on error
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-03 12:10:16 +02:00
Sebastiaan van Stijn
4f65e35f02 registry: NewService: return nil on error
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-03 12:10:16 +02:00
Sebastiaan van Stijn
a7daab5df4 registry: authTransport: un-export AuthConfig, RoundTripper
Don't embed these interfaces/types, and keep them internal.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-03 12:10:13 +02:00
Paweł Gronowski
36295bb9ed Merge pull request #49714 from thaJeztah/distribution_cleanups
distribution: cleanup tests, and remove unused fields
2025-04-03 09:26:31 +00:00
Rob Murray
2e92272753 Merge pull request #49735 from thaJeztah/sync_swagger_docs
docs: API v1.48: Add missing platform parameter to ImageGet api docs and add it under Image tag
2025-04-03 09:47:35 +01:00
Sebastiaan van Stijn
5b8a41934b Merge pull request #49729 from robmry/no_rootless_unit_tests
Don't run unit tests with mode rootless
2025-04-02 23:51:12 +02:00
Kristian Heljas
795461eceb docs: api v1.48: Move ImageGet api docs under Image tag
Signed-off-by: Kristian Heljas <kristian@kristian.ee>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-02 23:25:57 +02:00
Kristian Heljas
e1e58409a1 docs: API v1.48 Add missing platform parameter to ImageGetAll api docs
Signed-off-by: Kristian Heljas <kristian@kristian.ee>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-02 23:25:26 +02:00
Rob Murray
b5b6e1b24c Merge pull request #49726 from kristianheljas/image-get-platform-parameter
Add missing platform parameter to ImageGet api docs and add it under Image tag
2025-04-02 19:26:01 +01:00
Albin Kerouanton
db275ddbc1 libnet: fix duplicated port mappings in overlay networks
Since commit f2a183a99, `getEndpointPortMapInfo` is called for all the
endpoints of a container to get its complete list of port mappings. This
is required as multiple endpoints might publish different ports (e.g.
IPv4-only and IPv6-only endpoints mapping an IPv4 and an IPv6 port).

`getEndpointPortMapInfo` calls `(*Endpoint).DriverInfo()` which has a
dodgy behavior: if the endpoint is part of a sandbox that also has an
endpoint for the `docker_gwbridge` network, then `(*Endpoint).DriverInfo()`
returns the DriverInfo of that `docker_gwbridge` endpoint in place of
the current Endpoint's DriverInfo.

On overlay networks, host port-mappings are made through the
`docker_gwbridge` network (which is automatically attached to all Swarm
tasks). This results in duplicated port mappings reported for all Swarm
containers.

Since `getEndpointPortMapInfo` is the only place where
`(*Endpoint).DriverInfo()` is called, just remove that dodgy behavior.

`(*Endpoint).DriverInfo()` has an OS-specific implementation. Unlike the
Linux implementation, on Windows, `DriverInfo()` returns the DriverInfo
of the gateway endpoint _in addition_ to the current Endpoint's
DriverInfo. So it shouldn't be affected by this bug -- don't touch it.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-04-02 12:30:50 +02:00
Rob Murray
a9e22ee5e7 Don't run unit tests with mode rootless
Tests will run in the host's namspace not the rootlesskit
namespace. So, just duplicating the non-rootless unit tests.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-04-02 10:43:40 +01:00
Rob Murray
25905ab6c6 Merge pull request #49718 from vvoland/api-1.49
api: bump API version to 1.49
2025-04-01 19:53:31 +01:00
Kristian Heljas
749e35cf5e Move ImageGet api docs under Image tag
Signed-off-by: Kristian Heljas <kristian@kristian.ee>
2025-04-01 16:06:17 +03:00
Kristian Heljas
094df015b1 Add missing platform parameter to ImageGetAll api docs
Signed-off-by: Kristian Heljas <kristian@kristian.ee>
2025-04-01 16:06:03 +03:00
Sebastiaan van Stijn
843e51459f Merge pull request #49609 from thaJeztah/client_more_canonical
client: keep image refs in canonical format where possible
2025-04-01 09:43:52 +02:00
Sebastiaan van Stijn
b5280352e9 Merge pull request #49608 from thaJeztah/atomicwriter_sequential
pkg/atomicwriter: use sequential file access on Windows
2025-03-31 18:11:18 +02:00
Rob Murray
7243860557 Include per-port rules in iptablesNetwork
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-03-31 17:04:17 +01:00
Rob Murray
f01a2eb710 Merge pull request #49710 from robmry/simplify_bridge_legacy_links
Simplify bridge legacy links
2025-03-31 16:15:00 +01:00
Paweł Gronowski
4390ab275a api: bump API version to 1.49
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-03-31 14:09:39 +02:00
Paweł Gronowski
67670ddc80 Merge pull request #49715 from thaJeztah/registry_touchup_ValidateMirror
registry: ValidateMirror: touch-up GoDoc and improve test-coverage
2025-03-31 11:48:46 +00:00
Paweł Gronowski
0cabd9dfba Merge pull request #49713 from thaJeztah/search_pass_context
registry: session.searchRepositories: pass through context
2025-03-31 11:46:47 +00:00
Rob Murray
0b5e1f904a Use netip.Addr instead of net.IP for legacy links
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-03-31 11:52:16 +01:00
Rob Murray
725e699741 Simplify iptables setup for legacy links
Include legacy link setup in IptablesNetwork, with the other
per-network rules.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-03-31 11:52:16 +01:00
Rob Murray
c5c9dc0376 Merge pull request #49668 from robmry/iptables_network_rules
Bridge: factor out creation of network-level iptables rules
2025-03-31 11:48:45 +01:00
Sebastiaan van Stijn
31f9ae0d19 registry: TestValidateMirror: improve coverage
Test actual error returned, and test normalized value.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-31 10:14:43 +02:00
Sebastiaan van Stijn
cb0a9d713c registry: ValidateMirror: touch-up GoDoc
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-31 10:11:29 +02:00
Sebastiaan van Stijn
6b258ce567 registry: session.searchRepositories: pass through context
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-31 10:00:23 +02:00
Sebastiaan van Stijn
83aaa3428f distribution: pusher.push(): don't use APIEndpoint.Mirror field
Unlike the equivalent for pulling images, [Service.LookupPushEndpoints]
never returns mirror endpoints, as it calls [Service.lookupV2Endpoints]
with "includeMirrors=false", so we should not use this field, and
unconditionally handle errors without the additional fallbacks that
we consider for pulling images from a mirror.

[Service.LookupPushEndpoints]: cea56c1d9c/registry/service.go (L134-L139)
[Service.lookupV2Endpoints]: cea56c1d9c/registry/service_v2.go (L10-L40)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-31 09:57:05 +02:00
Sebastiaan van Stijn
6439824449 distribution: pushDescriptor: remove unused endpoint field
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-31 09:57:05 +02:00
Sebastiaan van Stijn
09ee47de39 distribution: cleanup some tests and add missing error-checks
- use gotest.tools for assertions
- remove some debug-logs

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-31 09:57:04 +02:00
Rob Murray
37f866285a Merge pull request #49659 from robmry/firewalld_status
Run firewalld in CI
2025-03-28 18:32:18 +00:00
Rob Murray
adfed82ab8 Install and run firewalld for CI's firewalld tests
The github action running bake expected FIREWALLD to be set, but
DOCKER_FIREWALLD was set instead, so firewalld wasn't installed
in the dev image.

The dind-systemd script expected DOCKER_FIREWALLD to be set if it
needed to run firewalld, and it was. But it had no effect.

In CI, bake builds the image then make runs it - and the use the
same env. So, align on FIREWALLD (as it's not a docker feature).

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-03-28 16:59:48 +00:00
Rob Murray
409707b633 bridge: factor out creation of network-level iptables rules
Create an iptablesNetwork containing all the info needed to
set up per-network iptables rules, give it methods to do
create the rules, and use it instead of per-rule-type calls
from driver.createNetwork().

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-03-28 16:57:16 +00:00
Sebastiaan van Stijn
4cc249d7e3 Merge pull request #49706 from thaJeztah/deprecate_apiendpoint_official
registry: deprecate APIEndpoint.Official field
2025-03-28 16:24:15 +01:00
Sebastiaan van Stijn
81e267c013 Merge pull request #49696 from thaJeztah/registry_cleanup_step1
refactor and simplify various code-paths related to distribution / authentication
2025-03-28 15:48:00 +01:00
Sebastiaan van Stijn
ec7fe73690 distribution: pushDescriptor: rename repoInfo to repoName
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-28 10:55:58 +01:00
Sebastiaan van Stijn
b1c526b4a9 daemon/containerd: remove registryResolver interface
While it's generally better to define interfaces locally, this one
now duplicated distribution.RegistryResolver, and it's passed on
to other types which expect that interface.

Remove this (un-exported) interface to make it easier to discover
what's used where.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-28 10:55:58 +01:00
Sebastiaan van Stijn
0d95e1680a registry: ResolveAuthConfig: inline newIndexInfo code
inline a simplified version of "newIndexInfo" without handling of
insecure registries and mirrors, as we don't need that information
to resolve the auth-config.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-28 10:55:57 +01:00
Sebastiaan van Stijn
6c643bc366 lookup auth-config without depending on RepositoryInfo
Simplify how we lookup auth-config, as we don't need the
additional information provided by RepositoryInfo. There's
still more layers to peel off, which will be done in follow-ups.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-28 10:55:57 +01:00
Sebastiaan van Stijn
a18dae049f daemon/containerd: registryResolver: remove IsInsecureRegistry
It's not called anywhere, so we can remove it from this interface.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-28 10:55:57 +01:00
Sebastiaan van Stijn
abcc70b9ef distribution: GetRepositories skip using Service.ResolveRepository
[Service.ResolveRepository] is a shallow wrapper around [newRepositoryInfo],
from which we only consume the `Name` field. That field is a direct result
of `reference.TrimNamed`, so we can replace this with that.

[Service.ResolveRepository]: ecb03c4cda/registry/service.go (L106-L111)
[newRepositoryInfo]: ecb03c4cda/registry/config.go (L392-L408)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-28 10:55:57 +01:00
Sebastiaan van Stijn
071d8b21e9 distribution: Push: skip using Service.ResolveRepository
[Service.ResolveRepository] is a shallow wrapper around [newRepositoryInfo],
from which we only consume the `Name` field. That field is a direct result
of `reference.TrimNamed`, so we can replace this with that.

[Service.ResolveRepository]: ecb03c4cda/registry/service.go (L106-L111)
[newRepositoryInfo]: ecb03c4cda/registry/config.go (L392-L408)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-28 10:55:57 +01:00
Sebastiaan van Stijn
8b6a045aa4 distribution; newPusher: don't require RepositoryInfo
This constructor only uses the name / reference, and doesn't
use any of the other properties provided in RepositoryInfo.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-28 10:55:56 +01:00
Sebastiaan van Stijn
8653af5854 distribution: pullEndpoints: skip using Service.ResolveRepository
[Service.ResolveRepository] is a shallow wrapper around [newRepositoryInfo],
from which we only consume the `Name` field. That field is a direct result
of `reference.TrimNamed`, so we can replace this with that.

[Service.ResolveRepository]: ecb03c4cda/registry/service.go (L106-L111)
[newRepositoryInfo]: ecb03c4cda/registry/config.go (L392-L408)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-28 10:55:56 +01:00
Sebastiaan van Stijn
20a2807caa distribution: pullEndpoints: don't return RepositoryInfo
we're only consuming the name returned.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-28 10:55:56 +01:00
Sebastiaan van Stijn
f1ecce6877 distribution: pullEndpoints: don't require RepositoryInfo
The callback only used the name / reference

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-28 10:55:56 +01:00
Sebastiaan van Stijn
d6afe88b3c distribution: newPuller: don't require RepositoryInfo
This constructor only uses the name / reference, and doesn't
use any of the other properties provided in RepositoryInfo.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-28 10:55:54 +01:00
Sebastiaan van Stijn
03918c5b07 distribution: layerDescriptor: don't require RepositoryInfo
This type only uses the name / reference, and doesn't use any of the
other properties provided in RepositoryInfo.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-28 10:55:04 +01:00
Sebastiaan van Stijn
c91318e6c0 distribution: newRepository: don't require RepositoryInfo
This constructor only uses the name / reference, and doesn't
use any of the other properties provided in RepositoryInfo.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-28 10:54:59 +01:00
Sebastiaan van Stijn
2e8bf8b0ab distribution: remove vars that shadowed imports or types
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-28 10:48:10 +01:00
Rob Murray
a420005d4e Merge pull request #49672 from jsternberg/containerd-prioritize-non-dangling
containerd: prioritize non-dangling images with image list
2025-03-27 17:34:25 +00:00
Sebastiaan van Stijn
d8fa2f8071 registry: deprecate APIEndpoint.Official field
This field was introduced in 19515a7ad8 when
the registry code was replaced for code vendored from docker/distribution.

It was used for v1 registries to update the "TrustStore" for signed manifests;
19515a7ad8/graph/pull.go (L89-L93)

Before that, it used the IndexInfo.Official field;
276c640be4/graph/pull.go (L94-L97)

And related to "v2" registries;
88fdcfef02

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-27 15:00:39 +01:00
Rob Murray
0ab6f07c31 Fix TestPassthrough
Doesn't look like it would ever have worked, but:
- init the dbus connection to avoid a segv
- include the chain name when creating the rule
- remove the test rule if it's created

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-03-27 12:15:16 +00:00
Rob Murray
2d643b6835 Firewalld: skip unit tests that run in their own netns
Firewalld runs in the host netns. So, tests running in
their own netns can't check firewalld's iptables rules.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-03-27 12:14:20 +00:00
Rob Murray
4fbfb618c3 Skip flaky part of TestAccessPublishedPortFromHost
With firewalld enabled in CI, TestAccessPublishedPortFromHost/userland-proxy=true/IPv6=true
consistently fails when trying to use a link-local address on
eth0 (it's ok for the ULL added by the test).

In a local moby dev container, it passes - although it sometimes
fails when making its request to the host's ::1.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-03-27 08:36:09 +00:00
Rob Murray
b8323abe0a TestIsolated for IPv6 is broken under firewalld
Skip the test for now.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-03-27 08:36:09 +00:00
Rob Murray
86eff82789 Firewalld: Skip tests that run dockerd in an L3Segment
The daemon runs in a separate netns, but when it wants to create
an iptables rule it sends a dbus message to firewalld - which is
running in the host's netns.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-03-27 08:36:09 +00:00
Rob Murray
dc963a00c1 Firewalld should use its nftables backend
Since commit cfc049c the dev container has been using iptables-nft,
but the Dockerfile configured firewalld to use its iptables backend
(if firewalld is enabled, which it accidentally hasn't been in CI).

The integration tests run ok for a while, then some things start
failing with the less than obvious message:

  Error: COMMAND_FAILED: UNKNOWN_ERROR: nonexistent or underflow of priority count

So, let firewalld use its default nftables backend.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-03-27 08:36:09 +00:00
Rob Murray
b8cacdf324 Add test util "FirewalldRunning"
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-03-27 08:36:09 +00:00
Rob Murray
cea56c1d9c Merge pull request #49671 from robmry/unit_test_with_firewalld
Run systemd/rootless when systemd/rootless unit testing
2025-03-27 08:34:31 +00:00
Sebastiaan van Stijn
6de8ba3bc5 Merge pull request #49688 from thaJeztah/disable_go_telemetry
Dockerfile: disable saving Golang telemetry in dev-container
2025-03-26 17:25:34 +01:00
Jonathan A. Sternberg
8f506a51e5 containerd: ensure overwritten images from load are left dangling
During a load, ensure any existing images are left as dangling images.
This affects the `docker load` command with the containerd snapshotter
backend.

Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com>
2025-03-26 09:20:46 -05:00
Paweł Gronowski
264fc2fac8 Merge pull request #49705 from robmry/continue_if_bridge_port_down
Start containers, even when connected to a disabled bridge port
2025-03-26 13:08:03 +00:00
Paweł Gronowski
849c723078 Merge pull request #46941 from thaJeztah/govalidator
implement module compatibility check
2025-03-26 12:52:10 +00:00
Paweł Gronowski
82b25f0947 Merge pull request #49704 from thaJeztah/bump_image_spec
vendor: github.com/opencontainers/image-spec v1.1.1
2025-03-26 12:44:27 +00:00
Rob Murray
7b2e47846c Run systemd/rootless when systemd/rootless unit testing
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-03-26 12:13:18 +00:00
Paweł Gronowski
8d9e3502ab hack: Fix TestOverlay* test failure in pkg/archive
The pkg/archive/archive_linux_test.go tests create a test archive
content in a temporary directory. This also includes device nodes (using
mknod).
Running these tests in Docker-in-Docker (dind) with systemd was failing
with "operation not permitted" because the rootfs is remounted with
`nodev`.

This change aligns `hack/dind-systemd` with `hack/dind` by
conditionally mounting a `tmpfs` on `/tmp` (with dev enabled),
to make the mknod work.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-03-26 12:11:44 +00:00
Paweł Gronowski
fbe2330989 Merge pull request #49693 from vvoland/ifc-to-any
Update `interface{}` to `any`
2025-03-26 11:54:35 +00:00
Rob Murray
f5d84a45cc Start containers, even when connected to a disabled bridge port
Commit 9a6e96f ("Before sending ARPs/NAs, check the bridge is ready")
introduced a check that, if a container's veth is connected to a bridge,
the port is forwarding before sending unsolicited ARP/NA messages to
advertise the container's MAC/IP addresses.

It waited for up-to 200ms, but it seems that's not always enough.

If the port isn't forwarding, the ARP/NA messages will be silently
dropped. But, if it comes up within two seconds, one or both of the
resends will succeed.

So - keep the wait for 200ms but, if anything goes wrong with checking
the bridge port's state, or it's not forwarding after that time, just
log an info/warning level message and continue.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-03-26 11:46:38 +00:00
Sebastiaan van Stijn
072ea62fcc vendor: github.com/opencontainers/image-spec v1.1.1
full diff: https://github.com/opencontainers/image-spec/compare/v1.1.0...v1.1.1

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-26 10:01:40 +01:00
Sebastiaan van Stijn
454a7a7358 Merge pull request #49678 from vvoland/c8d-events-tag
c8d/builder: Fix missing `image tag` event with BuildKit
2025-03-25 20:36:26 +01:00
Paweł Gronowski
a60603bfa3 hack/validate: Add gocompat
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-03-25 16:10:42 +01:00
Sebastiaan van Stijn
2be7f48561 implement module compatibility check
This package imports all "importable" packages, i.e., packages that:

- are not applications ("main")
- are not internal
- and that have non-test go-files

We do this to verify that our code can be consumed as a dependency
in "module mode". When using a dependency that does not have a go.mod
(i.e.; is not a "module"), go implicitly generates a go.mod. Lacking
information from the dependency itself, it assumes "go1.16" language
(see [DefaultGoModVersion]). Starting with Go1.21, go downgrades the
language version used for such dependencies, which means that any
language feature used that is not supported by go1.16 results in a
compile error;

    # github.com/docker/cli/cli/context/store
    /go/pkg/mod/github.com/docker/cli@v25.0.0-beta.2+incompatible/cli/context/store/storeconfig.go:6:24: predeclared any requires go1.18 or later (-lang was set to go1.16; check go.mod)
    /go/pkg/mod/github.com/docker/cli@v25.0.0-beta.2+incompatible/cli/context/store/store.go:74:12: predeclared any requires go1.18 or later (-lang was set to go1.16; check go.mod)

These errors do NOT occur when using GOPATH mode, nor do they occur
when using "pseudo module mode" (the "-mod=mod -modfile=vendor.mod"
approach used in this repository).

As a workaround for this situation, we must include "//go:build" comments
in any file that uses newer go-language features (such as the "any" type
or the "min()", "max()" builtins).

From the go toolchain docs (https://go.dev/doc/toolchain):

> The go line for each module sets the language version the compiler enforces
> when compiling packages in that module. The language version can be changed
> on a per-file basis by using a build constraint.
>
> For example, a module containing code that uses the Go 1.21 language version
> should have a go.mod file with a go line such as go 1.21 or go 1.21.3.
> If a specific source file should be compiled only when using a newer Go
> toolchain, adding //go:build go1.22 to that source file both ensures that
> only Go 1.22 and newer toolchains will compile the file and also changes
> the language version in that file to Go 1.22.

This file is a generated module that imports all packages provided in
the repository, which replicates an external consumer using our code
as a dependency in go-module mode, and verifies all files in those
packages have the correct "//go:build <go language version>" set.

To test this package:

    make -C ./internal/gocompat/
    GO111MODULE=off go generate .
    go mod tidy
    go test -v
    # github.com/docker/docker/libnetwork/options
    ../../libnetwork/options/options.go:45:25: predeclared any requires go1.18 or later (-lang was set to go1.16; check go.mod)
    # github.com/docker/docker/libnetwork/internal/setmatrix
    ../../libnetwork/internal/setmatrix/setmatrix.go:13:16: type parameter requires go1.18 or later (-lang was set to go1.16; check go.mod)
    ../../libnetwork/internal/setmatrix/setmatrix.go:13:18: predeclared comparable requires go1.18 or later (-lang was set to go1.16; check go.mod)
    ../../libnetwork/internal/setmatrix/setmatrix.go:14:20: type instantiation requires go1.18 or later (-lang was set to go1.16; check go.mod)
    ../../libnetwork/internal/setmatrix/setmatrix.go:20:10: type instantiation requires go1.18 or later (-lang was set to go1.16; check go.mod)
    ../../libnetwork/internal/setmatrix/setmatrix.go:31:10: type instantiation requires go1.18 or later (-lang was set to go1.16; check go.mod)
    ../../libnetwork/internal/setmatrix/setmatrix.go:43:10: type instantiation requires go1.18 or later (-lang was set to go1.16; check go.mod)
    ../../libnetwork/internal/setmatrix/setmatrix.go:59:10: type instantiation requires go1.18 or later (-lang was set to go1.16; check go.mod)
    ../../libnetwork/internal/setmatrix/setmatrix.go:80:10: type instantiation requires go1.18 or later (-lang was set to go1.16; check go.mod)
    ../../libnetwork/internal/setmatrix/setmatrix.go:93:10: type instantiation requires go1.18 or later (-lang was set to go1.16; check go.mod)
    ../../libnetwork/internal/setmatrix/setmatrix.go:104:10: type instantiation requires go1.18 or later (-lang was set to go1.16; check go.mod)
    ../../libnetwork/internal/setmatrix/setmatrix.go:104:10: too many errors
    # github.com/docker/docker/libnetwork/config
    ../../libnetwork/config/config.go:35:47: predeclared any requires go1.18 or later (-lang was set to go1.16; check go.mod)
    ../../libnetwork/config/config.go:47:41: predeclared any requires go1.18 or later (-lang was set to go1.16; check go.mod)
    ../../libnetwork/config/config.go:63:55: predeclared any requires go1.18 or later (-lang was set to go1.16; check go.mod)
    ../../libnetwork/config/config.go:95:63: predeclared any requires go1.18 or later (-lang was set to go1.16; check go.mod)
    # github.com/docker/docker/testutil
    ../../testutil/helpers.go:80:9: predeclared any requires go1.18 or later (-lang was set to go1.16; check go.mod)
    # github.com/docker/docker/builder/builder-next/adapters/containerimage
    ../../builder/builder-next/adapters/containerimage/pull.go:72:4: type instantiation requires go1.18 or later (-lang was set to go1.16; check go.mod)
    ../../builder/builder-next/adapters/containerimage/pull.go:200:19: type instantiation requires go1.18 or later (-lang was set to go1.16; check go.mod)
    FAIL	gocompat [build failed]
    make: *** [Makefile:5: verify] Error 1

[DefaultGoModVersion]: 58c28ba286/src/cmd/go/internal/gover/version.go (L15-L24)
[2]: https://go.dev/doc/toolchain

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-03-25 16:10:42 +01:00
Sebastiaan van Stijn
6430e49a55 Merge pull request #49700 from vvoland/missing-buildtags
Add missing go1.22 build constraints
2025-03-25 14:53:08 +01:00
Paweł Gronowski
cc90726fb8 Add missing go1.22 build constraints
Some recent changes used a newer Go features.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-03-25 13:45:47 +01:00
Paweł Gronowski
19a0f886da testutil: Update to any from interface{}
Only files that have go build version enforcing tag

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-03-25 13:42:53 +01:00
Paweł Gronowski
f14c23a90f libnetwork: Update to any from interface{}
Only files that have go build version enforcing tag

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-03-25 13:42:51 +01:00
Paweł Gronowski
82ec984d10 daemon: Update to any from interface{}
Only files that have go build version enforcing tag

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-03-25 13:38:28 +01:00
Paweł Gronowski
003bf197d7 container: Update to any from interface{}
Only files that have go build version enforcing tag

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-03-25 13:38:24 +01:00
Paweł Gronowski
444a1597ff c8d/builder: Fix missing image tag event with BuildKit
The builder `Named` callback was not called with the containerd image
store integration enabled and BuildKit due to wrong imageexporter output
key being used.

We have a test `TestBuildEmitsEvents` that should have detected the bug,
but it wasn't actually working because the CLI version used in the
`integration-cli` didn't support BuildKit yet.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-03-25 12:02:52 +01:00
Sebastiaan van Stijn
330857ad0f Merge pull request #49698 from jsternberg/buildkit-0.20.2
vendor: github.com/moby/buildkit v0.20.2
2025-03-25 01:30:05 +01:00
Jonathan A. Sternberg
2fce935df2 vendor: github.com/moby/buildkit v0.20.2
Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com>
2025-03-24 15:53:53 -05:00
Akihiro Suda
ecb03c4cda Merge pull request #49691 from thaJeztah/bump_selinux
vendor: github.com/opencontainers/selinux v1.12.0
2025-03-24 20:18:38 +09:00
Akihiro Suda
accda3119d Merge pull request #49562 from thaJeztah/switch_cgroups
switch to github.com/opencontainers/cgroups
2025-03-24 20:08:41 +09:00
Paweł Gronowski
7c09e4e607 TestBuildEmitsEvents: Skip Windows only for buildkit
The test was always skipped on Windows, regardless if buildkit is used
or not.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-03-24 11:55:30 +01:00
Paweł Gronowski
99356b6e17 integration-cli/TestBuildEmitsEvents: Verify event count
Make sure that the events are not sent twice

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-03-24 11:55:28 +01:00
Paweł Gronowski
6a0f71cac9 Merge pull request #49686 from thaJeztah/attach_nits
daemon, api/router: minor cleanups in attach and logging code
2025-03-24 10:53:47 +00:00
Paweł Gronowski
e2011affd4 Merge pull request #49692 from thaJeztah/rm_aliases
remove some redundant import-aliases
2025-03-24 10:37:55 +00:00
Sebastiaan van Stijn
3e957c6240 remove some redundant import-aliases
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-24 00:43:31 +01:00
Sebastiaan van Stijn
4db84b197d switch to github.com/opencontainers/cgroups
The runc libcontainer/cgroups package was moved to a separate
module; switch our use of the runc module to use the new
location.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-24 00:36:25 +01:00
Sebastiaan van Stijn
697956a8c7 vendor: github.com/opencontainers/selinux v1.12.0
This release removes deprecated functions from the `label` package,
and improves documentation and error reporting of `SetCreateKey`.

Relevant changes:

-label: remove deprecated stuff
-Improve SetKeyCreate error reporting

full diff: https://github.com/opencontainers/selinux/compare/v1.11.1...v1.12.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-24 00:30:46 +01:00
Akihiro Suda
c1cd4e5eb4 Merge pull request #49683 from thaJeztah/vendor_ebpf
vendor: github.com/cilium/ebpf v0.17.3
2025-03-24 08:27:46 +09:00
Akihiro Suda
f6a642f588 Merge pull request #49689 from thaJeztah/dockerfile_update_registry
Dockerfile: update registry to v3.0.0-rc.4
2025-03-24 08:27:12 +09:00
Akihiro Suda
69a307600d Merge pull request #49690 from thaJeztah/bump_jwt
vendor: github.com/golang-jwt/jwt/v5 v5.2.2
2025-03-24 08:26:49 +09:00
Sebastiaan van Stijn
34bc972519 vendor: github.com/golang-jwt/jwt/v5 v5.2.2
Fixes [GHSA-mh63-6h87-95cp] / [CVE-2025-30204]

full diff: https://github.com/golang-jwt/jwt/compare/v5.2.1...v5.2.2

[GHSA-mh63-6h87-95cp]: https://github.com/golang-jwt/jwt/security/advisories/GHSA-mh63-6h87-95cp
[CVE-2025-30204]: https://www.cve.org/CVERecord?id=CVE-2025-30204

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-23 17:34:42 +01:00
Akihiro Suda
06e319e210 Merge pull request #49687 from thaJeztah/update_delve
Dockerfile: upgrade Delve to v1.24.1
2025-03-24 00:22:41 +09:00
Akihiro Suda
108d7d1004 Merge pull request #49681 from thaJeztah/vendor_runc
vendor: github.com/opencontainers/runc v1.2.6
2025-03-24 00:21:49 +09:00
Sebastiaan van Stijn
c02ca31fbc Merge pull request #49675 from AkihiroSuda/dockerfile-simple
Dockerfile.simple: avoid `Could not find installer for "proxy"`
2025-03-23 15:01:37 +01:00
Sebastiaan van Stijn
d01ee23c15 Dockerfile: update registry to v3.0.0-rc.4
release notes: https://github.com/distribution/distribution/releases/tag/v3.0.0-rc.4
full diff: https://github.com/distribution/distribution/compare/v3.0.0-rc.1...v3.0.0-rc.4

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-23 14:57:19 +01:00
Sebastiaan van Stijn
081987b647 Dockerfile: disable saving Golang telemetry in dev-container
Disable collecting local telemetry, as collected by Go and Delve;

- https://github.com/go-delve/delve/blob/v1.24.1/CHANGELOG.md#1231-2024-09-23
- https://go.dev/doc/telemetry#background

Telemetry is only collected, and not sent by default, so let's skip producing
it in the first place, as the dev-container is an ephemeral environment, and
this telemetry is not used.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-23 14:46:25 +01:00
Sebastiaan van Stijn
af14f3e7d3 Dockerfile: upgrade Delve to v1.24.1
Update to the latest version:

- https://github.com/go-delve/delve/releases/tag/v1.24.1
- https://github.com/go-delve/delve/blob/v1.24.1/CHANGELOG.md#1241-2025-03-05

Also update links to supported platforms. Delve v1.21.1 and higher now supports
linux/ppc64le (added in [delve@71f1220]), but this looks to be gated behind
an experimental build-tag. We could consider enabling this tag, but skipping
that for now.

[delve@71f1220]: 71f1220717

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-23 14:29:28 +01:00
Sebastiaan van Stijn
d0b4bdbd25 api/router: postContainersAttach, wsContainersAttach: minor cleanups
- remove intermediate variables that were only used once
- move variables closer to where used

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-23 13:29:28 +01:00
Sebastiaan van Stijn
73aa7e933c daemon: daemon.containerAttach: use structured logs
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-23 13:29:27 +01:00
Sebastiaan van Stijn
d494520aa0 daemon: daemon.ContainerAttach: use Println instead of Printf
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-23 13:21:23 +01:00
Sebastiaan van Stijn
183ca46099 daemon: daemon.ContainerLogs: move vars closer to where used
- remove intermediate variable that was only used once
- move "follow" variable to where it's used; keeping an intermediate
  variable for now, as the logic related to "follow" and "created"
  could use some comment / documentation.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-23 13:11:39 +01:00
Sebastiaan van Stijn
c164eec7e9 daemon: daemon.ContainerAttach: move vars closer to where used
- remove intermediate err vars
- move "multiplexed" variable closer to where used

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-23 13:11:39 +01:00
Sebastiaan van Stijn
f7853799fc daemon: daemon.containerAttach: remove redundant defers
Both these defers were defined in the closure, and would be executed
at the end of the goroutine; inline them to prevent them being confused
for being executed after the function starting the goroutine.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-23 13:11:39 +01:00
Sebastiaan van Stijn
80bf93c9d7 daemon: daemon.containerAttach: rename vars for clarity and prevent shadow
- rename var that shadowed argument
- use consistent name for container arg; We use `ctr` as short name in most
  places; use the same name to make the code slightly more readable.
- rename "logs" argument to prevent it being confused with a logs import
  and to more clearly indicate its a bool

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-23 13:11:29 +01:00
Akihiro Suda
e1e6d35277 Merge pull request #49682 from thaJeztah/bump_runc_binary_1.2.6
Dockerfile: update runc binary to v1.2.6
2025-03-22 03:21:17 +09:00
Sebastiaan van Stijn
daeb6fb0b7 vendor: github.com/cilium/ebpf v0.17.3
full diff: https://github.com/cilium/ebpf/compare/v0.16.0...v0.17.3

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-21 17:02:01 +01:00
Sebastiaan van Stijn
eeee17eaad Dockerfile: update runc binary to v1.2.6
This is the sixth patch release in the 1.2.z series of runc.
It primarily fixes an issue with runc exec vs time namespace,
and a compatibility issue with older kernels.

* Fix a stall issue that would happen if setting `O_CLOEXEC` with
  `CloseExecFrom` failed.
* `runc` now properly handles joining time namespaces (such as with
  `runc exec`). Previously we would attempt to set the time offsets
  when joining, which would fail.
* Handle `EINTR` retries correctly for socket-related direct
  `golang.org/x/sys/unix` system calls.
* We no longer use `F_SEAL_FUTURE_WRITE` when sealing the runc binary, as it
  turns out this had some unfortunate bugs in older kernel versions and was
  never necessary in the first place.
* Remove `Fexecve` helper from `libcontainer/system`. Runc 1.2.1 removed
  runc-dmz, but we forgot to remove this helper added only for that.
* Use Go 1.23 for official builds, run CI with Go 1.24 and drop Ubuntu 20.04
  from CI. We need to drop Ubuntu 20.04 from CI because Github Actions
  announced it's already deprecated and it will be discontinued soon.

full diff: https://github.com/opencontainers/runc/compare/v1.2.5...v1.2.6

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-21 16:54:24 +01:00
Sebastiaan van Stijn
c1c5f16b8b vendor: github.com/opencontainers/runc v1.2.6
This is the sixth patch release in the 1.2.z series of runc.
It primarily fixes an issue with runc exec vs time namespace,
and a compatibility issue with older kernels.

* Fix a stall issue that would happen if setting `O_CLOEXEC` with
  `CloseExecFrom` failed.
* `runc` now properly handles joining time namespaces (such as with
  `runc exec`). Previously we would attempt to set the time offsets
  when joining, which would fail.
* Handle `EINTR` retries correctly for socket-related direct
  `golang.org/x/sys/unix` system calls.
* We no longer use `F_SEAL_FUTURE_WRITE` when sealing the runc binary, as it
  turns out this had some unfortunate bugs in older kernel versions and was
  never necessary in the first place.
* Remove `Fexecve` helper from `libcontainer/system`. Runc 1.2.1 removed
  runc-dmz, but we forgot to remove this helper added only for that.
* Use Go 1.23 for official builds, run CI with Go 1.24 and drop Ubuntu 20.04
  from CI. We need to drop Ubuntu 20.04 from CI because Github Actions
  announced it's already deprecated and it will be discontinued soon.

full diff: https://github.com/opencontainers/runc/compare/v1.2.5...v1.2.6

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-21 16:49:42 +01:00
Sebastiaan van Stijn
be6e92a57b pkg/atomicwriter: use sequential file access on Windows
Using sequential file access ([FILE_FLAG_SEQUENTIAL_SCAN]) prevents
Windows from aggressively keeping files in the cache, freeing up system
memory for other tasks. On Linux, these changes have no effect, as the
sequential package use the standard (os.CreateTemp, os.OpenFile) on
non-Windows platforms. Refer to the [Win32 API documentation] for details
on sequential file access.

[Win32 API documentation]: https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-createfilea#FILE_FLAG_SEQUENTIAL_SCAN
[FILE_FLAG_SEQUENTIAL_SCAN]: https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-createfilea#FILE_FLAG_SEQUENTIAL_SCAN

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-21 16:39:28 +01:00
Akihiro Suda
ef56b83597 Merge pull request #49670 from thaJeztah/integration_cli_fixes
integration-cli: minor fixes
2025-03-21 23:48:45 +09:00
Akihiro Suda
452ff75159 Dockerfile.simple: avoid Could not find installer for "proxy"
`Could not find installer for "proxy"` error had been ignored
due to lack of `set -e`

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2025-03-21 06:35:49 +09:00
Jonathan A. Sternberg
fa21996da5 containerd: prioritize non-dangling images with image list
When listing images, prioritize the tagged version. When computing the
unique images, the last returned image would be used as a base and repo
tags would be merged into it.

This makes it so `RepoDigests` has the correct value when there is both
a dangling and non-dangling version of the same image.

Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com>
2025-03-20 14:59:33 -05:00
Sebastiaan van Stijn
126d4cf672 client: remove version-gate for JSON response errors
JSON errors were introduced in API 1.24, and daemons running older versions of
the API would return errors as plain-text. However, such API versions would
also send the corresponding content-type header (text/plain), so we don't
really need to make the code version-dependent; there's already fallbacks
in place to handle JSON-responses that don't use the expected format, in
which case we produce a generic status-code error.

Before this patch, the client would print JSON-responses as-is when the
daemon returned an "API version too old" error;

    DOCKER_API_VERSION=v1.10 docker info --format '{{.ID}}'
    Error response from daemon: {"message":"client version 1.10 is too old. Minimum supported API version is 1.24, please upgrade your client to a newer version"}

With this patch, the client detects that the response is JSON, and prints
a friendlier error-message to help the user discover their client is too
old;

    DOCKER_API_VERSION=v1.10 docker info --format '{{.ID}}'
    Error response from daemon: client version 1.10 is too old. Minimum supported API version is 1.24, please upgrade your client to a newer version

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-20 20:25:11 +01:00
Sebastiaan van Stijn
230f178f8b api: return plain-text errors for deprecated API versions
Docker 25.0 (08e4e88482) deprecated API versions
older than v1.24, and support was removed in Docker 26.0.

As part of this deprecation, support for plain-text errors was also removed
in commit ffd877f948.

So while we no longer support API versions older 1.24 [api.MinSupportedAPIVersion],
a client may try to connect using an older version and expect a plain-text error
instead of a JSON error. This would result in an "API version too old" error
formatted in JSON being printed as-is.

    DOCKER_API_VERSION=v1.10 docker info --format '{{.ID}}'
    Error response from daemon: {"message":"client version 1.10 is too old. Minimum supported API version is 1.24, please upgrade your client to a newer version"}

    curl --unix-socket /var/run/docker.sock http://localhost/v1.10/info
    {"message":"client version 1.10 is too old. Minimum supported API version is 1.24, please upgrade your client to a newer version"}

Note that this was only a problem for old API versions; unsupported API versions
that were higher than the maximum version were already handled as JSON;

    DOCKER_API_VERSION=v1.99 docker info --format '{{.ID}}'
    Error response from daemon: client version 1.99 is too new. Maximum supported API version is 1.48

    curl --unix-socket /var/run/docker.sock http://localhost/v1.99/info
    {"message":"client version 1.99 is too new. Maximum supported API version is 1.48"}

Let's be nice, and return errors in plain-text to provide a more readable error
to help the user understand the API version they're using is no longer supported.

With this patch applied:

    DOCKER_API_VERSION=v1.10 docker info --format '{{.ID}}'
    Error response from daemon: client version 1.10 is too old. Minimum supported API version is 1.24, please upgrade your client to a newer version

    curl --unix-socket /var/run/docker.sock http://localhost/v1.10/info
    client version 1.10 is too old. Minimum supported API version is 1.24, please upgrade your client to a newer version

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-20 20:25:05 +01:00
Sebastiaan van Stijn
c7fbe1c2ba integration-cli: fix duplicate close of body
request.ReadBody already closes the body;

    time="2025-03-20T19:08:25Z" level=error msg="subsequent attempt to close ReadCloserWrapper"

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-20 20:20:22 +01:00
Sebastiaan van Stijn
1c00755826 integration-cli: fix some unhandled errors
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-20 20:20:22 +01:00
Sebastiaan van Stijn
7b964974e7 Merge pull request #49619 from thaJeztah/atomicwriter_validate
pkg/atomicwriter: fix tempfiles cleanup, improve tests, and validate destination path
2025-03-20 18:24:42 +01:00
Paweł Gronowski
e4079dbbf1 Merge pull request #49660 from thaJeztah/journald_noshadow
daemon/logger/journald: rename func that shadowed builtin
2025-03-20 15:49:03 +00:00
Paweł Gronowski
770200d154 Merge pull request #49648 from robmry/combine_bridge_firewalld_reload_calls
Combine bridge firewalld reload calls
2025-03-20 15:42:51 +00:00
Sebastiaan van Stijn
8be5696c37 daemon/logger/journald: rename func that shadowed builtin
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-19 12:02:59 +01:00
Paweł Gronowski
bea4de2500 Merge pull request #49656 from austinvazquez/bump-container-1.7.27-binary
Dockerfile: update containerd binary to v1.7.27
2025-03-18 18:44:02 +00:00
Paweł Gronowski
97ee08e1fa Merge pull request #49657 from akerouanton/fix-missing-port-mappings
daemon: return port-mappings from all endpoints
2025-03-18 18:43:32 +00:00
Albin Kerouanton
f2a183a991 daemon: return port-mappings from all endpoints
With improved IPv6 support, a dual-stack container can map a port using
two different networks -- one IPv4-only, the other IPv6-only.

The daemon was updating containers' `EndpointSettings.Ports` by looking
for the first network providing port-mappings. This was incorrect.

Instead, iterate over the whole list of endpoints, and merge everything
together.

The function doing that, ie. `getEndpointPortMapInfo`, is also
considered exposed ports, and nil the PortMap entry if an exposed port
is found. However, exposed ports are always set on a bridge network, so
this was erasing port-mappings found for other networks.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-03-18 18:08:39 +01:00
Albin Kerouanton
6b3b479192 daemon: getEndpointPortMapInfo: err is never used
Instead, log the error returned by `nat.NewPort` and move on to the
next port mapping / exposed port.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-03-18 18:08:20 +01:00
Austin Vazquez
35766af7d2 Dockerfile: update containerd binary to v1.7.27
Signed-off-by: Austin Vazquez <macedonv@amazon.com>
2025-03-18 15:07:33 +00:00
Sebastiaan van Stijn
b2363f0363 Merge pull request #49602 from thaJeztah/remove_layerstore_experimental
layer: remove StoreOptions.ExperimentalEnabled
2025-03-18 14:23:21 +01:00
Albin Kerouanton
c9a763ecc9 daemon: remove redundant call to getEndpointPortMapInfo
The function `getEndpointPortMapInfo` is called by `updateJoinInfo` to
update the field `NetworkSettings.Ports` of a container.

However, `updateJoinInfo` is only called by `connectToNetwork` which is
also calling `getPortMapInfo` (which in turn calls
`getEndpointPortMapInfo`).

So, remove the call to `getEndpointPortMapInfo` from `updateJoinInfo`.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-03-18 12:43:37 +01:00
Sebastiaan van Stijn
2043aa92da Merge pull request #49652 from vvoland/vendor-containerd
vendor: github.com/containerd/containerd/v2 v2.0.4
2025-03-18 12:12:46 +01:00
Albin Kerouanton
7cdd1b5d15 Merge pull request #49649 from akerouanton/proxy-concurrent-write-close
cmd/docker-proxy: UDP: fix race & aggressive GC
2025-03-18 08:34:09 +01:00
Paweł Gronowski
fb3cce1988 vendor: github.com/containerd/containerd/v2 v2.0.4
full diff: https://github.com/containerd/containerd/v2/compare/v2.0.3...v2.0.4

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-03-17 19:05:57 +01:00
Albin Kerouanton
4276f330fc cmd/docker-proxy: do not eagerly GC one-sided UDP conns
The UDP proxy is setting a deadline of 90 seconds when reading from the
backend. If no data is received within this interval, it reclaims the
connection.

This means, the backend would see a different connection every 90
seconds if the backend never sends back any reply to a client.

This change prevents the proxy from eagerly GC'ing such connections by
taking into account the last time a datagram was proxyed to the backend.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-03-17 17:51:50 +01:00
Albin Kerouanton
0356854327 cmd/docker-proxy: make the conntrack timeout a property of UDPProxy
Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-03-17 17:50:38 +01:00
Albin Kerouanton
d70fd32a18 cmd/docker-proxy: UDP: thread-safe Write and Close
The UDP proxy used by cmd/docker-proxy is executing Write and Close in
two separate goroutines, such that a Close could interrupt an in-flight
Write.

Introduce a `connTrackEntry` that wraps a `net.Conn` and a `sync.Mutex`
to ensure that Write and Close are serialized.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-03-17 17:50:38 +01:00
Rob Murray
485cb90b77 Remove duplicate iptables-enabled checks
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-03-17 10:31:11 +00:00
Rob Murray
fce915897c Combine firewalld reload callbacks for IPv4/IPv6
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-03-17 10:30:45 +00:00
Paweł Gronowski
3e1b15dc97 Merge pull request #49618 from vvoland/container-wait-deflake
integration/container: Deflake TestWaitBlocked and TestWaitRestartedContainer
2025-03-14 13:32:05 +00:00
Paweł Gronowski
ac34bd9bda integration/container: Remove Parallel from TestWait*
It seems to help with the flakiness in the CI.
However, I can't reproduce the flakiness locally.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-03-13 18:09:32 +01:00
Paweł Gronowski
dd7f9f08d8 integration/container: Increase stop timeout for TestWaitRestartedContainer
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-03-13 18:09:29 +01:00
Rob Murray
97c397112a Merge pull request #49560 from ctalledo/mask-thermal-interrupt-info
Mask Linux thermal interrupt info in /proc and /sys.
2025-03-13 15:16:34 +00:00
Albin Kerouanton
d2ad7c36dc Merge pull request #49577 from robmry/routed_no_skip_dnat
Don't skip DNAT for a routed network without userland-proxy
2025-03-13 13:28:26 +01:00
Albin Kerouanton
d1ecb3b828 Merge pull request #49630 from robmry/macvlan_parent_down
Allow macvlan endpoint to start with parent down
2025-03-13 13:12:27 +01:00
Albin Kerouanton
4ff19b21dc Merge pull request #49621 from robmry/skip_raw_rules
Add an opt-out for iptables 'raw' rules
2025-03-13 12:10:21 +01:00
Paweł Gronowski
8701ff684f Merge pull request #49553 from thaJeztah/bump_containerd_1.7.26
Dockerfile: update containerd binary to v1.7.26
2025-03-12 18:29:55 +00:00
Paweł Gronowski
64b72a8db1 Merge pull request #49365 from ctalledo/47581-fix
Improve performance of daemon.Containers()
2025-03-12 18:28:55 +00:00
Sebastiaan van Stijn
a8f14e06d6 Improve performance of daemon.Containers().
Improve performance of function daemon.Containers() (used by docker ps) to
mitigate a latency increase when running large number of containers using the
containerd image store.

We do this by refactoring daemon.Containers() to collect info for containers in
parallel, rather than sequentially, using up to log2(N) worker threads. This
improves the performance from O(N) to O(log2(N)), where N is the number of
containers.

To verify correctness, this commits adds unit and integration tests.

Signed-off-by: Cesar Talledo <cesar.talledo@docker.com>
2025-03-12 09:59:52 -07:00
Sebastiaan van Stijn
ca00f9eacf Merge pull request #49603 from vvoland/daemon-containerd-timeout
daemon: Fix giving up too early while connecting to containerd socket
2025-03-11 22:42:29 +01:00
Paweł Gronowski
03349f2dde Merge pull request #49626 from vvoland/windows-fix-panic
daemon: Fix panic on Windows when restoring pre v28 container
2025-03-11 14:38:32 +00:00
Rob Murray
c0ca783edb Allow macvlan endpoint to start with parent down
When a macvlan's parent interface is down it's not possible
to send NA messages. So, ignore the error.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-03-11 14:35:19 +00:00
Paweł Gronowski
26fea35942 daemon: Fix panic on Windows when restoring pre v28 container
The container platform migration tries to deduce the platform data from
the containerd content store if it's available.

However, on Windows we currently default to a non-containerd runtime
setup, so the containerd client is nil and accessing its content store
paniced:

```
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x0 pc=0x11b48e4]

goroutine 87 [running]:
github.com/containerd/containerd/v2/client.(*Client).ContentStore(0xc0003a0008?)
	/go/src/github.com/docker/docker/vendor/github.com/containerd/containerd/v2/client/client.go:645 +0x24
github.com/docker/docker/daemon.(*Daemon).load(0xc00026e488, {0xc000c13d40, 0x40})
	/go/src/github.com/docker/docker/daemon/container.go:84 +0x289
github.com/docker/docker/daemon.(*Daemon).restore.func1({0xc000c13d40, 0x40})
	/go/src/github.com/docker/docker/daemon/daemon.go:236 +0x207
created by github.com/docker/docker/daemon.(*Daemon).restore in goroutine 1
	/go/src/github.com/docker/docker/daemon/daemon.go:229 +0x1a7
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x0 pc=0x11b48e4]

goroutine 90 [running]:
github.com/containerd/containerd/v2/client.(*Client).ContentStore(0xc000313608?)
	/go/src/github.com/docker/docker/vendor/github.com/containerd/containerd/v2/client/client.go:645 +0x24
github.com/docker/docker/daemon.(*Daemon).load(0xc00026e488, {0xc000c13e00, 0x40})
	/go/src/github.com/docker/docker/daemon/container.go:84 +0x289
github.com/docker/docker/daemon.(*Daemon).restore.func1({0xc000c13e00, 0x40})
	/go/src/github.com/docker/docker/daemon/daemon.go:236 +0x207
created by github.com/docker/docker/daemon.(*Daemon).restore in goroutine 1
	/go/src/github.com/docker/docker/daemon/daemon.go:229 +0x1a7
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x0 pc=0x11b48e4]
```

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-03-11 12:25:42 +01:00
Paweł Gronowski
9352aacfbb Merge pull request #49623 from tonistiigi/fix-free-space-filter
builder-next: fix min-free-space prune with graphdriver backend
2025-03-11 10:11:37 +00:00
Rob Murray
e0f3d89d72 Merge pull request #49605 from br3ndonland/runconfig/errors/split-ErrConflictHostNetwork
runconfig/errors: split `ErrConflictHostNetwork`
2025-03-11 10:10:59 +00:00
Brendon Smith
90a83063ee runconfig/errors: split ErrConflictHostNetwork
Split the `ErrConflictHostNetwork` error into two distinct errors:

1. `ErrConflictConnectToHostNetwork` when attempting to change the
   network mode of a running container from a different mode to `host`
2. `ErrConflictDisconnectFromHostNetwork` when the network mode of a
   running container is `host` and attempting to disconnect from `host`

This commit clarifies error messaging by differentiating between the two
errors, making it clearer which operation failed and how to fix it.

Signed-off-by: Brendon Smith <bws@bws.bio>
2025-03-10 21:27:38 -04:00
Cesar Talledo
a3fef5debc Mask Linux thermal interrupt info in /proc and /sys.
On Linux, mask "/proc/interrupts" and "/sys/devices/system/cpu/cpu<x>/thermal_throttle"
inside containers by default. Privileged containers or containers started
with --security-opt="systempaths=unconfined" are not affected.

Mitigates potential Thermal Side-Channel Vulnerability Exploit
(https://github.com/moby/moby/security/advisories/GHSA-6fw5-f8r9-fgfm).

Also: improve integration test TestCreateWithCustomMaskedPaths() to ensure
default masked paths don't apply to privileged containers.

Signed-off-by: Cesar Talledo <cesar.talledo@docker.com>
2025-03-10 17:18:10 -07:00
Sebastiaan van Stijn
5f0d6731eb Merge pull request #49612 from thaJeztah/registry_deprecate_SetCertsDir
registry: deprecate SetCertsDir, HostCertsDir
2025-03-10 20:56:28 +01:00
Sebastiaan van Stijn
cc9eec6c31 Merge pull request #49610 from thaJeztah/dismantle_ParseRepositoryInfo_step2
registry: rewrite ParseRepositoryInfo to not depend on IndexInfo
2025-03-10 20:07:36 +01:00
Rob Murray
cf3e42abaf Add an opt-out for iptables 'raw' rules
For kernels that don't have CONFIG_IP_NF_RAW, if the env
var DOCKER_INSECURE_NO_IPTABLES_RAW is set to "1", don't
try to create raw rules.

This means direct routing to published ports is possible
from other hosts on the local network, even if the port
is published to a loopback address.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-03-10 18:32:49 +00:00
Sebastiaan van Stijn
0f11ee1ae2 registry: ReadCertsDirectory: don't process same file multiple times
This function needs more cleaning up, because hitting either a ".cert" or
a ".key" file means that we're doing an extra loop over all files to see
if the corresponding file is also present, but let's start with only
processing each file once by using a switch;

b4bdf12dae/registry/registry.go (L81)
b4bdf12dae/registry/registry.go (L94)
b4bdf12dae/registry/registry.go (L43-L50)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-10 19:13:22 +01:00
Sebastiaan van Stijn
dd7ab0e82b registry: deprecate HostCertsDir
This function was only used internally, but it still has at least one
external consumer, so adding a "deprecated" comment.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-10 19:12:55 +01:00
Sebastiaan van Stijn
3cc9881ab7 registry: always set a non-empty CertDir
[homedir.GetConfigHome] only returns an error if the value is empty,
so we can check for a non-empty value instead of an error, which also
means that this value would never be empty.

[homedir.GetConfigHome]: b4bdf12dae/pkg/homedir/homedir_linux.go (L86-L95)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-10 19:11:11 +01:00
Sebastiaan van Stijn
b633c4cc33 registry: deprecate SetCertsDir
This function had to be called both in the daemon startup, as well as
the CLI startup. Which, in case of the cli, meant that the registry
package became a required dependency for all CLI-plugins.

Make the package itself aware of situations where it's running with
rootlessKit enabled. Altogether we should get rid of this package-level
variable, and instead store this in our configuration, and pass through
where it's used.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-10 19:11:09 +01:00
Tonis Tiigi
d0dd035278 builder-next: fix min-free-space prune with graphdriver backend
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2025-03-10 10:47:26 -07:00
Sebastiaan van Stijn
a1c1340196 Merge pull request #49622 from robmry/check-config_ip_nf_raw
Include CONFIG_IP_NF_RAW and IP6 iptables modules in check-config
2025-03-10 18:26:24 +01:00
Sebastiaan van Stijn
1daeaec333 pkg/atomicwriter: validate destination path
- Disallow empty filenames
- Don't allow writing to a directory
- Return early if parent dir doesn't exist
- TBD: do we want to allow symlinks to be followed, or disallow?

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-10 18:23:02 +01:00
Rob Murray
4d8cff7bd4 Don't skip DNAT for a routed network without userland-proxy
If the userland-proxy is running, packets from one bridge network
addressed to the host port are not DNAT'd - so that docker-proxy
can pick them up, and therefore the packet bypasses the network
isolation rules.

Without the userland-proxy, there's no way for a packet from one
bridge network to bypass the network isolation rules. So, in this
case, DNAT is not skipped - and that at-least allows packets
originating from the network that published the port to access
the host port.

Commit 0546d90 improved support for routed mode networks (allowing
nat-mode networks access to containers in routed-mode networks, as
well as just remote access).

That commit changed the "SKIP DNAT" logic, making sure DNAT was
skipped for a routed-mode network if the userland-proxy was enabled
(so, containers in routed mode networks could access ports published
by other networks).

But, it still skipped DNAT for a routed mode network if the userland
proxy was disabled - packets from the routed mode network aimed at
any other network would be dropped by the network isolation rules
anyway, and containers in a routed mode network don't need access to
ports published from that network (because, by definition, there
can't be any).

However, network isolation rules can be worked-around with a rule
in the DOCKER-USER chain, but the SKIP DNAT rule is harder to deal
with.

So, for routed-mode, only skip DNAT if the userland-proxy is
enabled (just like nat-mode networks).

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-03-10 17:15:10 +00:00
Sebastiaan van Stijn
ece64ccdbd Merge pull request #45365 from vvoland/deduplicate-test-stop
integration: Deduplicate TestStopContainerWithTimeout
2025-03-10 18:12:50 +01:00
Sebastiaan van Stijn
93181d98ad Merge pull request #49614 from AkihiroSuda/rootlesskit
update RootlessKit to v2.3.4
2025-03-10 18:01:04 +01:00
Sebastiaan van Stijn
084b7cec1a pkg/atomicwriter: add additional test-cases
- test errors returned for non-existing destination
- test that files are cleaned up after
- test writing to a symlinked file (to be fixed)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-10 17:58:51 +01:00
Sebastiaan van Stijn
ff061e28c1 pkg/atomicwriter: don't overwrite destination on close without write
Creating a writer (`atomicwriter.New()`) and closing it without a write
ever happening, would replace the destination file with an empty file.

This patch adds a check whether a write was performed (either successful
or unsuccessful); if no write happened, we cleanup the tempfile without
replacing the destination file.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-10 17:58:46 +01:00
Sebastiaan van Stijn
88a5bca43c pkg/atomicwriter: add separate tests for New()
We were testing this function implicitly through `TestWriteFile`, but
not verifying the behavior of `New` in isolation. Add separate tests
for this function.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-10 17:58:11 +01:00
Sebastiaan van Stijn
09e804f570 pkg/atomicwriter: refactor tests
- rename tests to match the function tested
- remove init func in favor or a test-helper
- rename some vars to prevent shadowing
- update example values to be more descriptive
- add a utility for asserting file content and mode

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-10 17:57:17 +01:00
Paweł Gronowski
1a7b13d6c1 Merge pull request #49584 from vvoland/c8d-split-usage-calc
daemon/c8d: Refactor singlePlatformSize into separate functions
2025-03-10 16:40:08 +00:00
Sebastiaan van Stijn
68e4d31fc2 Merge pull request #49613 from thaJeztah/validate_mountopts
client: add API-version dependent validation for mount options
2025-03-10 17:16:02 +01:00
Paweł Gronowski
2124706447 integration: Increase timeouts in TestStopContainerWithTimeout
To reduce flakiness

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-03-10 17:04:33 +01:00
Paweł Gronowski
946bf70f89 integration: Deduplicate TestStopContainerWithTimeout
The test had 2 almost identical separate  implementations (Linux and
Windows). The Windows one was skipped anyway.
Make one test that covers all test cases.

The test still needs to be fixed for Windows, so don't unskip it yet.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-03-10 17:04:29 +01:00
Sebastiaan van Stijn
4341ce9ebb Merge pull request #49590 from vvoland/container-streams-err
container/stream: Don't log error when streams are properly closed
2025-03-10 15:35:00 +01:00
Paweł Gronowski
fee063f01e daemon/c8d: Refactor singlePlatformSize into separate functions
Split singlePlatformSize into a separate methods of the `ImageManifest`
that calculate the corresponding usage.

This also allows us to simplify a part of the `multiPlatformSummary`
because we don't calculate the content size twice now.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-03-10 14:48:47 +01:00
Rob Murray
f7d7fd9c52 contrib/check-config: add IPv6 modules
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-03-10 13:03:00 +00:00
Rob Murray
2a109e6c32 contrib/check-config: add ip_nf_raw
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-03-10 13:03:00 +00:00
Paweł Gronowski
c3c3eb2d09 Merge pull request #49607 from thaJeztah/atomicwriter_enhance
pkg/atomicwriter: New(): prevent creating temp-file on errors, and use absolute paths
2025-03-10 12:57:14 +00:00
Paweł Gronowski
be49e2f760 Merge pull request #49606 from thaJeztah/api_update_secrets_docs
api: improve docs for Secret and Config data fields
2025-03-10 12:54:46 +00:00
Akihiro Suda
0e54920e01 Dockerfile: update RootlessKit to v2.3.4
https://github.com/rootless-containers/rootlesskit/releases/tag/v2.3.3
https://github.com/rootless-containers/rootlesskit/releases/tag/v2.3.4

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2025-03-10 11:22:37 +09:00
Akihiro Suda
7ae9e41ff6 vendor: github.com/rootless-containers/rootlesskit/v2 v2.3.4
full diff: https://github.com/rootless-containers/rootlesskit/compare/v2.3.2...v2.3.4

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2025-03-10 11:22:04 +09:00
Akihiro Suda
55ff0062ca vendor: github.com/containernetworking/plugins v1.6.2
full diff: https://github.com/containernetworking/plugins/compare/v1.5.1...v1.6.2

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2025-03-10 10:15:36 +09:00
Akihiro Suda
125aa3a682 vendor: golang.org/x/sys v0.31.0
full diff: https://github.com/golang/sys/compare/v0.30.0...v0.31.0

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2025-03-10 10:14:45 +09:00
Sebastiaan van Stijn
5d6b56699d client: add API-version dependent validation for mount options
[docker/cli@fc6976d] added support for recursive readonly mounts in the
CLI, adding a ValidateMountWithAPIVersion utility to verify if options
used were supported by the API version.

We usually keep API-version dependent checks in the client, so that
docker/cli (and other users of the client) don't have to implement
their own validation for these.

This patch moves the functionality of ValidateMountWithAPIVersion to
the client.

Once the docker/cli vendoring was updated, we can remove the utility
there.

[docker/cli@fc6976d]: fc6976db45

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-09 22:03:00 +01:00
Sebastiaan van Stijn
aa33bdaa71 registry: move emptyServiceConfig to test-file
It's no longer used for anything other than in a test, so move
it local to that test.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-09 17:03:56 +01:00
Sebastiaan van Stijn
0823d76ec5 client: keep image refs in canonical format where possible
Using "familiarname" (e.g. "ubuntu") should be mostly done for presenting
image refernces to the user, but internally, we should use the canonical
format where possible ("docker.io/library/ubuntu").

There's still many places where we use the familiar (short) form, but
let's start with not converting references in the client.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-09 16:52:21 +01:00
Sebastiaan van Stijn
907773160b registry: rewrite ParseSearchIndexInfo to not depend on IndexInfo
This function was implemented to use various parts of the registry package
that were designed for the daemon code, which was written with the assumption
that it had registry-config available from the daemon's configuration.
However, `ParseSearchIndexInfo` is used by the client / CLI, which does
not have this information.

To work around this problem, the code used a dummy "emptyServiceConfig"
to allow the `Insecure` and `Mirrors` fields to be propagated based on
the same defaults as used by the daemon. The `Mirrors` field would always
be empty, as there are no default mirrors, and (lacking access to the
daemon's config) the `Insecure` field would always default to registries
running on a loopback address (`::1/128`, `127.0.0.1/8`). It's worth noting
that neither the `Mirrors`, nor the `Insecure` field is used by the CLI.

This patch rewrites `ParseSearchIndexInfo` to be self-contained, and not
depend on these constructs (and the `emptyServiceConfig`). For now, the
existing logic for `Insecure` is kept, but replaced by a simplified function
(`isInsecure`) with some optimizations for well-known loopback addresses
(`localhost`, `::1`, `127.0.0.1`) to prevent redundant DNS lookups or
parsing.

Note that similar changes should be made for [ParseRepositoryInfo], which
has a similar fate and is also only used by the client / CLI.

[ResolveRepositoryName]: 11e47996dc/registry/registry.go (L199-L222)
[ParseRepositoryInfo]: d86dd75948/registry/config.go (L375-L381)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-09 16:32:54 +01:00
Sebastiaan van Stijn
b22431ee9c pkg/atomicwriter: New(): use absolute path for temp-file
Use an absolute path for both the temp-file and the destination-file.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-09 15:00:00 +01:00
Sebastiaan van Stijn
58bd93a625 pkg/atomicwriter: New(): prevent creating temp-file on errors
The temp-file was created before trying to make the given filename an
absolute path. Reverse the order of code so that we don't create
a temp-file if an error happens.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-09 14:55:11 +01:00
Sebastiaan van Stijn
49c89b0177 docs/api: improve doc for Secret and Config data fields (API v1.31-v1.48)
Document the size constraints as defined by swarm;

- 500KB ([MaxSecretSize]) for secrets
- 1000KB ([MaxConfigSize]) for configs

[MaxSecretSize]: https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0-20250103191802-8c1959736554/api/validation#MaxSecretSize
[MaxConfigSize]: https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0-20250103191802-8c1959736554/manager/controlapi#MaxConfigSize

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-09 12:42:23 +01:00
Sebastiaan van Stijn
df0cefcc95 api/swagger: improve doc for Secret and Config data fields
Document the size constraints as defined by swarm;

- 500KB ([MaxSecretSize]) for secrets
- 1000KB ([MaxConfigSize]) for configs

[MaxSecretSize]: https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0-20250103191802-8c1959736554/api/validation#MaxSecretSize
[MaxConfigSize]: https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0-20250103191802-8c1959736554/manager/controlapi#MaxConfigSize

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-09 12:39:42 +01:00
Sebastiaan van Stijn
f2d53142b0 api/types/swarm: document Secret and Config data fields
Document the size constraints as defined by swarm;

- 500KB ([MaxSecretSize]) for secrets
- 1000KB ([MaxConfigSize]) for configs

[MaxSecretSize]: https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0-20250103191802-8c1959736554/api/validation#MaxSecretSize
[MaxConfigSize]: https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0-20250103191802-8c1959736554/manager/controlapi#MaxConfigSize

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-09 12:34:18 +01:00
Sebastiaan van Stijn
c2c3d593cf registry: rewrite ParseRepositoryInfo to not depend on IndexInfo
This function was introduced in 568f86eb18
to replace [ResolveRepositoryName]. The function was implemented to use
various parts of the registry package that were designed for the daemon
code, which was written with the assumption that it had registry-config
available from the daemon's configuration. However, `ParseRepositoryInfo`
was used in the client / CLI, which does not have this information.

To work around this problem, the code used a dummy "emptyServiceConfig"
to allow the `Insecure` and `Mirrors` fields to be propagated based on
the same defaults as used by the daemon. The `Mirrors` field would always
be empty, as there are no default mirrors, and (lacking access to the
daemon's config) the `Insecure` field would always default to registries
running on a loopback address (`::1/128`, `127.0.0.1/8`). It's worth noting
that neither the `Mirrors`, nor the `Insecure` field is used by the CLI.

This patch rewrites `ParseRepositoryInfo` to be self-contained, and not
depend on these constructs (and the `emptyServiceConfig`). For now, the
existing logic for `Insecure` is kept, but replaced by a simplified function
(`isInsecure`) with some optimizations for well-known loopback addresses
(`localhost`, `::1`, `127.0.0.1`) to prevent redundant DNS lookups or
parsing.

Note that similar changes should be made for [ParseSearchIndexInfo], which
has a similar fate and is also only used by the client / CLI.

[ResolveRepositoryName]: 11e47996dc/registry/registry.go (L199-L222)
[ParseSearchIndexInfo]: d86dd75948/registry/search.go (L153-L162)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-08 17:07:10 +01:00
Sebastiaan van Stijn
b4bdf12dae Merge pull request #49581 from vvoland/vendor-x-net
vendor: golang.org/x/net v0.36.0
2025-03-08 01:17:15 +01:00
Sebastiaan van Stijn
42f1e38e20 integration/image: TestRemoveImageGarbageCollector: don't set zero-values
This test was setting some fields to their zero / default-value, which
was redundant, and added additional imports. Remove them as they are
not needed.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-07 22:40:01 +01:00
Sebastiaan van Stijn
42ca9154e9 layer: remove StoreOptions.ExperimentalEnabled
I noticed that the only reason we kept this was so that we could produce
a more targeted error for the deprecated storage-driver plugins, but it's
very unlikely someone used those, and if they did, we already had the
"DOCKERD_DEPRECATED_GRAPHDRIVER_PLUGINS" added as requirement. Let's
just produce an error if that option is set (and remove that altogether in
a later release, but just that check doesn't add significant complexity).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-07 22:39:55 +01:00
Sebastiaan van Stijn
037f25c9e0 Merge pull request #49598 from thaJeztah/remove_MetadataStorePathTemplate
layer: remove StoreOptions.MetadataStorePathTemplate
2025-03-07 22:39:23 +01:00
Sebastiaan van Stijn
677048f22c Merge pull request #49597 from thaJeztah/cmd_dockerd_config_handling
cmd/dockerd: assorted cleanups on config handling
2025-03-07 21:54:24 +01:00
Sebastiaan van Stijn
0a4c0902a5 Merge pull request #49578 from dmcgowan/update-governance
Update governance and maintainers file
2025-03-07 20:22:55 +01:00
Paweł Gronowski
df519e9e1a daemon: Fix giving up too early while connecting to containerd socket
Explicitly set the gRPC connection params to take the timeout into
account to workaround the containerd v2 client not passing down the
stack.

containerd v2 replaced usages of deprecated gRPC functions but didn't
pass the timeout to the actual dial connection options.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-03-07 19:03:40 +01:00
Paweł Gronowski
ace8c9c94f vendor: golang.org/x/net v0.36.0
full diff: https://github.com/golang/net/compare/v0.35.0...v0.36.0

Version v0.36.0 of golang.org/x/net fixes a vulnerability in the
golang.org/x/net/proxy and golang.org/x/net/http/httpproxy packages
which could cause the proxy to be bypassed.

Matching of hosts against proxy patterns could improperly treat an IPv6
zone ID as a hostname component. For example, when the NO_PROXY
environment variable was set to "*.example.com", a request to
"[::1%25.example.com]:80` would incorrectly match and not be proxied.

Thanks to Juho Forsén of Mattermost for reporting this issue.

This is CVE-2025-22870 and Go issue https://go.dev/issue/71984.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-03-07 18:28:01 +01:00
Paweł Gronowski
bc0ca67b1c vendor: golang.org/x/net v0.35.0
full diff: https://github.com/golang/net/compare/v0.33.0...v0.35.0

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-03-07 18:27:58 +01:00
Paweł Gronowski
c90cbc89c0 Merge pull request #49589 from vvoland/deflake-TestAccessPublishedPortFromAnotherNetwork
integration/net: Deflake TestAccessPublishedPortFromAnotherNetwork
2025-03-07 17:01:22 +00:00
Sebastiaan van Stijn
9278110260 Dockerfile: update containerd binary to v1.7.26
- full diff: https://github.com/containerd/containerd/compare/v1.7.25...v1.7.26
- release notes: https://github.com/containerd/containerd/releases/tag/v1.7.26

Welcome to the v1.7.26 release of containerd!

The twenty-sixth patch release for containerd 1.7 contains various fixes
and updates.

Highlights

- Add support for syncfs after unpack
- Update runc binary to v1.2.55
- Fix race between serve and immediate shutdown on the server
- Reject oversized messages from the sender

Container Runtime Interface (CRI)

- Fix fatal concurrency error in port forwarding

Node Resource Interface (NRI)

- Fix initial sync race when registering NRI plugins
- Add API support for reading Pod IPs
- Fix plugin sync to use multiple messages if ttrpc max message limit is hit
- Update API to pass configured timeouts to plugins.
- Fix mount removal in adjustments
- Close plugin if initial synchronization fails
- Add support for adjusting OOM score
- Add API support for NRI-native CDI injection
- Add support for pids cgroup

Runtime

- Fix console TTY leak in runc shim

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-07 17:47:59 +01:00
Sebastiaan van Stijn
51db0f1b1b Merge pull request #49543 from thaJeztah/bump_crypto_oauth2
vendor: golang.org/x/crypto v0.35.0, golang.org/x/oauth2 v0.27.0
2025-03-07 17:23:27 +01:00
Sebastiaan van Stijn
75f6c4ab9d Merge pull request #49579 from thaJeztah/bump_ubuntu
gha: update various workflows to use Ubuntu 24.04
2025-03-07 15:39:51 +01:00
Paweł Gronowski
0a58c73e0d integration/net: Retry TestAccessPublishedPortFromAnotherNetwork
Allow each test case to be retried up to 5 times.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-03-07 14:57:00 +01:00
Sebastiaan van Stijn
d34e1ff826 layer: remove StoreOptions.MetadataStorePathTemplate
This field was added to allow templating the storage-location of the storage
driver as part of a refactor in f5916b10ae.

In practice, the template is never customized, and always set to;
`/<data-root>/image/<driver-name>/layerdb`, where `<driver-name>` is
passed in by the driver.

This patch removes the field and its uses.

- 00ab386b5a/daemon/daemon.go (L1074-L1075)
- 00ab386b5a/integration/image/remove_unix_test.go (L50-L51)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-07 00:50:02 +01:00
Sebastiaan van Stijn
556633ca47 cmd/dockerd: daemonCLI.start: scope local errors
Scope errors locally and don't use special names if there's no reason
for it.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-07 00:27:12 +01:00
Sebastiaan van Stijn
8b59e1a398 cmd/dockerd: daemonCLI.start: return error instead of log.Fatal
We return errors in this function, except for this one, which was logged
as Fatal. If we want errors to be logged, we should probably do so in
the function calling daemonCLI.start.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-07 00:15:16 +01:00
Sebastiaan van Stijn
8a8cdaaa11 cmd/dockerd: daemonCLI.start: don't log warnings before failing
This function could produce various logs ("Running in rootless mode") at
the start, but further steps could still fail (such as running with
RootlessKit, but not being configured as rootless).

This patch moves the informational / warning logs further down, so that
we don't produce logs before failing.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-07 00:08:45 +01:00
Sebastiaan van Stijn
6e30a4cc0c cmd/dockerd: explicitly access Config fields
Explicitly access config field through the Config field, instead
of the top-level "cli". This allows spotting locations where we don't
depend on the CLI, but really just the Config.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-06 23:50:26 +01:00
Sebastiaan van Stijn
dfecaaf908 cmd/dockerd: rewrite getContainerdDaemonOpts to a func
This method only depended on the CLI config; rewrite it to a
regular function, returning the opts to use for the containerd
daemon.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-06 23:50:26 +01:00
Sebastiaan van Stijn
b95fdcd084 cmd/dockerd: createAndStartCluster: change to accept Config
This function took the whole daemon CLI as argument, but only needed
the config; change the signature to accept that.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-06 23:50:26 +01:00
Sebastiaan van Stijn
29aa7e15bd cmd/dockerd: rewrite getSwarmRunRoot to a regular func
This method only required the config to be passed; rewrite it to a
regular func that accepts the config.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-06 23:50:26 +01:00
Sebastiaan van Stijn
29c296e1dd cmd/dockerd: rename vars that shadowed imports
Also use a consistent name for "config" arguments.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-06 23:50:26 +01:00
Sebastiaan van Stijn
f87ae7c914 gha: test-prepare: update to Ubuntu 24.04
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-06 23:16:05 +01:00
Sebastiaan van Stijn
c41ed7c98c gha: build, cross: update to Ubuntu 24.04
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-06 23:14:54 +01:00
Sebastiaan van Stijn
d29038d1cb gha: integration-cli-prepare: update to Ubuntu 24.04
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-06 23:14:53 +01:00
Sebastiaan van Stijn
a23058e0d7 gha: integration-cli-report: update to Ubuntu 24.04
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-06 23:14:53 +01:00
Sebastiaan van Stijn
de69b552ff gha: integration-report: update to Ubuntu 24.04
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-06 23:14:53 +01:00
Sebastiaan van Stijn
b61f409972 gha: test: update Ubuntu 22.04 -> 24.04
Don't upgrade rootless yet, as it doesn't like running on 24.04;

    ---> Making bundle: .integration-daemon-start (in bundles/test-integration)
    Using test binary /usr/local/cli-integration/docker
    # DOCKER_EXPERIMENTAL is set: starting daemon with experimental features enabled!
    Not: starting.
    Starting dockerd
    INFO: Waiting for daemon to start...
    ...........................................................
    error: daemon at unix:///go/src/github.com/docker/docker/bundles/test-integration/docker.sock fails to '/usr/local/cli-integration/docker version':
    Client:
     Version:      17.06.2-ce
     API version:  1.30
     Go version:   go1.8.3
     Git commit:   cec0b72
     Built:        Tue Sep  5 19:57:21 2017
     OS/Arch:      linux/amd64
    Cannot connect to the Docker daemon at unix:///go/src/github.com/docker/docker/bundles/test-integration/docker.sock. Is the docker daemon running?
    make: *** [Makefile:231: test-integration] Error 1
    Error: Process completed with exit code 2.

logs:

    + [ -w /tmp/docker-1000 ]
    + [ -d /home/unprivilegeduser ]
    + rootlesskit=
    + command -v docker-rootlesskit
    + command -v rootlesskit
    + rootlesskit=rootlesskit
    + break
    + [ -z rootlesskit ]
    + : /tmp/docker-1000/dockerd-rootless
    + :
    + :
    + : builtin
    + : auto
    + : auto
    + :
    + net=
    + mtu=
    + [ -z  ]
    + command -v slirp4netns
    + [ -z  ]
    + command -v vpnkit
    + net=vpnkit
    + [ -z  ]
    + mtu=1500
    + host_loopback=--disable-host-loopback
    + [  = false ]
    + dockerd=dockerd
    + [ -z  ]
    + _DOCKERD_ROOTLESS_CHILD=1
    + export _DOCKERD_ROOTLESS_CHILD
    + id -u
    + [ 1000 = 0 ]
    + command -v selinuxenabled
    + exec rootlesskit --state-dir=/tmp/docker-1000/dockerd-rootless --net=vpnkit --mtu=1500 --slirp4netns-sandbox=auto --slirp4netns-seccomp=auto --disable-host-loopback --port-driver=builtin --copy-up=/etc --copy-up=/run --propagation=rslave /usr/local/bin/dockerd-rootless.sh --debug --host unix:///go/src/github.com/docker/docker/bundles/test-integration/docker.sock --storage-driver overlay2 --pidfile bundles/test-integration/docker.pid --userland-proxy=true --experimental
    [rootlesskit:parent] error: failed to start the child: fork/exec /proc/self/exe: operation not permitted

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-06 23:14:15 +01:00
Sebastiaan van Stijn
60276fafca gha: integration-prepare: update to ubuntu 24.04
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-06 23:12:02 +01:00
Sebastiaan van Stijn
651fb91c4d gha: arm64: update Ubuntu 22.04 -> 24.04
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-06 23:12:02 +01:00
Sebastiaan van Stijn
f6a9ed5f0a gha: arm64: test-integration-report: update to Ubuntu 24.04
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-06 23:12:02 +01:00
Sebastiaan van Stijn
13e1ef6277 gha: arm64: test-unit-report: update to ubuntu 24.04
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-06 23:12:01 +01:00
Sebastiaan van Stijn
27404044a6 gha: validate, build-dev: update to Ubuntu 24.04
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-06 23:12:01 +01:00
Sebastiaan van Stijn
3571982458 gha: smoke: update to Ubuntu 24.04
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-06 23:12:01 +01:00
Sebastiaan van Stijn
ee73f2e5da gha: docker-py: update to ubuntu 24.04
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-06 23:12:01 +01:00
Sebastiaan van Stijn
b9ca3d198e gha: unit: update to ubuntu 24.04
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-06 23:12:01 +01:00
Sebastiaan van Stijn
1a0afb0f9e gha: bin-image: update to ubuntu 24.04
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-06 23:12:00 +01:00
Sebastiaan van Stijn
4919bf9f41 gha: buildkit: update to ubuntu 24.04
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-06 23:12:00 +01:00
Sebastiaan van Stijn
7b1fd61864 gha: validate-pr: update to ubuntu 24.04
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-06 23:12:00 +01:00
Sebastiaan van Stijn
eeffc099ef gha: dco: update to ubuntu 24.04
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-06 23:12:00 +01:00
Sebastiaan van Stijn
06b87d80ee gha: docker-py: set TEST_SKIP_INTEGRATION_CLI=1
These tests don't actually run the integration-cli suite, but
the global hack/xxx script errors because it's not set;

    ---> Making bundle: test-docker-py (in bundles/test-docker-py)
    ---> Making bundle: .integration-daemon-start (in bundles/test-docker-py)
    Using test binary /usr/local/cli-integration/docker
    # DOCKER_EXPERIMENTAL is set: starting daemon with experimental features enabled!
    # cgroup v2 requires TEST_SKIP_INTEGRATION_CLI to be set
    make: *** [Makefile:220: test-docker-py] Error 1
    Error: Process completed with exit code 2.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-06 23:12:00 +01:00
Cesar Talledo
c9f53d506a Merge ps_test.go into list_test.go.
Signed-off-by: Cesar Talledo <cesar.talledo@docker.com>
2025-03-06 10:42:07 -08:00
Paweł Gronowski
95bf53fb6c container/stream: Don't log error when streams are properly closed
This fixes unnecessary errors being written to the daemon log after
copying container streams failed due the streams being closed explicitly:

time="2025-03-06T13:20:53.473232423Z" level=error msg="copy stream failed" error="io: read/write on closed pipe" stream=stdin

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-03-06 14:28:17 +01:00
Derek McGowan
6e55f83747 Remove unused toml validation
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-03-06 01:44:06 -08:00
Derek McGowan
bf8a27a55a Remove inactive maintainers with no activity in last two years
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-03-06 01:07:10 -08:00
Derek McGowan
9e814fc0d7 Remove inactive former curators
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-03-06 01:07:10 -08:00
Derek McGowan
b868fad5e3 Update governance to replace TSC and add maintainer roles
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-03-06 01:07:10 -08:00
Sebastiaan van Stijn
690f758505 vendor: golang.org/x/oauth2 v0.27.0
We have tagged version v0.27.0 of golang.org/x/oauth2 in order to address
a security issue.

jws: unexpected memory consumption during token parsing

Version v0.27.0 of golang.org/x/oauth2 fixes a vulnerability in the
golang.org/x/oauth2/jws package which could cause a denial of service.
An attacker can pass a malicious malformed token which causes unexpected
memory to be consumed during parsing.

Thanks to jub0bs for reporting this issue.
This is CVE-2025-22868 and Go issue https://go.dev/issue/71490.

full diff: https://github.com/golang/oauth2/compare/v0.26.0...v0.27.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-06 10:00:25 +01:00
Sebastiaan van Stijn
55599fd9b3 vendor: golang.org/x/oauth2 v0.26.0
No code changes, only comments (warnings) added;

- google: add warning about externally-provided credentials

> Important: If you accept a credential configuration (credential JSON/File/Stream) from an
> external source for authentication to Google Cloud Platform, you must validate it before
> providing it to any Google API or library. Providing an unvalidated credential configuration to
> Google APIs can compromise the security of your systems and data. For more information, refer to
> [Validate credential configurations from external sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).

full diff: https://github.com/golang/oauth2/compare/v0.23.0...v0.26.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-06 10:00:25 +01:00
Sebastiaan van Stijn
a47d9c5f58 vendor: golang.org/x/crypto v0.35.0
We have tagged version v0.35.0 of golang.org/x/crypto in order to address
a security issue. Version v0.35.0 of golang.org/x/crypto fixes a vulnerability
in the golang.org/x/crypto/ssh package which could cause a denial of service.
SSH servers which implement file transfer protocols are vulnerable to a denial
of service attack from clients which complete the key exchange slowly, or not
at all, causing pending content to be read into memory, but never transmitted.
Thanks to Yuichi Watanabe for reporting this issue.
This is CVE-2025-22869 and Go issue https://go.dev/issue/71931.

full diff: https://github.com/golang/crypto/compare/v0.31.0...v0.35.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-06 10:00:25 +01:00
Sebastiaan van Stijn
3a28163007 vendor: golang.org/x/crypto v0.34.0
No code-changes, but updates the minimum go version to go1.23:

> all: upgrade go directive to at least 1.23.0 [generated]
>
> By now Go 1.24.0 has been released, and Go 1.22 is no longer supported
> per the Go Release Policy (https://go.dev/doc/devel/release#policy).
>
> For golang/go#69095.

full diff: https://github.com/golang/crypto/compare/v0.33.0...v0.34.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-06 10:00:25 +01:00
Sebastiaan van Stijn
ffc91fd76a vendor: golang.org/x/crypto v0.33.0
Relevant changes;

- go.mod: update golang.org/x dependencies
- ssh: add ServerConfig.PreAuthConnCallback, ServerPreAuthConn (banner)
  interface

full diff: https://github.com/golang/crypto/compare/v0.31.0...v0.33.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-06 10:00:25 +01:00
Sebastiaan van Stijn
7cba8aef1c vendor: golang.org/x/text v0.22.0
no code-changes in vendored files.

full diff: https://github.com/golang/text/compare/v0.21.0...v0.22.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-06 10:00:24 +01:00
Sebastiaan van Stijn
995d71a033 vendor: golang.org/x/sync v0.11.0
no code-changes, only a godoc comment updated

full diff: https://github.com/golang/sync/compare/v0.10.0...v0.11.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-06 10:00:24 +01:00
Sebastiaan van Stijn
e325564f38 vendor: golang.org/x/sys v0.30.0
full diff: https://github.com/golang/sys/compare/v0.29.0...v0.30.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-06 10:00:24 +01:00
Akihiro Suda
a9c9d5bb25 Merge pull request #49465 from thaJeztah/vendor_runc_filepath_securejoin
vendor: github.com/opencontainers/runc v1.2.5, cyphar/filepath-securejoin v0.4.1
2025-03-06 09:34:23 +09:00
Akihiro Suda
4e60c49f0d Merge pull request #49587 from crazy-max/buildkit-0.20.1
vendor: update buildkit to v0.20.1
2025-03-06 09:33:56 +09:00
Sebastiaan van Stijn
f049fd0533 Merge pull request #49541 from thaJeztah/bump_go_version
update minimum go version to go1.23
2025-03-05 20:36:17 +01:00
Sebastiaan van Stijn
2e4ef1ace9 Merge pull request #49580 from vvoland/update-go
update to go1.23.7
2025-03-05 18:40:11 +01:00
Sebastiaan van Stijn
01d8303167 Merge pull request #49582 from robmry/flush_bridge_chains
Flush iptables chains DOCKER-CT, DOCKER-BRIDGE on startup
2025-03-05 18:38:10 +01:00
CrazyMax
65b460b9ef vendor: update buildkit to v0.20.1
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2025-03-05 17:07:25 +01:00
Sebastiaan van Stijn
6e8eb8a90f vendor.mod: update minimum go version to go1.23
Go maintainers started to unconditionally update the minimum go version
for golang.org/x/ dependencies to go1.23, which means that we'll no longer
be able to support any version below that when updating those dependencies;

> all: upgrade go directive to at least 1.23.0 [generated]
>
> By now Go 1.24.0 has been released, and Go 1.22 is no longer supported
> per the Go Release Policy (https://go.dev/doc/devel/release#policy).
>
> For golang/go#69095.

This updates our minimum version to go1.23, as we won't be able to maintain
compatibility with older versions because of the above.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-05 13:39:50 +01:00
Sebastiaan van Stijn
3c817d02a9 Merge pull request #49575 from thaJeztah/refactor_resolvconf_build
libnetwork/resolvconf: re-implement "Build" with the new libnetwork/internal/resolvconf code
2025-03-05 13:17:47 +01:00
Rob Murray
26edf2d0a7 Flush iptables chains DOCKER-CT, DOCKER-BRIDGE on startup
These chains were added in commit 76417bf ("Don't use ipset"), but
not included in the list of chains that get flushed and deleted
on daemon startup.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-03-05 11:47:36 +00:00
Sebastiaan van Stijn
113c296ce7 Merge pull request #49493 from thaJeztah/enable_nakedret
golangci-lint: enable nakedret linter
2025-03-05 00:38:28 +01:00
Paweł Gronowski
5f912e4cf5 update to go1.23.7
- https://github.com/golang/go/issues?q=milestone%3AGo1.23.7+label%3ACherryPickApproved
- full diff: https://github.com/golang/go/compare/go1.23.6...go1.23.7

These minor releases include 1 security fixes following the security policy:

net/http, x/net/proxy, x/net/http/httpproxy: proxy bypass using IPv6 zone IDs

Matching of hosts against proxy patterns could improperly treat an IPv6
zone ID as a hostname component. For example, when the NO_PROXY
environment variable was set to "*.example.com", a request to
"[::1%25.example.com]:80` would incorrectly match and not be proxied.

Thanks to Juho Forsén of Mattermost for reporting this issue.

This is CVE-2025-22870 and Go issue https://go.dev/issue/71984.

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

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-03-04 22:57:35 +01:00
Sebastiaan van Stijn
65c2f799b4 Merge pull request #49573 from thaJeztah/denoise_ci
integration/volume: remove some debug logs and minor fixes/cleanups
2025-03-04 15:22:16 +01:00
Sebastiaan van Stijn
a8178613af golangci-lint: enable nakedret linter
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-04 13:56:16 +01:00
Sebastiaan van Stijn
c359cc6829 api/types/registry: fix naked returns
api/types/registry/registry.go:60:2: naked return in func `UnmarshalJSON` with 9 lines of code (nakedret)
        return
        ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-04 13:56:16 +01:00
Sebastiaan van Stijn
b1c008c007 api/server/router/build: fix naked returns
api/server/router/build/build_routes.go:359:2: naked return in func `Write` with 5 lines of code (nakedret)
        return
        ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-04 13:56:16 +01:00
Sebastiaan van Stijn
4aecdd5744 image/tarexport: fix naked returns and slight refactor
image/tarexport/load.go:429:2: naked return in func `validatedParentLinks` with 12 lines of code (nakedret)
        return
        ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-04 13:56:15 +01:00
Sebastiaan van Stijn
99b6012a02 daemon/logger/awslogs: remove unused named return
daemon/logger/awslogs/cloudwatchlogs.go:684:2: naked return in func `findValidSplit` with 10 lines of code (nakedret)
        return
        ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-04 13:56:15 +01:00
Sebastiaan van Stijn
4fa9ec3192 daemon/logger: fix naked returns and slight refactor
daemon/logger/proxy.go:35:3: naked return in func `StartLogging` with 17 lines of code (nakedret)
            return
            ^
    daemon/logger/proxy.go:42:2: naked return in func `StartLogging` with 17 lines of code (nakedret)
        return
        ^
    daemon/logger/proxy.go:61:3: naked return in func `StopLogging` with 16 lines of code (nakedret)
            return
            ^
    daemon/logger/proxy.go:68:2: naked return in func `StopLogging` with 16 lines of code (nakedret)
        return
        ^
    daemon/logger/proxy.go:80:3: naked return in func `Capabilities` with 14 lines of code (nakedret)
            return
            ^
    daemon/logger/proxy.go:89:2: naked return in func `Capabilities` with 14 lines of code (nakedret)
        return
        ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-04 13:56:15 +01:00
Sebastiaan van Stijn
eeb5651de5 daemon/graohdriver/fuse-overlayfs/: fix naked returns and slight refactor
daemon/graphdriver/fuse-overlayfs/fuseoverlayfs.go:527:2: naked return in func `fusermountU` with 25 lines of code (nakedret)
        return
        ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-04 13:56:15 +01:00
Sebastiaan van Stijn
02b4610246 daemon/graohdriver: fix naked returns
daemon/graphdriver/fsdiff.go:140:3: naked return in func `ApplyDiff` with 20 lines of code (nakedret)
            return
            ^
    daemon/graphdriver/fsdiff.go:149:3: naked return in func `ApplyDiff` with 20 lines of code (nakedret)
            return
            ^
    daemon/graphdriver/fsdiff.go:153:2: naked return in func `ApplyDiff` with 20 lines of code (nakedret)
        return
        ^
    daemon/graphdriver/fsdiff.go:164:3: naked return in func `DiffSize` with 15 lines of code (nakedret)
            return
            ^
    daemon/graphdriver/fsdiff.go:169:3: naked return in func `DiffSize` with 15 lines of code (nakedret)
            return
            ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-04 13:56:15 +01:00
Sebastiaan van Stijn
964413c3a1 daemon/cluster: fix naked returns
daemon/cluster/cluster.go:423:2: naked return in func `managerStats` with 24 lines of code (nakedret)
        return
        ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-04 13:56:14 +01:00
Sebastiaan van Stijn
387ec71630 daemon: fix naked returns
daemon/daemon.go:1570:2: naked return in func `RemapContainerdNamespaces` with 21 lines of code (nakedret)
        return
        ^
    daemon/daemon_linux.go:128:2: naked return in func `getCleanPatterns` with 14 lines of code (nakedret)
        return
        ^
    daemon/logs.go:180:2: naked return in func `getLogger` with 11 lines of code (nakedret)
        return
        ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-04 13:56:14 +01:00
Sebastiaan van Stijn
85c8fb7fda daemon: getSystemCPUUsage(): fix naked returns, output vars
Remove output variables, and use explicit returns

    daemon/stats_unix.go:359:2: naked return in func `getSystemCPUUsage` with 38 lines of code (nakedret)
        return
        ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-04 13:56:14 +01:00
Sebastiaan van Stijn
5c85847a55 registry: fix naked returns, output vars
registry/service.go:83:4: naked return in func `Auth` with 38 lines of code (nakedret)
                return
                ^
    registry/search_session.go:91:2: naked return in func `Read` with 6 lines of code (nakedret)
        return
        ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-04 13:56:14 +01:00
Sebastiaan van Stijn
17448ef1c8 plugin: fix naked returns, output vars
plugin/backend_linux.go:722:3: naked return in func `CreateFromContext` with 112 lines of code (nakedret)
            return
            ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-04 13:56:14 +01:00
Sebastiaan van Stijn
faa9cb125b pkg/tarsum: fix naked returns
pkg/tarsum/versioning.go:150:2: naked return in func `v1TarHeaderSelect` with 35 lines of code (nakedret)
        return
        ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-04 13:56:13 +01:00
Sebastiaan van Stijn
b5b514ab04 pkg/stdcopy: fix naked returns
pkg/stdcopy/stdcopy.go:68:2: naked return in func `Write` with 23 lines of code (nakedret)
        return
        ^
    pkg/stdcopy/stdcopy_test.go:93:3: naked return in func `getSrcBuffer` with 10 lines of code (nakedret)
            return
            ^
    pkg/stdcopy/stdcopy_test.go:97:2: naked return in func `getSrcBuffer` with 10 lines of code (nakedret)
        return
        ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-04 13:56:13 +01:00
Sebastiaan van Stijn
d3d84bde4b pkg/pools: fix naked returns
pkg/pools/pools.go:83:2: naked return in func `Copy` with 5 lines of code (nakedret)
        return
        ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-04 13:56:13 +01:00
Sebastiaan van Stijn
52b8298975 pkg/chrootarchive: remove unused named return
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-04 13:56:13 +01:00
Sebastiaan van Stijn
b38f0dd804 pkg/archive: fix naked returns, output variables in tests
pkg/archive/copy_unix_test.go:54:3: naked return in func `fileContentsEqual` with 35 lines of code (nakedret)
            return
            ^
    pkg/archive/copy_unix_test.go:60:3: naked return in func `fileContentsEqual` with 35 lines of code (nakedret)
            return
            ^
    pkg/archive/copy_unix_test.go:67:3: naked return in func `fileContentsEqual` with 35 lines of code (nakedret)
            return
            ^
    pkg/archive/copy_unix_test.go:74:3: naked return in func `fileContentsEqual` with 35 lines of code (nakedret)
            return
            ^
    pkg/archive/copy_unix_test.go:83:2: naked return in func `fileContentsEqual` with 35 lines of code (nakedret)
        return
        ^
    pkg/archive/diff_test.go:314:3: naked return in func `makeTestLayer` with 35 lines of code (nakedret)
            return
            ^
    pkg/archive/diff_test.go:326:5: naked return in func `makeTestLayer` with 35 lines of code (nakedret)
                    return
                    ^
    pkg/archive/diff_test.go:330:5: naked return in func `makeTestLayer` with 35 lines of code (nakedret)
                    return
                    ^
    pkg/archive/diff_test.go:336:3: naked return in func `makeTestLayer` with 35 lines of code (nakedret)
            return
            ^
    pkg/archive/copy_unix_test.go:36:2: naked return in func `getTestTempDirs` with 10 lines of code (nakedret)
        return
        ^
    pkg/stdcopy/stdcopy_test.go:93:3: naked return in func `getSrcBuffer` with 10 lines of code (nakedret)
            return
            ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-04 13:56:13 +01:00
Sebastiaan van Stijn
d59a9d9b10 pkg/archive: fix naked returns, output variables
pkg/archive/archive_linux.go:65:2: naked return in func `ConvertWrite` with 43 lines of code (nakedret)
        return
        ^
    pkg/archive/archive.go:265:2: naked return in func `Read` with 11 lines of code (nakedret)
        return
        ^
    pkg/archive/copy.go:32:2: naked return in func `copyWithBuffer` with 5 lines of code (nakedret)
        return
        ^
    pkg/archive/copy.go:114:3: naked return in func `TarResourceRebase` with 16 lines of code (nakedret)
            return
            ^
    pkg/archive/copy.go:449:4: naked return in func `ResolveHostSourcePath` with 26 lines of code (nakedret)
                return
                ^
    pkg/archive/copy.go:460:4: naked return in func `ResolveHostSourcePath` with 26 lines of code (nakedret)
                return
                ^
    pkg/archive/wrap.go:58:2: naked return in func `parseStringPairs` with 11 lines of code (nakedret)
        return
        ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-04 13:56:08 +01:00
Sebastiaan van Stijn
c62f5aff42 libnetwork: fix naked returns
libnetwork/drivers/remote/driver_test.go:29:2: naked return in func `decodeToMap` with 3 lines of code (nakedret)
        return
        ^
    libnetwork/ipams/remote/remote_test.go:23:2: naked return in func `decodeToMap` with 3 lines of code (nakedret)
        return
        ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-04 13:55:46 +01:00
Sebastiaan van Stijn
8978b30b1a libnetwork/types: fix naked returns
libnetwork/types/types.go:330:2: naked return in func `ParseCIDR` with 6 lines of code (nakedret)
        return
        ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-04 13:55:46 +01:00
Sebastiaan van Stijn
619e8f8148 libnetwork/osl: fix naked returns
libnetwork/osl/namespace_linux.go:324:2: naked return in func `DisableARPForVIP` with 28 lines of code (nakedret)
        return
        ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-04 13:55:46 +01:00
Sebastiaan van Stijn
02b4c7cc52 libnetwork/drivers/overlay: fix naked returns, output variables
libnetwork/drivers/overlay/encryption.go:370:2: naked return in func `programSA` with 64 lines of code (nakedret)
        return
        ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-04 13:55:46 +01:00
Sebastiaan van Stijn
94afddb18d libnetwork/cmd/networkdb-test: fix naked return
libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:251:5: naked return in func `checkTable` with 42 lines of code (nakedret)
                    return
                    ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-04 13:55:45 +01:00
Sebastiaan van Stijn
379b82862f layer: fix naked returns
layer/layer_store.go:524:4: naked return in func `CreateRWLayer` with 72 lines of code (nakedret)
                return
                ^
    layer/layer_store.go:534:3: naked return in func `CreateRWLayer` with 72 lines of code (nakedret)
            return
            ^
    layer/layer_store.go:537:3: naked return in func `CreateRWLayer` with 72 lines of code (nakedret)
            return
            ^
    layer/migration.go:19:3: naked return in func `ChecksumForGraphID` with 28 lines of code (nakedret)
            return
            ^
    layer/migration.go:25:3: naked return in func `ChecksumForGraphID` with 28 lines of code (nakedret)
            return
            ^
    layer/migration.go:36:3: naked return in func `ChecksumForGraphID` with 28 lines of code (nakedret)
            return
            ^
    layer/migration.go:40:3: naked return in func `ChecksumForGraphID` with 28 lines of code (nakedret)
            return
            ^
    layer/migration.go:43:2: naked return in func `ChecksumForGraphID` with 28 lines of code (nakedret)
        return
        ^
    layer/ro_layer.go:176:2: naked return in func `Read` with 13 lines of code (nakedret)
        return
        ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-04 13:55:45 +01:00
Sebastiaan van Stijn
b1c617681f internal/unix_noeintr: fix naked returns
In fairness, these could possibly be an exception to the rule, but adding
explicit returns isn't too bad either, and allows running the nakedret
linter without //nolint tags or exceptions in .golangci-lint.yaml

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-04 13:55:45 +01:00
Sebastiaan van Stijn
51f574ea0e internal/mod: fix naked returns
internal/mod/mod.go:22:3: naked return in func `moduleVersion` with 38 lines of code (nakedret)
            return
            ^
    internal/mod/mod.go:36:4: naked return in func `moduleVersion` with 38 lines of code (nakedret)
                return
                ^
    internal/mod/mod.go:57:2: naked return in func `moduleVersion` with 38 lines of code (nakedret)
        return
        ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-04 13:55:45 +01:00
Sebastiaan van Stijn
e1538336c7 integration-cli: fix naked returns, output vars
Remove output variables, and use explicit returns

    integration-cli/check_test.go:86:3: naked return in func `testRun` with 43 lines of code (nakedret)
            return
            ^
    integration-cli/check_test.go:97:3: naked return in func `testRun` with 43 lines of code (nakedret)
            return
            ^
    integration-cli/docker_cli_cp_utils_test.go:167:2: naked return in func `makeTestContainer` with 44 lines of code (nakedret)
        return
        ^
    integration-cli/docker_api_attach_test.go:299:3: naked return in func `readTimeout` with 12 lines of code (nakedret)
            return
            ^
    integration-cli/docker_cli_cp_utils_test.go:215:2: naked return in func `startContainerGetOutput` with 11 lines of code (nakedret)
        return
        ^
    integration-cli/docker_cli_logs_test.go:276:4: naked return in func `ConsumeWithSpeed` with 18 lines of code (nakedret)
                return
                ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-04 13:55:45 +01:00
Sebastiaan van Stijn
220b3c591f container/stream/bytespipe: fix naked returns, output vars
Remove output variables, and use explicit returns

    container/stream/bytespipe/bytespipe.go:165:2: naked return in func `Read` with 37 lines of code (nakedret)
        return
        ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-04 13:55:44 +01:00
Sebastiaan van Stijn
0cd39d7b23 builder/remotecontext: fix naked returns
builder/remotecontext/detect.go:47:2: naked return in func `Detect` with 17 lines of code (nakedret)
        return
        ^
    builder/remotecontext/archive.go:127:2: naked return in func `normalize` with 7 lines of code (nakedret)
        return
        ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-04 13:55:44 +01:00
Sebastiaan van Stijn
0c1b37c50a builder/dockerfile: fix minor linting issues
- remove/rename vars that shadowed
- suppress some unhandled errors
- remove naked return

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-04 13:55:44 +01:00
Sebastiaan van Stijn
8302cd2d29 builder/dockerfile: downloadSource: fix naked returns, output vars
- use explicit returns
- rename error-return that's used in a defer
- move closing the tmpFile on error to a defer
- add debug logs for cases where either closing the file, or failing to
  remove the temp-directory

    builder/dockerfile/copy.go:369:3: naked return in func `downloadSource` with 67 lines of code (nakedret)
            return
            ^
    builder/dockerfile/copy.go:374:3: naked return in func `downloadSource` with 67 lines of code (nakedret)
            return
            ^
    builder/dockerfile/copy.go:382:3: naked return in func `downloadSource` with 67 lines of code (nakedret)
            return
            ^
    builder/dockerfile/copy.go:398:3: naked return in func `downloadSource` with 67 lines of code (nakedret)
            return
            ^
    builder/dockerfile/copy.go:407:3: naked return in func `downloadSource` with 67 lines of code (nakedret)
            return
            ^
    builder/dockerfile/copy.go:428:3: naked return in func `downloadSource` with 67 lines of code (nakedret)
            return
            ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-04 13:55:44 +01:00
Sebastiaan van Stijn
69deeaa03d Merge pull request #49571 from thaJeztah/registry_improve_tests
registry: improve test-coverage, and some minor fixes
2025-03-04 13:16:55 +01:00
Sebastiaan van Stijn
00bd916203 libnetwork/resolvconf: Build: re-implement using new implementation
Re-implement the Build function using  the new implementation from
libnetwork/internal/resolvconf.

BuildKit is the only consumer of the Build function currently, and we
should consider either moving the internal package out of internal, or
to provide a more customized variant of Build that fits BuildKit's
needs (i.e., only patch content, but not write to a file).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-04 12:34:09 +01:00
Sebastiaan van Stijn
2f19577877 libnetwork/resolvconf: Build: align order with new implementation
The new resolvconf implementation in libnetwork/internal/resolvconf
uses a different order for "search" and puts it after the resolvers.

While this changes the checksum of the file, and thus would be potentially
detected as "user modified", we no longer use this function ourselves,
and BuildKit (which uses this function) only consumes the Content field,
and discards the Hash; https://github.com/moby/buildkit/blob/v0.20.0/executor/oci/resolvconf.go#L99-L103

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-04 12:26:30 +01:00
Sebastiaan van Stijn
03aeedcca9 libnetwork/resolvconf: update tests to use more correct values
The tests were depending on the implementation ignoring invalid
nameservers, as these should always be an IP-address, not a hostname.

Update the tests to use correct values, instead of codifying the
bad behavior.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-04 12:23:03 +01:00
Akihiro Suda
41fe41382e Merge pull request #49559 from thaJeztah/testutil_remove_isErrNotFoundSwarmClassic
testutil: remove isErrNotFoundSwarmClassic
2025-03-04 17:45:15 +09:00
Sebastiaan van Stijn
c34f8bbba3 integration/volume: setupTestVolume: minor cleanups and fixes
- rename the "client" argument to "apiClient" to prevent shadowing the client import.
- remove intermediate "mount" var, which shadowed an import
- remove debug logs for stdOut/stdErr
- update the defer to use the container test-utils package to fix unhandled error warnings.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-04 01:21:12 +01:00
Sebastiaan van Stijn
28bf578a40 integration/volume: TestRunMountImage: use test-util for container cleanup
update the defer to use the container test-utils package to fix unhandled
error warnings.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-04 01:18:19 +01:00
Sebastiaan van Stijn
e41eaf2c8d integration/volume: TestRunMountVolumeSubdir: remove some logs
Both stdout and stderr were already asserted further down, so any failure
would be printed.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-04 01:17:44 +01:00
Sebastiaan van Stijn
2b9b239db0 Merge pull request #49570 from vvoland/golangci-is-alias
golangci-lint: enforce "is" alias for gotest.tools/v3/assert/cmp
2025-03-04 00:53:40 +01:00
Sebastiaan van Stijn
f1bec97dfe registry: use literal for empty slice
slightly more idiomatic

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-03 20:03:10 +01:00
Sebastiaan van Stijn
7b4e21e5d0 registry: fix typo in godoc
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-03 20:03:10 +01:00
Sebastiaan van Stijn
be9c4dd3c5 registry: TestNewIndexInfo: add more test-cases
- Add test-cases for IPv6 refs
- Add test-cases for validating the insecure-registries passed in the test

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-03 20:03:03 +01:00
Sebastiaan van Stijn
949afd933b registry: TestNewIndexInfo: assert all fields
Using DeepEquals showed that the test was missing differences between
nil-mirrors and empty-slice, in addition to mirrors being normalized
(the test only checked for the length).

While we should consider if we need an explicit empty slice (or if a
nil value would be appropriate), at least we now have a test to verify
the behavior.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-03 20:02:05 +01:00
Sebastiaan van Stijn
310d6d2fa5 registry: TestNewIndexInfo: use sub-tests
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-03 20:00:56 +01:00
Sebastiaan van Stijn
50d17676e4 registry: TestParseRepositoryInfo: add test-cases for IPv6 refs
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-03 20:00:51 +01:00
Sebastiaan van Stijn
328b808765 registry: TestParseRepositoryInfo: assert all index-info fields
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-03 19:56:54 +01:00
Sebastiaan van Stijn
d9634c3b28 registry: TestParseRepositoryInfo: use sub-tests
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-03 19:38:54 +01:00
Sebastiaan van Stijn
e2a5220ec3 registry: remove makeServiceConfig test-utility
It was a very thin wrapper around newServiceConfig, and didn't save
any code needed; possibly even the reverse, as it was abstracting
what it did under the hood.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-03 19:38:49 +01:00
Paweł Gronowski
52419cf933 golangci-lint: enforce "is" alias for gotest.tools/v3/assert/cmp
We already have been following this convention - add a linter rule that
will help us follow that convention in future changes.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-03-03 19:11:49 +01:00
Paweł Gronowski
1c63f3983b volume/service: adjust "gotest.tools/v3/assert/cmp" import alias
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-03-03 19:11:46 +01:00
Paweł Gronowski
9766a446ae integration/network: adjust "gotest.tools/v3/assert/cmp" import alias
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-03-03 19:11:44 +01:00
Paweł Gronowski
c16fcdfc4b integration/image: adjust "gotest.tools/v3/assert/cmp" import alias
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-03-03 19:11:43 +01:00
Paweł Gronowski
6abe6a910a integration/container: adjust "gotest.tools/v3/assert/cmp" import alias
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-03-03 19:11:42 +01:00
Paweł Gronowski
22069f2431 integration-cli: adjust "gotest.tools/v3/assert/cmp" import alias
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-03-03 19:11:40 +01:00
Paweł Gronowski
605f02a59b distribution: adjust "gotest.tools/v3/assert/cmp" import alias
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-03-03 19:11:39 +01:00
Paweł Gronowski
75b86c47d9 daemon/logger/loggerutils: adjust "gotest.tools/v3/assert/cmp" import alias
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-03-03 19:11:37 +01:00
Sebastiaan van Stijn
59e6d1d214 registry: TestLoadInsecureRegistries: don't mutate emptyServiceConfig
This was not revealed in our tests, which only checked for the length
of the Mirror-slice, but when testing with DeepEquals, tests were failing
when all tests were run (but succeeded on individual tests). The problem
here is that some code can mutate the list of Mirrors and set it to `nil`
or an empty slice, resulting in other tests to fail.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-03 19:08:25 +01:00
Sebastiaan van Stijn
07be327aaa Merge pull request #49568 from thaJeztah/dismantle_ParseRepositoryInfo
registry: refactor to allow splitting out logic for CLI
2025-03-03 15:53:49 +01:00
Sebastiaan van Stijn
960a39bf2c Merge pull request #49567 from thaJeztah/deprecate_repositoryinfo_official
registry: deprecate RepositoryInfo.Official field
2025-03-03 15:52:43 +01:00
Sebastiaan van Stijn
b8b2400a5b Merge pull request #49512 from thaJeztah/portallocator_unexport
libnet/portallocator: un-export errors that were not used as sentinel  errors
2025-03-03 12:38:43 +01:00
Sebastiaan van Stijn
4c96df6550 Merge pull request #49549 from thaJeztah/cleanup_cluster_init
daemon/cluster: some cleanups in initialisation
2025-03-03 12:38:11 +01:00
Sebastiaan van Stijn
ca114a1851 Merge pull request #49544 from thaJeztah/fix_windows_errors
fix some errors for windows containers
2025-03-03 12:33:31 +01:00
Sebastiaan van Stijn
43f636a4e5 Merge pull request #49558 from thaJeztah/testutil_redundant_check
testutil/environment: Execution.Clean: remove redundant condition
2025-03-03 12:31:46 +01:00
Sebastiaan van Stijn
849f344ecc registry: split normalizing index name from validating
ValidateIndexName is used by the docker daemon CLI to validate options
passed through CLI flags and daemon.json. However, it also handled
normalizing the registry name ("index.docker.io" -> "docker.io").

This patch splits the normalization code to a separate function. It
is currently not exported, but could be considered in the future;
if we do so, we may want to look for a better place for that function
to not have it in the same package as the registry code.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-03 10:16:44 +01:00
Sebastiaan van Stijn
fee40a9333 registry: create emptyServiceConfig without parsing
emptyServiceConfig is a default service-config for situations where
no config-file is available (e.g. when used in the CLI). If won't
have mirrors configured, but does have the default insecure registry
CIDRs for loopback interfaces configured.

Before this patch, this config was constructeed using the same code
that handled constructing the config with a config present, but this
involved parsing CIDR masks, and much more.

With this patch, the service config is constructed as a literal, making
it more transparent that it does not depend on any config or state.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-03 10:16:43 +01:00
Sebastiaan van Stijn
a3583b4b58 registry: newRepositoryInfo only check for official images for Docker Hub
RepositoryInfo.Official indicates whether the image repository
is an official (docker library official images) repository.

We only need to check this if the image-repository is on Docker Hub.

This patch renames the variable to make it more transparent that this
boolean is for the repository, and not to be confused for IndexInfo.Official,
which indicates if the _registry_ is the "Official" (Docker Hub) registry.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-03 10:16:43 +01:00
Sebastiaan van Stijn
08654b0b30 registry: deprecate RepositoryInfo.Official field
This field indicates whether a repository is an official image (Docker
Library / Docker Official Images). This information is deducted from the
image reference, and not used anywhere, other than in tests.

The `RepositoryInfo` and `IndexInfo` types were originally introduced in
568f86eb18, with their fields documented in
4fcb9ac40c.

At the time, the `Official` field was only used for `docker push` to produce
a custom error message if someone would attempt to push an official image
to docker hub (assuming nobody would be able to do so);
6870bde584/api/client/commands.go (L1184-L1194)

Before that commit, the condition for this error message was based on the
given image reference directly; b370acd679
b370acd679/commands.go (L421-L428)

This patch deprecates the field, because it's not used, and removes
tests related to it.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-03 10:12:17 +01:00
Akihiro Suda
d86dd75948 Merge pull request #49563 from thaJeztah/graphdriver_noshadow
daemon/graphdriver: rename vars that shadowed
2025-03-03 10:51:36 +09:00
Akihiro Suda
a626620286 Merge pull request #49564 from thaJeztah/bump_containerd_2.0.3
vendor: github.com/containerd/containerd v2.0.3
2025-03-03 10:51:14 +09:00
Sebastiaan van Stijn
dbc9d56820 vendor: github.com/containerd/containerd v2.0.3
Relevant changes:

- Update remote content to break up writes to avoid grpc message size limits
- Move CDI device spec out of the OCI package
- Remove deprecated WithCDIDevices in oci spec opts

full diff: https://github.com/containerd/containerd/compare/v2.0.2...v2.0.3

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-28 22:11:49 +01:00
Sebastiaan van Stijn
15895d8ead daemon/graphdriver: rename vars that shadowed
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-28 21:36:09 +01:00
Sebastiaan van Stijn
41f781fab3 Merge pull request #49551 from thaJeztah/libcontainerd_less_stubbing
libcontainerd/local: remove unused code and arguments
2025-02-28 16:25:25 +01:00
Sebastiaan van Stijn
aa9817b0c5 testutil: remove isErrNotFoundSwarmClassic
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-27 22:03:08 +01:00
Sebastiaan van Stijn
0ab7d41f9e testutil/environment: Execution.Clean: remove redundant condition
It's either "not windows" or "windows" (and something else), so the second
condition doesn't have to check if it's windows.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-27 21:59:05 +01:00
Brian Goff
7194b508b6 Merge pull request #48638 from robmry/iptables-nft
Use iptables-nft in the dev container / CI
2025-02-27 12:03:14 -08:00
Sebastiaan van Stijn
ea3bb90773 Merge pull request #49547 from robmry/test_docker_ingress_jump
Check swarm's jump to DOCKER-INGRESS
2025-02-27 20:26:29 +01:00
Sebastiaan van Stijn
320db9d55d Merge pull request #49546 from thaJeztah/archiver_noshadow
builder/dockerfile: remove intermediate var that shadowed
2025-02-26 20:48:46 +01:00
Sebastiaan van Stijn
c1fceb0167 Merge pull request #49550 from thaJeztah/bump_docker_cli
Dockerfile: update docker CLI to v28.0.1, docker compose to v2.33.1
2025-02-26 20:45:40 +01:00
Sebastiaan van Stijn
b301c34b92 libcontainerd/local: remove arg-names for stubs
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-26 19:00:20 +01:00
Sebastiaan van Stijn
12f89cc19b libcontainerd/local: NewClient: remove unused cli, stateDir, ns args
The "local" client does not use containerd, but implements the same interface,
many args are not used though, so remove these to make it more clear what's
actually in use.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-26 19:00:20 +01:00
Sebastiaan van Stijn
620f26e1e3 libcontainerd/local: client.createWindows: remove unused runtimeOptions
The "local" client does not use containerd, but implements the same interface,
many args are not used though, so remove these to make it more clear what's
actually in use.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-26 19:00:20 +01:00
Sebastiaan van Stijn
9c4e10126e libcontainerd/local: client.NewContainer: use early return
Also remove an intermediate var, and remove a "WithError" in favor of
adding the error field to the "WithFields".

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-26 19:00:20 +01:00
Sebastiaan van Stijn
7c1a2301f0 libcontainerd/local: client.extractResourcesFromSpec: use early return
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-26 19:00:20 +01:00
Sebastiaan van Stijn
fc462d699a Dockerfile: update compose to v2.33.1
Update the compose cli plugin used in the dev-container

full diff: https://github.com/docker/compose/compare/v2.32.4...v2.33,1

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-26 15:50:49 +01:00
Sebastiaan van Stijn
855563fc43 Dockerfile: update docker CLI to v28.0.1
Update the Docker CLI used in the dev-container

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-26 15:47:49 +01:00
Rob Murray
ab7305c85a Check swarm's jump to DOCKER-INGRESS
Related to commit 558da63 (Jump to DOCKER-INGRESS from
DOCKER-FORWARD).

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-02-26 14:27:57 +00:00
Rob Murray
be14d9148c Make integration/service/network_test.go Linux-only
All the tests in it had skips for Windows. The move makes it possible
to add a test that uses L3Segment.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-02-26 14:27:57 +00:00
Sebastiaan van Stijn
cfc562c358 daemon/cluster: create "state" and "runtime-dir" closer to where used
Don't create these paths until starting the cluster; they're not used
before this.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-26 15:25:00 +01:00
Sebastiaan van Stijn
ef4f4d845d daemon/cluster: rename Cluster.root to Cluster.stateDir
This matches the name used by Swarm in swarmnode.Config. While updating,
also remove code from Cluster.Start that replicated the logic to construct
the path, in favor of using the `stateDir` field.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-26 15:25:00 +01:00
Sebastiaan van Stijn
4d3d4bbeeb daemon/cluster: remove Config.WatchStream and move to constructor
The WatchStream field was set as configuration option in cmd/dockerd,
but not configurable. Move creating the stream to the constructor,
and remove the configuration option. This field was introduced in
59d45c384a, at which time the cmd/dockerd
code needed direct access to the stream, but a later refactor in
05346355db introduced an accessor
(GetWatchStream) for this.

The cluster.Config struct is only used internally, it's unlikely
for any external project to use this, so skipping deprecation.

With this change, the cmd/dockerd package no longer has a direct
import of swarmkit.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-26 15:24:55 +01:00
Sebastiaan van Stijn
bbd0a17ccc Merge pull request #49538 from robmry/docker_ingress
Jump to DOCKER-INGRESS from DOCKER-FORWARD
2025-02-26 10:52:05 +01:00
Sebastiaan van Stijn
cdbb62394c builder/dockerfile: remove intermediate var that shadowed
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-25 20:23:19 +01:00
Rob Murray
8ae4858af4 Merge pull request #49545 from robmry/revert_check-config_ipset
Revert "contrib/check-config: add ipset related flags"
2025-02-25 18:46:57 +00:00
Rob Murray
18143632f7 Revert "contrib/check-config: add ipset related flags"
This reverts commit ccdfac5328.

Since commit 76417bf, the kernel ip_set module (and friends) are
not required.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-02-25 17:20:31 +00:00
Rob Murray
558da63444 Jump to DOCKER-INGRESS from DOCKER-FORWARD
A jump to DOCKER-INGRESS chain is only created when Swarm needs
it. That's always after jumps to DOCKER-USER and DOCKER-FORWARD
have been inserted at the top of the FORWARD chain. The
DOCKER-INGRESS rule needs to be between those two other jumps.

Placing the jump to DOCKER-INGRESS at the top of the DOCKER-FORWARD
chain puts it in the right place, without needing to shuffle any
other rules around when it's added.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-02-25 17:17:36 +00:00
Sebastiaan van Stijn
f92fdfecbf Merge pull request #49530 from robmry/disable_ip_set
Drop the use of ipset
2025-02-25 17:55:31 +01:00
Sebastiaan van Stijn
fdd534d2ca libcontainerd: windows: return errdefs type for pausing
Noticed this log in CI on Windows,  which wasn't clear if it was an error
in Windows or in Docker;

    2025-02-25T03:21:35.9273942Z [Error] Handler for POST /v1.48/containers/1713bc845f9bde79aa0017c16613fbfc8810b3272b31dbb2535d3fb1a3550f9c/pause returned error: cannot pause container 1713bc845f9bde79aa0017c16613fbfc8810b3272b31dbb2535d3fb1a3550f9c: Unimplemented: not implemented

Looks like it's a feature that's not implemented when using process-isolation,
so updating the error-message to make it more identifiable as an error
produced by us.

I kept the type to be a "not implemented", which will be converted to a
501 HTTP status (so still logged as error); alternatively, we could make
this a "invalid parameter".

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-25 17:53:25 +01:00
Sebastiaan van Stijn
60782e6d39 container: fix some errors on Windows
While going through some logs from CI, I noticed this log-entry on Windows,
produced as part of a test;

    2025-02-25T03:23:17.6584227Z [Error] Handler for POST /v1.48/containers/b47b1e632188426d6d42a4be04f9a3cc1eca40cfed9536d277011052af0b04f5/update returned error: Cannot update container b47b1e632188426d6d42a4be04f9a3cc1eca40cfed9536d277011052af0b04f5: Restart policy cannot be updated because AutoRemove is enabled for the container

While updating is an error for the user, it's not an error in the daemon,
so we should return the correct error-type (and avoid logging it as an
error in daemon logs).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-25 17:53:25 +01:00
Paweł Gronowski
88bc9a3d0f Merge pull request #49535 from vvoland/c8d-fixcontentsize
c8d/manifests: Fix Content size including missing content
2025-02-25 15:54:42 +00:00
Rob Murray
76417bf763 Don't use ipset
Commit 0546d90 introduced the use of ipset to reduce the number
of rules that need to be processed per-packet, and make the code
a bit simpler.

But, docker's used on embedded kernels compiled without support
for ipset, so the change is too disruptive.

Replace the two ipset rules with a new chain that writes out the
rule's actions long-hand. So ..

This rule:
  -A FORWARD -m set --match-set docker-ext-bridges-v4 dst \
    -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
Is transformed into a per-bridge rule in new chain DOCKER-CT:
  -A DOCKER-FORWARD -j DOCKER-CT
  -A DOCKER-CT -o docker0 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
  -A DOCKER-CT -o bridge1 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT

And:
  -A FORWARD -m set --match-set docker-ext-bridges-v4 dst -j DOCKER
Is transformed into a per-bridge rule in new chain DOCKER-BRIDGE:
  -A DOCKER-FORWARD -j DOCKER-BRIDGE
  -A DOCKER-BRIDGE -o docker0 -j DOCKER
  -A DOCKER-BRIDGE -o bridge1 -j DOCKER

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-02-25 15:24:25 +00:00
Paweł Gronowski
c35159ed7d c8d/manifests: Fix Content size including missing content
Content size should only include size of content that is present in the
local store.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-02-25 15:14:51 +01:00
Sebastiaan van Stijn
05104991bc Merge pull request #49533 from vvoland/c8d-inspectlist-indeximg
c8d/list&inspect: Better handle images without any platform blobs available locally
2025-02-25 15:11:55 +01:00
Rob Murray
0274c630c9 Merge pull request #49518 from robmry/docker_forward_chain
Add chain DOCKER-FORWARD
2025-02-25 11:25:55 +00:00
Rob Murray
f344ab14b3 Merge pull request #49525 from robmry/startup_ip6_disabled
Fix daemon startup on a no-IPv6 host
2025-02-24 20:51:10 +00:00
Rob Murray
cd0ceff232 Merge pull request #49521 from robmry/swarm_net_from_config
Fix --config-from creation of swarm networks
2025-02-24 20:50:37 +00:00
Rob Murray
468c2c814d Fix swarm network creation from a config-only network
Creating a swarm network from a config-only network failed
because the new EnableIPv4 wasn't validated/propagated
correctly.

So:
- Always initialise EnableIPv4 to true, including for a config
  only network, and on load from the store.
- Treat enableIPv4=true as the no-overridden state when checking
  params for a config-from network.
- Propagate settings from the config 'Network' objects attributes
  to its generic options, because the network driver only sees
  generic options.
  - This was happening already for Network.internal, after the
    config-only network options were processed. Move that to
    'applyConfigurationTo'.
  - Add enableIPv4/enableIpv6 - enableIPv6 will normaly be present
    anyway. But, for a network created pre-28.x and restored from
    the store, there was no entry for 'netlabel.EnableIpv4'.
- Extend TestSwarmScopedNetFromConfig to start a service and
  check it's ok.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-02-24 17:48:23 +00:00
Rob Murray
8e6cc4ac48 Fix swarm net validation for config-from networks
For swarm networks, Controller.NewNetwork is called to validate
network config ... nothing gets created, but ManagerRedirectError
is returned if the config is ok - then swarm does its own thing.

So, for a --config-from network, merge config before checking
whether it'll have IPv4 enabled.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-02-24 17:48:23 +00:00
Rob Murray
8cc4d1d4a2 Fix daemon startup on a no-IPv6 host
With ip6tables enabled (by default), the daemon should start on a
host with IPv6 disabled - then error if IPv6 network creation is
attempted.

That regressed in commit 255fff4 - so, only try to set up network
isolation rules for a network if it's IPv6-enabled.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-02-24 17:41:44 +00:00
Rob Murray
341cafa611 Test with a drop rule appended to filter-FORWARD
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-02-24 17:09:09 +00:00
Rob Murray
984a610a21 Add chain DOCKER-FORWARD
In 28.0.0, Docker appended to the FORWARD chain - breaking other
applications that had appended their own rules that needed to execute
after Docker's rules.

Move most of Docker's rules out of the filter-FORWARD chain into a
new DOCKER-FORWARD chain, so that Docker can append to DOCKER-FORWARD
without affecting the order of rules in the FORWARD chain.

After daemon startup inserts jumps to DOCKER-USER and DOCKER-FORWARD,
the bridge driver will not touch the FORWARD chain again. DOCKER-INGRESS
is still added to the FORWARD chain, if used, as it was in 27.x and
earlier.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-02-24 17:09:09 +00:00
Paweł Gronowski
21582b84fb c8d/list: Fix empty Manifests for some images
Fix empty `Manifests` field for multi-platform images that have no
platform blobs available locally.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-02-24 16:52:08 +01:00
Paweł Gronowski
6b1b170708 c8d/inspect: Fix image not found error for index-only image
Fix not being able to inspect images that are OCI-index only (like
`tianon/empty`) or a real multi-platform image which has no platform
blobs available locally.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-02-24 16:52:05 +01:00
Sebastiaan van Stijn
5cf20fe12e Merge pull request #49531 from thaJeztah/bump_cdi
vendor: tags.cncf.io/container-device-interface v0.8.1
2025-02-24 15:37:33 +01:00
Sebastiaan van Stijn
adb2ba0eab Merge pull request #49522 from robmry/doc_default_bridge
Mark default-bridge-only opts in --help and manpage
2025-02-24 15:30:33 +01:00
Rob Murray
33244704ef Merge pull request #49524 from robmry/missing_ip_set_errors
Better error message for missing ip_set kernel modules
2025-02-24 14:29:35 +00:00
Sebastiaan van Stijn
5ced8fd377 vendor: tags.cncf.io/container-device-interface v0.8.1
- pkg/cdi: don't crash if we fail to create fsnotify watch

full diff: https://github.com/cncf-tags/container-device-interface/compare/v0.8.0...v0.8.1

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-24 14:00:55 +01:00
Rob Murray
a92d20bcc4 Better error message for missing ip_set kernel modules
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-02-24 12:18:36 +00:00
Sebastiaan van Stijn
0de01f700d Merge pull request #49520 from robmry/inspect_gw6_not_cidr
Fix network inspect IPv6 gateway address format
2025-02-24 11:53:37 +01:00
Paweł Gronowski
a5008d4a41 Merge pull request #49526 from akerouanton/fix-setsockopt-i386
libnet/d/bridge: fix compilation on i386
2025-02-24 09:26:56 +00:00
Albin Kerouanton
73f2a5336d libnet/d/bridge: fix compilation on i386
On i386, Linux doesn't provide direct socket syscall but instead
multiplexes them through the socketcall syscall (see `man 2 socketcall`).
This commit fixes compilation for i386 by wrapping the offending syscall
in a new function that uses the socketcall syscall on i386, and
the `setsockopt` syscall on other archs.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-02-23 12:01:59 +01:00
Rob Murray
013c43fb56 Mark default-bridge-only opts in --help and manpage
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-02-22 20:21:23 +00:00
Rob Murray
3cf4ff971d Fix network inspect IPv6 gateway address format
When an IPv6 network is first created with no specific IPAM config,
network inspect adds a CIDR range to the gateway address. After the
daemon has been restarted, it's just a plain address.

Once the daaemon's been restated, "info" becomes "config", and the
address is reported correctly from "config".

Make the IPv6 code to report the gateway from "info" use net.IPNet.IP
instead of the whole net.IPNet - like the IPv4 code.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-02-22 12:24:57 +00:00
Sebastiaan van Stijn
a2a6bf51fa Merge pull request #49514 from AkihiroSuda/fix-49499
Fix v28 regression `protocol "tcp" is not supported by the RootlessKit port driver "slirp4netns"`
2025-02-21 20:47:14 +01:00
Albin Kerouanton
459686bbea Merge pull request #49510 from neersighted/check-config_ipset
contrib/check-config: add ipset related flags
2025-02-21 10:15:42 +01:00
Akihiro Suda
501ce33bab Fix v28 regression protocol "tcp" is not supported by the RootlessKit port driver "slirp4netns"
`DOCKERD_ROOTLESS_ROOTLESSKIT_PORT_DRIVER=slirp4netns` was broken
since f1e0746c08 (PR 48132, v28).

Fix issue 49499

ref: https://github.com/rootless-containers/rootlesskit/blob/v2.3.2/cmd/rootlesskit-docker-proxy/main.go#L196-L204
(used until Docker v27)

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2025-02-21 13:25:23 +09:00
Sebastiaan van Stijn
f0f008b87f Merge pull request #49507 from akerouanton/fix-restart-port-already-in-use
daemon: handleContainerExit: ignore networking errors
2025-02-21 00:07:08 +01:00
Sebastiaan van Stijn
c37690b98e libnet/portallocator: un-export errors that were not used as sentinel errors
The `ErrPortAlreadyAllocated` error was introduced in ffd68badc0,
and at the time used as sentinel error in the bridge driver. It was later
integrated into libnetwork ([libnetwork@672ced7]), and brought back when
libnetwork was integrated in v1.7.0; 272f8cd4bc
After libnetwork was integrated, the error was unused as sentinel error,
except for locally inside the package as part of a test;

    git rev-parse --verify HEAD
    496bc46c88

    git grep '\.ErrPortAlreadyAllocated'

Which is still the case Today;

    git describe --tags --match="v[0-9]*" HEAD
    v28.0.0
    git rev-parse --verify HEAD
    af898abe44
    git grep '\.ErrPortAlreadyAllocated'

Same for the `ErrAllPortsAllocated` (added in 739d124480)
and `ErrUnknownProtocol` (added in 303ed3c830)
errors, which were never used as sentinel errors, and still aren't;

    git grep '\.ErrAllPortsAllocated'
    git grep '\.ErrUnknownProtocol'
    vendor/github.com/moby/buildkit/client/llb/source.go:   if errors.Is(err, gitutil.ErrUnknownProtocol) {

This patch;

- un-exports these errors as they are not used as sentinel errors
- strips down the `ErrPortAlreadyAllocated`, removing the methods that
  were added, but never used.
- removes the `newErrPortAlreadyAllocated` constructor
- renames `ErrPortAlreadyAllocated` to `alreadyAllocatedErr` to follow
  go conventions.

[libnetwork@672ced7]: c0474b6438

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-20 23:58:44 +01:00
Bjorn Neergaard
ccdfac5328 contrib/check-config: add ipset related flags
Signed-off-by: Bjorn Neergaard <bjorn.neergaard@docker.com>
2025-02-20 13:28:15 -07:00
Albin Kerouanton
ac8b4e3e75 daemon: handleContainerExit: ignore networking errors
Prior to commit fe856b9, containers' network sandbox and interfaces were
created before the containerd task. Now, it's created after.

If this step fails, the containerd task is forcefully deleted, and an
event is sent to the c8d event monitor, which triggers `handleContainerExit`.
Then this method tries to restart the faulty container.

This leads to containers with a published port already in use to be
stuck in a tight restart loop (if they're started with
`--restart=always`) until the port is available. This is needlessly
spamming the daemon logs.

Prior to that commit, a published port already in use wouldn't trigger
the restart process.

This commit adds a check to `handleContainerExit` to ignore exit events
if the latest container error is related to networking setup.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-02-20 18:03:20 +01:00
Paweł Gronowski
af898abe44 Merge pull request #49495 from vvoland/update-buildkit
vendor: github.com/moby/buildkit v0.20.0
2025-02-19 21:53:46 +00:00
Paweł Gronowski
d67f035d31 vendor: github.com/moby/buildkit v0.20.0
full diff: https://github.com/moby/buildkit/compare/v0.20.0-rc3...v0.20.0

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-02-19 21:14:36 +01:00
Paweł Gronowski
00ab386b5a Merge pull request #49491 from vvoland/update-buildkit
vendor: github.com/moby/buildkit v0.20.0-rc3
2025-02-18 22:00:10 +00:00
CrazyMax
1fde8c4615 builder-next: fix cdi manager
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-02-18 21:48:01 +01:00
Paweł Gronowski
cde9f0752e vendor: github.com/moby/buildkit v0.20.0-rc3
full diff: https://github.com/moby/buildkit/compare/v0.20.0-rc2...v0.20.0-rc3

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-02-18 21:47:59 +01:00
Paweł Gronowski
89e1429b65 Merge pull request #49490 from thaJeztah/dockerfile_linting
Dockerfile: fix linting warnings
2025-02-18 17:49:09 +00:00
Sebastiaan van Stijn
b2b55903d0 Dockerfile: fix linting warnings
The 'as' keyword should match the case of the 'from' keyword
    FromAsCasing: 'as' and 'FROM' keywords' casing do not match
    More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/

    Setting platform to predefined $TARGETPLATFORM in FROM is redundant as this is the default behavior
    RedundantTargetPlatform: Setting platform to predefined $TARGETPLATFORM in FROM is redundant as this is the default behavior
    More info: https://docs.docker.com/go/dockerfile/rule/redundant-target-platform/

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-18 18:05:03 +01:00
Rob Murray
cfc049c938 Use iptables-nft in the dev container / CI
Replaces iptables-legacy.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-02-18 16:14:48 +00:00
Sebastiaan van Stijn
62bc597990 Merge pull request #49480 from thaJeztah/docs_api_1.48
docs/api: add documentation for API v1.48
2025-02-18 13:57:08 +01:00
Paweł Gronowski
670cd81423 Merge pull request #49485 from vvoland/c8d-list-panic
c8d/list: Fix panic when listing images
2025-02-18 12:48:26 +00:00
Sebastiaan van Stijn
a3628f3f8e docs/api: add documentation for API v1.48
API version used by the v28.0.0 release.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-18 13:35:34 +01:00
Sebastiaan van Stijn
5eab938af8 Merge pull request #49477 from thaJeztah/swagger_container_examples
api/swagger: remove custom example from /containers/json endpoint
2025-02-18 13:33:06 +01:00
Sebastiaan van Stijn
794cec1c1f Merge pull request #49478 from thaJeztah/swagger_container_examples_step2
api/swagger: remove custom example from /containers/{id}/json endpoint
2025-02-18 12:47:02 +01:00
Paweł Gronowski
9eccc20a17 c8d/list: Fix panic when listing images
imageSummary erroneously returned a nil multi-platform summary in case
of a multi-platform image, which the OCI index is available locally, but
none of its platform manifest is.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-02-18 12:23:50 +01:00
Paweł Gronowski
4e97729f14 c8d/list: Test with SharedSize = true
For additional coverage

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-02-18 12:23:47 +01:00
Sebastiaan van Stijn
322eddfb41 api/swagger: remove custom example from /containers/{id}/json endpoint
Create a ContainerInspectResponse definition and Use the example fields
as defined in the definition; add additional examples in that definition
where missing.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-18 11:58:10 +01:00
Sebastiaan van Stijn
60539d0956 api/swagger: remove custom example from /containers/json endpoint
Use the example fields as defined in the ContainerSummary definition,
and add additional examples in that definition where missing.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-18 11:45:57 +01:00
Sebastiaan van Stijn
89291c57f2 Merge pull request #49484 from thaJeztah/fix_fatcontext_linting
golangci-lint: ignore "nested context" (fatcontext) in tests
2025-02-18 10:55:36 +01:00
Sebastiaan van Stijn
35e615167b Merge pull request #49479 from thaJeztah/swagger_exec_nits
api/swagger: inline Exec example values
2025-02-18 10:53:26 +01:00
Sebastiaan van Stijn
119b52f302 golangci-lint: ignore "nested context" (fatcontext) in tests
Commit 15fbd67407 updated golangci-lint,
which came with an updated version of the "fatcontext" linter, causing
linting to fail.

We use these to set up spans for our tests; suppress these through the
golangci-lint config (instead of linline "//nolint" comments) so that
we can revisit this approach and see if there's a more idiomatic way.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-18 10:20:00 +01:00
Akihiro Suda
28dc5a82b3 Merge pull request #49481 from thaJeztah/bump_golangci_lint
Dockerfile: update golangci-lint to v1.64.5
2025-02-18 17:14:28 +09:00
Sebastiaan van Stijn
15fbd67407 Dockerfile: update golangci-lint to v1.64.5
Adds go1.24 support

full diff: https://github.com/golangci/golangci-lint/compare/v1.63.4...v1.64.5
changelog: https://golangci-lint.run/product/changelog/#v1645

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-17 22:43:18 +01:00
Sebastiaan van Stijn
7b6c3ebe7b api/swagger: inline Exec example values
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-17 21:55:14 +01:00
Sebastiaan van Stijn
57d4d23825 Merge pull request #49468 from thaJeztah/update_branch_status
project: update status of branches
2025-02-17 11:52:00 +01:00
Sebastiaan van Stijn
8b2f6fba4a Merge pull request #49471 from thaJeztah/container_cleanups
container: Container.StopSignal: fix handling of invalid signals and cleanup tests
2025-02-17 11:39:15 +01:00
Paweł Gronowski
54c43a7c93 Merge pull request #49472 from thaJeztah/splunk_nits
daemon/logger: assorted minor (linting) fixes and cleanups
2025-02-17 10:34:47 +00:00
Sebastiaan van Stijn
2fc90096bf project: update status of branches
- Mirantis now ships 25.0 for MCR (23.0 reaching end of support)
- Microsoft packages 27.x
- 26.1 is no longer maintained
- Other branches no longer maintained

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-17 11:33:30 +01:00
Sebastiaan van Stijn
bd92f2bb92 daemon/logger/splunk: New(): combine switches for format validation
The format was validated twice; first just to validate, then to construct
the correct format-wrapper, or error for an unknown format.

This patch combines both switches to a single one.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-15 20:52:49 +01:00
Sebastiaan van Stijn
eac39ffdb8 daemon/logger/splunk: remove some intermediate variables
Remove intermediate variables or move them closer to where they're used,
as this function has various early returns on errors.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-15 20:44:11 +01:00
Sebastiaan van Stijn
9bb3900c30 daemon/logger: Info.ExtraAttributes: make env-var handling conditional
- Move some variables inside the "if" branch to make it clear they're only
  used locally, and not outside of the branch.
- Skip handling "env" and "env-regex" options if there are no env-vars
  to handle.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-15 20:04:08 +01:00
Sebastiaan van Stijn
cbbff10b01 daemon/logger: use consistent name for "extra attributes"
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-15 19:44:31 +01:00
Sebastiaan van Stijn
ba559c4f12 daemon/logger/fluentd: fix minor (linting) issues
- Rename variables that collided with imports
- Make capturing interval.Milliseconds conditional as it would trip some
  linters for using a potential "zero" value.
- Use WithFields instead of chainging multiple "WithField" calls for logging.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-15 19:43:31 +01:00
Sebastiaan van Stijn
b9e7e82b66 daemon/logger/splunk: plunkLogger.postMessages(): improve logs
- No need to use `fmt.Errorf` to format the error message
- Use structured logs, and include the message that failed to be sent
  in a `message` field.
- When failing to marshal the message, log an error outlining what happened
  instead of logging the bare error.
- Move the `messagesLen` variable closer to where it's used, putting the
  context handling first as a reminder that we may want to pass a context
  through.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-15 19:42:58 +01:00
Sebastiaan van Stijn
2f82cbb5f8 daemon/logger/splunk: suppress some unhandled errors
Also add a commend based on [`ensureReaderClosed`][1] to outline why we're
copying.

[1]: 5cc3f1dab8/client/request.go (L313-L325)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-15 19:42:58 +01:00
Sebastiaan van Stijn
f049d0c66b daemon/logger/splunk: don't defer in a loop
This is mostly to silences some linters, as we're returning immediately
after, so no looping would happen, but we don't need a defer here either
for the same reason, so let's just remove it.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-15 19:42:57 +01:00
Sebastiaan van Stijn
0d938b6bb3 daemon/logger/splunk: rename var that shadowed import
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-15 19:42:57 +01:00
Sebastiaan van Stijn
529a56d31a container: Container.StopSignal: fix handling of invalid signals
Commit 0e50d946a2 introduced a feature to
allow a custom stop-signal to be set. As part of this, existing code to
parse the signal was extracted to `signal.ParseSignal()`, which accepts
a string either containing a numeric value or a named signal.

When failing to parse the given signal, it returns an error and a magic
"-1" signal. The changes in 0e50d946a2 used
the error when creating a container, but for existing container configs,
it would ignore the error and instead check if the signal was "0", in
which case it would fall back to use the default stop-signal (SIGTERM).

Given that  `signal.ParseSignal()` returns "-1" (not "0") for invalid
signals, this would result in the failure going undetected and "-1"
being used instead of the intended default (SIGTERM).

In practice, this issues would unlikely be encountered, as custom signals
are validated when creating the container, but it would be possible for
an image to contain an invalid signal, which would be used by the container
as default.

This patch updates the logic to only use the custom value if no error is
produced and a non-zero, positive signal is returned.

A test-case was added that would fail before this patch:

    go test -v -run TestContainerStopSignal
    === RUN   TestContainerStopSignal
        container_test.go:34: assertion failed: signal -1 (s syscall.Signal) != terminated (defaultStopSignal syscall.Signal)
    --- FAIL: TestContainerStopSignal (0.00s)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-15 18:55:03 +01:00
Sebastiaan van Stijn
ef0fe1ac00 container: define defaultStopSignal as a syscall.Signal
"SIGTERM" is defined both for Windows and Linux, so we can define the
signal to use as a syscall.Signal, instead of parsing it from a string
whenever we need to use the default.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-15 18:29:35 +01:00
Sebastiaan van Stijn
0a4c4c9e82 container: some cleanups in view tests
- use t.TempDir() instead of TestMain creating a directory to make
  tests self-contained.
- fix some unhandled errors, and missing assertions for error-types
- assert with gotest.tools, but kept the Benchmark tests as-is for now,
  to make sure gotest.tools doesn't impact the results.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-15 16:43:53 +01:00
Sebastiaan van Stijn
49f2320bc7 container: some cleanups in tests
- use t.TempDir()
- use t.Name() instead of hard-coding name
- assert with gotest.tools
- fix some unhandled errors

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-15 16:43:53 +01:00
Sebastiaan van Stijn
07aa4d96ea container: TestReplaceAndAppendEnvVars: assert with gotest.tools
Assert the actual results match the expected one, which should make the
test more complete, and reduces some noise by removing a `t.Log`.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-15 16:43:52 +01:00
Sebastiaan van Stijn
0914e97df2 container: rename test file
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-15 16:43:52 +01:00
Sebastiaan van Stijn
5cc3f1dab8 Merge pull request #49470 from vvoland/c8d-pull-panic
c8d/progress: Fix panic when pulling some images
2025-02-14 19:15:17 +01:00
Paweł Gronowski
a200675420 Merge pull request #49469 from jsternberg/fix-container-image-manifest-view
container: ensure image manifest is deep copied from the container into the snapshot
2025-02-14 17:37:53 +00:00
Paweł Gronowski
9bcac6d573 c8d/progress: Fix panic when pulling some images
Pulling some images that share the same content blob but have different chain
IDs caused a panic:

```
panic: runtime error: slice bounds out of range [1:0]

goroutine 318661 [running]:
github.com/docker/docker/daemon/containerd.(*pullProgress).UpdateProgress(0x400fd02d70, {0xaaaada2fda38, 0x400fd02e10}, 0x4019d38810, {0xaaaada2d1640, 0x4018c94600}, {0x0?, 0x0?, 0xaaaadb7c7200?})
	/root/build-deb/engine/daemon/containerd/progress.go:232 +0xd84
github.com/docker/docker/daemon/containerd.(*jobs).showProgress.func1()
	/root/build-deb/engine/daemon/containerd/progress.go:55 +0x144
created by github.com/docker/docker/daemon/containerd.(*jobs).showProgress in goroutine 318659
	/root/build-deb/engine/daemon/containerd/progress.go:48 +0x128
```

The panic was caused by attempting to remove the same committed
layer multiple times from the `p.layers` slice.

This occurred because, in such images, multiple snapshots matched the
same layer by digest rather than by the full layer chain and layer removal
was done by index, leading to repeated deletions at the same index.

This commit:
- Selects a specific snapshot to ensure only one removal per layer.
- Changes snapshot matching to compare the full layer chain instead of
  just the layer digest.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-02-14 17:52:02 +01:00
Sebastiaan van Stijn
9b32baf9db Merge pull request #49467 from robmry/no_iptables_rules_when_disabled
Don't create iptables rules when iptables is disabled
2025-02-14 17:31:53 +01:00
Sebastiaan van Stijn
5af7c47f0e Merge pull request #49420 from thaJeztah/client_remove_serverResponse
client: remove serverResponse and use http.Response directly
2025-02-14 16:40:38 +01:00
Jonathan A. Sternberg
acc4d45278 container: ensure image manifest is deep copied from the container into the snapshot
Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com>
2025-02-14 09:29:50 -06:00
Sebastiaan van Stijn
46c60aa239 Merge pull request #49462 from tonistiigi/buildkit-v0.20.0-rc2
vendor: update buildkit to v0.20.0-rc2
2025-02-14 16:09:41 +01:00
Sebastiaan van Stijn
f106ec122b Merge pull request #49466 from vvoland/client-funcopts
client: Change `ImageHistory`, `ImageLoad` and `ImageSave` to use variadic functional options
2025-02-14 16:09:06 +01:00
Sebastiaan van Stijn
bd409fc882 Merge pull request #49418 from thaJeztah/daemon_structured_logs
daemon: use structured logs for printing reloaded config, move to cli
2025-02-14 15:41:48 +01:00
Paweł Gronowski
903ba2f487 client: Move opts to separate files
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-02-14 14:45:08 +01:00
Paweł Gronowski
b9319f64ed client: Change ImageSave to use functional options
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-02-14 14:25:39 +01:00
Paweł Gronowski
ae4c688fd8 client: Change ImageLoad to use functional options
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-02-14 14:25:37 +01:00
Paweł Gronowski
85808a6abf client: Change ImageHistory to use functional options
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-02-14 13:55:30 +01:00
Rob Murray
5719e8edf9 Don't create iptables rules when iptables is disabled
New iptables rules were added by:
- commit 27adcd5 (libnet/d/bridge: port mappings: drop direct-access
  when gw_mode=nat)
- commit d216084 (libnet/d/bridge: drop remote connections to port
  mapped on lo)

But they're added even when iptables=false or ip6tables=false in daemon
config.

So, group those rules with the other per-port rules, behind a config
check.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-02-14 12:55:12 +00:00
Paweł Gronowski
068aa86c23 client: Group deprecated functions into ImageAPIClientDeprecated
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-02-14 13:55:07 +01:00
Sebastiaan van Stijn
47ca352b0d vendor: github.com/opencontainers/runc v1.2.5, cyphar/filepath-securejoin v0.4.1
Changes in runc code are not impacting code we use;

- libcontainer/utils.MkdirAllInRootOpen is not used
- libcontainer/utils.MkdirAllInRoot is not used

Similarly, while filepath-securejoin is imported, the functions using it
in runc (cgroups.FindCgroupMountpoint, are not used in our codebase, so
these changes don't affect our code; `tryDefaultPath` uses securejoin,
which is used by `FindCgroupMountpoint`, but not used in our codebase.

diffs:

- https://github.com/opencontainers/runc/compare/v1.2.4...v1.2.5
- https://github.com/cyphar/filepath-securejoin/compare/v0.3.5...v0.4.1

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-14 13:04:45 +01:00
Sebastiaan van Stijn
eed190460f Merge pull request #49464 from thaJeztah/bump_runc_binary_1.2.5
Dockerfile: update runc binary to v1.2.5
2025-02-14 12:25:31 +01:00
Sebastiaan van Stijn
d1c6550f71 daemon: use structured logs for printing reloaded config, move to cli
- Move logging out of config.Reload and daemon.Reload itself, as it was not
  the right place to know whether it was a "signal" that triggered the reload.
- Use Daemon.Config() to get the new config after reloading. This returns an
  immutable copy of the daemon's config, so we can redact fields without having
  to use an ad-hoc struct to shadow the underlying fields.
- Use structured logs for logging config reload events.

Before this (plain text):

    INFO[2025-02-08T12:13:53.389649297Z] Got signal to reload configuration, reloading from: /etc/docker/daemon.json
    INFO[2025-02-08T12:30:34.857691260Z] Reloaded configuration: {"pidfile":"/var/run/docker.pid","data-root":"/var/lib/docker","exec-root":"/var/run/docker","group":"docker","max-concurrent-downloads":3,"max-concurrent-uploads":5,"max-download-attempts":5,"shutdown-timeout":15,"hosts":["unix:///var/run/docker.sock"],"log-level":"info","log-format":"text","swarm-default-advertise-addr":"","swarm-raft-heartbeat-tick":0,"swarm-raft-election-tick":0,"metrics-addr":"","host-gateway-ips":[""],"log-driver":"json-file","mtu":1500,"ip":"0.0.0.0","icc":true,"iptables":true,"ip6tables":true,"ip-forward":true,"ip-masq":true,"userland-proxy":true,"userland-proxy-path":"/usr/local/bin/docker-proxy","default-address-pools":{"Values":null},"network-control-plane-mtu":1500,"experimental":false,"containerd":"/var/run/docker/containerd/containerd.sock","features":{"containerd-snapshotter":false},"builder":{"GC":{},"Entitlements":{}},"containerd-namespace":"moby","containerd-plugin-namespace":"plugins.moby","default-runtime":"runc","runtimes":{"crun":{"path":"/usr/local/bin/crun"}},"seccomp-profile":"builtin","default-shm-size":67108864,"default-ipc-mode":"private","default-cgroupns-mode":"private","resolv-conf":"/etc/resolv.conf","proxies":{}}

Before this (JSON logs):

    {"level":"info","msg":"Reloaded configuration: {\"pidfile\":\"/var/run/docker.pid\",\"data-root\":\"/var/lib/docker\",\"exec-root\":\"/var/run/docker\",\"group\":\"docker\",\"max-concurrent-downloads\":3,\"max-concurrent-uploads\":5,\"max-download-attempts\":5,\"shutdown-timeout\":15,\"hosts\":[\"unix:///var/run/docker.sock\"],\"log-level\":\"info\",\"log-format\":\"json\",\"swarm-default-advertise-addr\":\"\",\"swarm-raft-heartbeat-tick\":0,\"swarm-raft-election-tick\":0,\"metrics-addr\":\"\",\"host-gateway-ips\":[\"\"],\"log-driver\":\"json-file\",\"mtu\":1500,\"ip\":\"0.0.0.0\",\"icc\":true,\"iptables\":true,\"ip6tables\":true,\"ip-forward\":true,\"ip-masq\":true,\"userland-proxy\":true,\"userland-proxy-path\":\"/usr/local/bin/docker-proxy\",\"default-address-pools\":{\"Values\":null},\"network-control-plane-mtu\":1500,\"experimental\":false,\"containerd\":\"/var/run/docker/containerd/containerd.sock\",\"features\":{\"containerd-snapshotter\":false},\"builder\":{\"GC\":{},\"Entitlements\":{}},\"containerd-namespace\":\"moby\",\"containerd-plugin-namespace\":\"plugins.moby\",\"default-runtime\":\"runc\",\"runtimes\":{\"crun\":{\"path\":\"/usr/local/bin/crun\"}},\"seccomp-profile\":\"builtin\",\"default-shm-size\":67108864,\"default-ipc-mode\":\"private\",\"default-cgroupns-mode\":\"private\",\"resolv-conf\":\"/etc/resolv.conf\",\"proxies\":{}}","time":"2025-02-08T12:24:38.600761054Z"}

After this (plain text):

    INFO[2025-02-08T12:30:34.835953594Z] Got signal to reload configuration            config-file=/etc/docker/daemon.json
    INFO[2025-02-08T12:30:34.857614135Z] Reloaded configuration                        config="{\"pidfile\":\"/var/run/docker.pid\",\"data-root\":\"/var/lib/docker\",\"exec-root\":\"/var/run/docker\",\"group\":\"docker\",\"max-concurrent-downloads\":3,\"max-concurrent-uploads\":5,\"max-download-attempts\":5,\"shutdown-timeout\":15,\"hosts\":[\"unix:///var/run/docker.sock\"],\"log-level\":\"info\",\"log-format\":\"text\",\"swarm-default-advertise-addr\":\"\",\"swarm-raft-heartbeat-tick\":0,\"swarm-raft-election-tick\":0,\"metrics-addr\":\"\",\"host-gateway-ips\":[\"\"],\"log-driver\":\"json-file\",\"mtu\":1500,\"ip\":\"0.0.0.0\",\"icc\":true,\"iptables\":true,\"ip6tables\":true,\"ip-forward\":true,\"ip-masq\":true,\"userland-proxy\":true,\"userland-proxy-path\":\"/usr/local/bin/docker-proxy\",\"default-address-pools\":{\"Values\":null},\"network-control-plane-mtu\":1500,\"experimental\":false,\"containerd\":\"/var/run/docker/containerd/containerd.sock\",\"features\":{\"containerd-snapshotter\":false},\"builder\":{\"GC\":{},\"Entitlements\":{}},\"containerd-namespace\":\"moby\",\"containerd-plugin-namespace\":\"plugins.moby\",\"default-runtime\":\"runc\",\"runtimes\":{\"crun\":{\"path\":\"/usr/local/bin/crun\"}},\"seccomp-profile\":\"builtin\",\"default-shm-size\":67108864,\"default-ipc-mode\":\"private\",\"default-cgroupns-mode\":\"private\",\"resolv-conf\":\"/etc/resolv.conf\",\"proxies\":{}}"

After this (JSON logs):

    {"config-file":"/etc/docker/daemon.json","level":"info","msg":"Got signal to reload configuration","time":"2025-02-08T12:24:38.589955637Z"}
    {"config":"{\"pidfile\":\"/var/run/docker.pid\",\"data-root\":\"/var/lib/docker\",\"exec-root\":\"/var/run/docker\",\"group\":\"docker\",\"max-concurrent-downloads\":3,\"max-concurrent-uploads\":5,\"max-download-attempts\":5,\"shutdown-timeout\":15,\"hosts\":[\"unix:///var/run/docker.sock\"],\"log-level\":\"info\",\"log-format\":\"json\",\"swarm-default-advertise-addr\":\"\",\"swarm-raft-heartbeat-tick\":0,\"swarm-raft-election-tick\":0,\"metrics-addr\":\"\",\"host-gateway-ips\":[\"\"],\"log-driver\":\"json-file\",\"mtu\":1500,\"ip\":\"0.0.0.0\",\"icc\":true,\"iptables\":true,\"ip6tables\":true,\"ip-forward\":true,\"ip-masq\":true,\"userland-proxy\":true,\"userland-proxy-path\":\"/usr/local/bin/docker-proxy\",\"default-address-pools\":{\"Values\":null},\"network-control-plane-mtu\":1500,\"experimental\":false,\"containerd\":\"/var/run/docker/containerd/containerd.sock\",\"features\":{\"containerd-snapshotter\":false},\"builder\":{\"GC\":{},\"Entitlements\":{}},\"containerd-namespace\":\"moby\",\"containerd-plugin-namespace\":\"plugins.moby\",\"default-runtime\":\"runc\",\"runtimes\":{\"crun\":{\"path\":\"/usr/local/bin/crun\"}},\"seccomp-profile\":\"builtin\",\"default-shm-size\":67108864,\"default-ipc-mode\":\"private\",\"default-cgroupns-mode\":\"private\",\"resolv-conf\":\"/etc/resolv.conf\",\"proxies\":{}}","level":"info","msg":"Reloaded configuration","time":"2025-02-08T12:24:38.600736179Z"}

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-14 12:22:10 +01:00
Paweł Gronowski
40cdab0a3a Merge pull request #49419 from thaJeztah/fix_linting_step2
golangci-lint: enable more linters
2025-02-14 09:55:29 +00:00
Sebastiaan van Stijn
838ae09a23 Dockerfile: update runc binary to v1.2.5
This is the fifth patch release in the 1.2.z series of runc. It primarily fixes
an issue caused by an upstream systemd bug.

* There was a regression in systemd v230 which made the way we define
  device rule restrictions require a systemctl daemon-reload for our
  transient units. This caused issues for workloads using NVIDIA GPUs.
  Workaround the upstream regression by re-arranging how the unit properties
  are defined.
* Dependency github.com/cyphar/filepath-securejoin is updated to v0.4.1,
  to allow projects that vendor runc to bump it as well.
* CI: fixed criu-dev compilation.
* Dependency golang.org/x/net is updated to 0.33.0.

full diff: https://github.com/opencontainers/runc/compare/v1.2.4...v1.2.5
release notes: https://github.com/opencontainers/runc/releases/tag/v1.2.5

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-14 10:22:57 +01:00
Tonis Tiigi
707d8d80b9 vendor: update buildkit to v0.20.0-rc2
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2025-02-13 19:17:43 -08:00
Sebastiaan van Stijn
c9f8758570 golangci-lint: enable reassign linter
Detects reassigning a top-level variable in another package.
https://github.com/curioswitch/go-reassign

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-13 23:59:08 +01:00
Sebastiaan van Stijn
04ae510a1e golangci-lint: enable gocheckcompilerdirectives linter
Detects invalid go compiler directive comments (//go:);
https://github.com/leighmcculloch/gocheckcompilerdirectives

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-13 23:59:08 +01:00
Sebastiaan van Stijn
179e621019 golangci-lint: enable exhaustive linter
Checks exhaustiveness of enum switch statements in Go source code;
https://github.com/nishanths/exhaustive

For now allowing "default" to satisfy this, but left TODOs in various
places to make switches actually exhaustive so that we can detect missing
cases when new options are added.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-13 23:59:08 +01:00
Sebastiaan van Stijn
1f9ada6668 golangci-lint: enable errchkjson linter
Detects unsupported types passed to json encoding functions and reports
if checks for the returned error can be omitted;
https://github.com/breml/errchkjson

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-13 23:59:07 +01:00
Sebastiaan van Stijn
8b2439a383 golangci-lint: enable durationcheck linter
detect cases where two time.Duration values are being multiplied in
possibly erroneous ways;
https://github.com/charithe/durationcheck

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-13 23:59:07 +01:00
Sebastiaan van Stijn
d62e499bfe golangci-lint: enable dogsled linter
Checks assignments with too many blank identifiers;
https://github.com/alexkohler/dogsled

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-13 23:59:07 +01:00
Sebastiaan van Stijn
75fc4de8c3 golangci-lint: enable asasalint linter
Detects "[]any" used as argument for variadic "func(...any)";
https://github.com/alingse/asasalint

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-13 23:59:07 +01:00
Sebastiaan van Stijn
7218a64e87 golangci-lint: enable wastedassign linter
Detects wasted assignment statements; https://github.com/sanposhiho/wastedassign

For now, ignoring wasted asigns to `ctx` as there were too many hits in
libnetwork in functions that set up spans;

    libnetwork/drivers/bridge/bridge_linux.go:1319:2: assigned to ctx, but never used afterwards (wastedassign)
        ctx, span := otel.Tracer("").Start(ctx, "libnetwork.drivers.bridge.linkUp", trace.WithAttributes(
        ^
    libnetwork/drivers/bridge/bridge_linux.go:1448:2: assigned to ctx, but never used afterwards (wastedassign)
        ctx, span := otel.Tracer("").Start(ctx, "libnetwork.drivers.bridge.Join", trace.WithAttributes(
        ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-13 23:59:07 +01:00
Sebastiaan van Stijn
55b047e49c golangci-lint: enable fatcontext linter
Detects nested contexts in loops and function literals;
https://github.com/Crocmagnon/fatcontext

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-13 23:59:06 +01:00
Sebastiaan van Stijn
a97d6fe84f golangci-lint: enable nosprintfhostport linter (again)
Looks like we had it enabled at some point, given that there's various
"nolint" comments; https://github.com/stbenjam/no-sprintf-host-port

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-13 23:59:06 +01:00
Sebastiaan van Stijn
fc09a52d85 golangci-lint: enable spancheck linter
Detects mistakes with OpenTelemetry/Census spans;
https://github.com/jjti/go-spancheck

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-13 23:59:06 +01:00
Sebastiaan van Stijn
a0ef452f0c golangci-lint: enable mirror linter
Detects wrong mirror patterns of bytes/strings usage; https://github.com/butuzov/mirror

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-13 23:59:06 +01:00
Sebastiaan van Stijn
0de3c1b7e3 golangci-lint: enable makezero linter
Finds slice declarations with non-zero initial length;
https://github.com/ashanbrown/makezero

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-13 23:59:05 +01:00
Sebastiaan van Stijn
e6e68278f6 golangci-lint: enable iface linter (with default settings)
This linter has various other options for "correct" use of interfaces,
but those are too disruptive, so only enabling it with the default
settings, which detects duplicate interface definitions withing a
package.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-13 23:59:05 +01:00
Sebastiaan van Stijn
c8ee8c6302 golangci-lint: enable nilnesserr linter
New linter that detects returning nil errors. It combines the features
of nilness and nilerr: https://github.com/alingse/nilnesserr

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-13 23:59:05 +01:00
Sebastiaan van Stijn
081fac187e golangci-lint: enable exptostd linter
New linter that detects functions from golang.org/x/exp/ that can be
replaced by std functions: https://github.com/ldez/exptostd

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-13 23:59:02 +01:00
Sebastiaan van Stijn
6ee1558852 Merge pull request #49417 from thaJeztah/fix_linting_step1
Fix linting issues to allow enabling more linters
2025-02-13 23:58:24 +01:00
Sebastiaan van Stijn
71e025c560 Merge pull request #49454 from thaJeztah/bump_dns
vendor: github.com/miekg/dns v1.1.61
2025-02-13 23:36:35 +01:00
Sebastiaan van Stijn
3b8eb1ec2a Merge pull request #49407 from jsternberg/containers-platform-json
API: add Platform (OS and Architecture) to /containers/json
2025-02-13 23:35:55 +01:00
Jonathan A. Sternberg
927e07e46e API: add Platform (OS and Architecture) to /containers/json
Adds platform information to containers (for `docker ps`).

Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com>
2025-02-13 14:52:21 -06:00
Sebastiaan van Stijn
c53c553880 Merge pull request #49456 from thaJeztah/bump_netlink
vendor: github.com/vishvananda/netlink 655392bc778a
2025-02-13 20:45:07 +01:00
Sebastiaan van Stijn
eb078a82f9 Merge pull request #49452 from tonistiigi/vendor-buildkit-v0.20.0-rc1
vendor: update buildkit to v0.20.0-rc1
2025-02-13 20:36:37 +01:00
Sebastiaan van Stijn
47ee8a0485 Merge pull request #49351 from LaurentGoderre/hostconfig-warnings
Add experimental feature warning for image mount
2025-02-13 13:39:07 +01:00
Tonis Tiigi
e364e28ec8 vendor: update buildkit to v0.20.0-rc1
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2025-02-12 11:00:04 -08:00
Sebastiaan van Stijn
d47eb241bf vendor: github.com/vishvananda/netlink 655392bc778a
full diff: 084abd93d3...655392bc77

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-12 16:14:20 +01:00
Laurent Goderre
47ff7969b4 Add experimental feature warning for image mount
Signed-off-by: Laurent Goderre <laurent.goderre@docker.com>
2025-02-12 09:59:59 -05:00
Laurent Goderre
3e51818c5c Add ability to return warnings from host config
Signed-off-by: Laurent Goderre <laurent.goderre@docker.com>
2025-02-12 09:48:23 -05:00
Sebastiaan van Stijn
c5b226e377 vendor: github.com/miekg/dns v1.1.61
not the latest-latest version, but v1.1.58 is used elsewhere, and I saw
some fixes in v1.1.59 and v1.1.60, and v1.1.61 was docs-only changes.

- Allow use of fs.FS for $INCLUDE and wrap errors
- Add NXT record
- Add ISDN record
- Fix counting of escape sequences when splitting TXT string
- IsDomainName: check for escape as last character
- Add a hook to catch invalid messages
- Fix possible out-of-bounds read in endingToTxtSlice

full diff: https://github.com/miekg/dns/compare/v1.1.57...v1.1.61

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-12 13:20:26 +01:00
Sebastiaan van Stijn
b570831cc3 Merge pull request #49450 from thaJeztah/bump_pflag
vendor: github.com/spf13/pflag v1.0.6
2025-02-11 17:49:21 +01:00
Sebastiaan van Stijn
aa1805eab2 Merge pull request #49448 from thaJeztah/bump_grpc
vendor: google.golang.org/grpc v1.69.4
2025-02-11 17:48:55 +01:00
Sebastiaan van Stijn
7085d741c2 Merge pull request #49449 from thaJeztah/bump_cni
vendor: github.com/containerd/go-cni v1.1.12
2025-02-11 17:48:12 +01:00
Sebastiaan van Stijn
c6a5d1274f Merge pull request #49447 from thaJeztah/jsonmessage_fix_deprecation
Fix deprecation of "error" and "progress" fields in streaming responses
2025-02-11 17:47:04 +01:00
Sebastiaan van Stijn
56a6383883 api: deprecation of "error" and "progress" fields in streaming responses
- error (ErrorMessage) was deprecated in 3043c26419
  which was part of docker v0.6.0 / API v1.4
- progress (ProgressMessage) was deprecated in 597e0e69b4
  which was part of docker v0.7.1 / API v1.8

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-11 16:29:10 +01:00
Sebastiaan van Stijn
e36fb45eec vendor: github.com/spf13/pflag v1.0.6
- Add exported functions to preserve pkg/flag compatibility
- Add IPNetSlice and unit tests

full diff: https://github.com/spf13/pflag/compare/v1.0.5...v1.0.6

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-11 15:45:03 +01:00
Sebastiaan van Stijn
bd13fc37b0 pkg/jsonmessage: JSONMessage: fix deprecation of ProgressMessage, ErrorMessage
- ErrorMessage was deprecated in 3043c26419
  which was part of docker v0.6.0 / API v1.4
- ProgressMessage was deprecated in 597e0e69b4
  which was part of docker v0.7.1 / API v1.8

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-11 15:40:37 +01:00
Sebastiaan van Stijn
66910da5a3 vendor: github.com/containerd/go-cni v1.1.12
full diff: https://github.com/containerd/go-cni/compare/v1.1.11...v1.1.12

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-11 15:36:12 +01:00
Sebastiaan van Stijn
3d72df0e89 vendor: google.golang.org/grpc v1.69.4
full diff: https://github.com/grpc/grpc-go/compare/v1.68.1...v1.69.4

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-11 15:30:34 +01:00
Sebastiaan van Stijn
66a2e2d16f Merge pull request #49446 from thaJeztah/deprecate_idresponse
api/types: deprecate IDResponse
2025-02-11 15:26:40 +01:00
Rob Murray
f216d6889c Merge pull request #49443 from robmry/restore_iptables_rules
Restore new iptables rules on firewalld reload
2025-02-11 14:19:24 +00:00
Sebastiaan van Stijn
72c91e378d client: remove serverResponse and use http.Response directly
Looking in history to learn why this struct existed, shows that this type
was mostly the result of tech-debt accumulating over time;

- originally ([moby@1aa7f13]) most of the request handling was internal;
  the [`call()` function][1] would make a request, read the `response.Body`,
  and return it as a `[]byte` (or an error if one happened).
- some features needed the statuscode, so [moby@a4bcf7e] added an extra
  output variable to return the `response.StatusCode`.
- some new features required streaming, so [moby@fdd8d4b] changed the
  function to return the `response.Body` as a `io.ReadCloser`, instead
  of a `[]byte`.
- some features needed access to the content-type header, so a new
  `clientRequest` method was introduced in [moby@6b2eeaf] to read the
  `Content-Type` header from `response.Headers` and return it as a string.
- of course, `Content-Type` may not be the only header needed, so [moby@0cdc3b7]
  changed the signature to return `response.Headers` as a whole as a
  `http.Header`
- things became a bit unwieldy now, with the function having four (4) output
  variables, so [moby@126529c] chose to refactor this code, introducing a
  `serverResponse` struct to wrap them all, not realizing that all these
  values were effectively deconstructed from the `url.Response`, so now
  re-assembling them into our own "URL response", only preserving a subset
  of the information available.
- now that we had a custom struct, it was possible to add more information
  to it without changing the signature. When there was a need to know the
  URL of the request that initiated the response, [moby@27ef09a] introduced
  a `reqURL` field to hold the `request.URL` which notably also is available
  in `response.Request.URL`.

In short;

- The original implementation tried to (pre-maturely) abstract the underlying
  response to provide a simplified interface.
- While initially not needed, abstracting caused relevant information from
  the response (and request) to be unavailable to callers.
- As a result, we ended up in a situation where we are deconstructing the
  original `url.Response`, only to re-assemble it into our own, custom struct
  (`serverResponsee`) with only a subset of the information preserved.

This patch removes the `serverResponse` struct, instead returning the
`url.Response` as-is, so that all information is preserved, allowing callers
to use the information they need.

There is one follow-up change to consider; commit [moby@589df17] introduced
a `ensureReaderClosed` utility. Before that commit, the response body would
be closed in a more idiomatic way through a [`defer serverResp.body.Close()`][2].
A later change in [docker/engine-api@5dd6452] added an optimization to that
utility, draining the response to allow connections to be reused. While
skipping that utility (and not draining the response) would not be a critical
issue, it may be easy to overlook that utility, and to close the response
body in the "idiomatic" way, resulting in a possible performance regression.

We need to check if that optimization is still relevant or if later changes
in Go itself already take care of this; we should also look if context
cancellation is handled correctly for these. If it's still relevant, we could

- Wrap the the `url.Response` in a custom struct ("drainCloser") to provide
  a `Close()` function handling the draining and closing; this would re-
  introduce a custom type to be returned, so perhaps not what we want.
- Wrap the `url.Response.Body` in the response returned (so, calling)
  `response.Body.Close()` would call the wrapped closer.
- Change the signature of `Client.sendRequest()` (and related) to return
  a `close()` func to handle this; doing so would more strongly encourage
  callers to close the response body.

[1]: 1aa7f1392d/commands.go (L1008-L1027)
[2]: 589df17a1a/api/client/ps.go (L84-L89)
[moby@1aa7f13]: 1aa7f1392d
[moby@a4bcf7e]: a4bcf7e1ac
[moby@fdd8d4b]: fdd8d4b7d9
[moby@6b2eeaf]: 6b2eeaf896
[moby@0cdc3b7]: 0cdc3b7539
[moby@126529c]: 126529c6d0
[moby@27ef09a]: 27ef09a46f
[moby@589df17]: 589df17a1a
[docker/engine-api@5dd6452]: 5dd6452d4d

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-11 13:20:27 +01:00
Sebastiaan van Stijn
b99b5422b0 api/types: deprecate IDResponse
Deprecate `api/type.IDResponse` in favor of `container.CommitResponse` and
`container.ExecCreateResponse`, which are currently an alias, but may become
distinct types in a future release. This type  will be removed in the next
release.

updates 0df3a0047a
updates 9a20edf7b6

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-11 13:02:41 +01:00
Rob Murray
96dc9cb693 Don't log a warning when an IP address is already in an ipset
It's situation-normal when firewalld is reloaded.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-02-11 11:59:41 +00:00
Rob Murray
b23b8f1567 Restore more iptables rules on firewalld reload
In the bridge network driver, filterPortMappedOnLoopback and
filterDirectAccess each set up some per-port iptables rules - but
they're not called by setPerPortIptables.

So, make sure they're called when firewalld is reloaded.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-02-11 11:59:41 +00:00
Sebastiaan van Stijn
6856bdd5a6 Merge pull request #49444 from thaJeztah/commit_and_exect_response
api/types/container: introduce CommitResponse, ExecCreateResponse types
2025-02-11 12:53:09 +01:00
Sebastiaan van Stijn
13ffbd6cc4 Merge pull request #49442 from thaJeztah/api_rename_container_responses
api/types/container: rename ContainerUpdateOKBody to UpdateResponse, ContainerTopOKBody to TopResponse
2025-02-11 12:52:17 +01:00
Sebastiaan van Stijn
9a20edf7b6 api/types/container: introduce ExecCreateResponse type
Introduce a container.ExecCreateResponse type as alias for IDResponse to allow
consumers to use ContainerCommit without having to import the "types" package,
and allows us to differentiate the response for container commit separate from
other endpoints currently using IDResponse.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-10 21:14:11 +01:00
Sebastiaan van Stijn
0df3a0047a api/types/container: introduce CommitResponse type
Move api/types.IDResponse to a "common" package (to prevent cyclic import
issues), and introduce a container.CommitResponse type as alias. This allows
consumers to use ContainerCommit without having to import the "types" package,
and allows us to differentiate the response for container commit separate from
other endpoints currently using IDResponse.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-10 21:14:03 +01:00
Sebastiaan van Stijn
be1ac5d8e5 api/types/container: rename ContainerTopOKBody to TopResponse
Deprecate ContainerTopOKBody, but keep an alias.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-10 18:58:31 +01:00
Sebastiaan van Stijn
f4dc38cd36 api/types/container: rename ContainerUpdateOKBody to UpdateResponse
Deprecate ContainerUpdateOKBody, but keep an alias.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-10 18:35:35 +01:00
Brian Goff
8ca7679631 Merge pull request #49415 from NathanBaulch/traceopts
client: custom trace options
2025-02-10 07:54:26 -08:00
Paweł Gronowski
2e16c5d1fb Merge pull request #49411 from thaJeztah/vendor_compute
vendor: cloud.google.com/go/compute/metadata v0.5.2
2025-02-10 13:30:59 +00:00
Paweł Gronowski
e7ef1b39d0 Merge pull request #49409 from thaJeztah/configureMaxThreads_no_args
daemon: configureMaxThreads: remove unused arg
2025-02-10 13:30:06 +00:00
Paweł Gronowski
9ce063f9c5 Merge pull request #49421 from thaJeztah/bump_gotest_tools
vendor: gotest.tools/v3 v3.5.2
2025-02-10 13:29:19 +00:00
Paweł Gronowski
78533fb2ec Merge pull request #49424 from thaJeztah/bump_gotestsum
Dockerfile: bump gotest.tools/gotestsum v1.12.0
2025-02-10 13:28:37 +00:00
Paweł Gronowski
ac0033f681 Merge pull request #49425 from thaJeztah/bump_buildx
Dockerfile: update buildx v0.20.1
2025-02-10 10:35:24 +00:00
Paweł Gronowski
50d06ff6b3 Merge pull request #49426 from thaJeztah/bump_cli
Dockerfile: update docker CLI to v28.0.0-rc.1
2025-02-10 10:34:47 +00:00
Paweł Gronowski
34404ecfaf Merge pull request #49422 from thaJeztah/fix_deprecation_comment
client: fix deprecation comment for ImageInspectWithRaw
2025-02-10 10:33:45 +00:00
Sebastiaan van Stijn
6cd0fb2c0c Merge pull request #49423 from thaJeztah/update_authors
update authors and mailmap
2025-02-10 09:34:49 +01:00
Sebastiaan van Stijn
85ff36de26 Dockerfile: update docker CLI to v28.0.0-rc.1
Update the Docker CLI used in the dev-container

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-09 17:17:37 +01:00
Sebastiaan van Stijn
cc6754f3fa Dockerfile: update buildx v0.20.1
Update the buildx cli plugin used in the dev-container

full diff: https://github.com/docker/buildx/compare/v0.20.0...v0.20.1

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-09 17:15:05 +01:00
Sebastiaan van Stijn
b90a2bac7d Dockerfile: bump gotest.tools/gotestsum v1.12.0
full diff: https://github.com/gotestyourself/gotestsum/compare/v1.8.2...v1.12.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-09 16:39:31 +01:00
Sebastiaan van Stijn
c786cdf124 update authors and mailmap
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-09 14:55:24 +01:00
Sebastiaan van Stijn
b4af9341af client: fix deprecation comment for ImageInspectWithRaw
The comment was not formatted correctly as it was not the last line,
resulting in some editors / linters not detecting the deprecation.

Updates 639a1214fa

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-09 14:03:29 +01:00
Sebastiaan van Stijn
6ba4e78066 vendor: gotest.tools/v3 v3.5.2
- un-deprecates `assert.ErrorType`, `cmp.ErrorType`
- assert: ensure message is always displayed and fix under bazel
- poll: Continue(): use format.Message for formatting
- fix TestFromDirSymlink on Windows due to missing drive-letter
- fix various linting issues and minor bugs

full diff: https://github.com/gotestyourself/gotest.tools/compare/v3.5.1...v3.5.2

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-09 13:33:43 +01:00
Sebastiaan van Stijn
43532eb1e1 daemon: Daemon.Containers: make switches exhaustive (exhaustive)
daemon/list.go:126:3: missing cases in switch of type daemon.iterationAction: daemon.includeContainer (exhaustive)
            switch includeContainerInList(currentContainer, filter) {
            ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-09 13:22:53 +01:00
Sebastiaan van Stijn
10ebdbbb92 daemon: Daemon.ProcessEvent: make switches exhaustive (exhaustive)
Adding a `default` statement so that disabling the "default-signifies-exhaustive"
linter option will  make it show up.

    daemon/monitor.go:158:2: missing cases in switch of type types.EventType: types.EventUnknown, types.EventCreate, types.EventExecAdded, types.EventExecStarted (exhaustive)
        switch e {
        ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-09 13:22:52 +01:00
Sebastiaan van Stijn
f448d5ae3b daemon/events: make switches exhaustive (exhaustive)
Adding a `default` statement so that disabling the "default-signifies-exhaustive"
linter option will  make it show up.

    daemon/events/events.go:95:2: missing cases in switch of type events.Type: events.BuilderEventType, events.ConfigEventType, events.DaemonEventType, events.NetworkEventType, events.NodeEventType, events.PluginEventType, events.SecretEventType, events.ServiceEventType, events.VolumeEventType (exhaustive)
        switch eventType {
        ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-09 13:22:52 +01:00
Sebastiaan van Stijn
d9cf097402 daemon/cluster/executor/container: make switches exhaustive (exhaustive)
Adding a `default` statement so that disabling the "default-signifies-exhaustive"
linter option will  make it show up.

    daemon/cluster/executor/container/adapter.go:351:3: missing cases in switch of type api.Mount_MountType: api.MountTypeVolume, api.MountTypeTmpfs, api.MountTypeNamedPipe, api.MountTypeCluster (exhaustive)
            switch mount.Type {
            ^
    daemon/cluster/executor/container/adapter.go:540:4: missing cases in switch of type api.LogStream: api.LogStreamUnknown (exhaustive)
                switch stream {
                ^
    daemon/cluster/executor/container/container.go:715:3: missing cases in switch of type api.Privileges_SeccompOpts_SeccompMode: api.Privileges_SeccompOpts_DEFAULT (exhaustive)
            switch seccomp.Mode {
            ^
    daemon/cluster/executor/container/controller.go:257:4: missing cases in switch of type events.Action: events.ActionCreate, events.ActionStart, events.ActionRestart, events.ActionStop, events.ActionCheckpoint, events.ActionPause, events.ActionUnPause, events.ActionAttach, events.ActionDetach, events.ActionResize, events.ActionUpdate, events.ActionRename, events.ActionKill, events.ActionOOM, events.ActionRemove, events.ActionCommit, events.ActionTop, events.ActionCopy, events.ActionArchivePath, events.ActionExtractToDir, events.ActionExport, events.ActionImport, events.ActionSave, events.ActionLoad, events.ActionTag, events.ActionUnTag, events.ActionPush, events.ActionPull, events.ActionPrune, events.ActionDelete, events.ActionEnable, events.ActionDisable, events.ActionConnect, events.ActionDisconnect, events.ActionReload, events.ActionMount, events.ActionUnmount, events.ActionExecCreate, events.ActionExecStart, events.ActionExecDie, events.ActionExecDetach, events.ActionHealthStatus, events.ActionHealthStatusRunning (exhaustive)
                switch event.Action {
                ^
    daemon/cluster/executor/container/controller.go:480:4: missing cases in switch of type events.Action: events.ActionCreate, events.ActionStart, events.ActionRestart, events.ActionStop, events.ActionCheckpoint, events.ActionPause, events.ActionUnPause, events.ActionAttach, events.ActionDetach, events.ActionResize, events.ActionUpdate, events.ActionRename, events.ActionKill, events.ActionDie, events.ActionOOM, events.ActionDestroy, events.ActionRemove, events.ActionCommit, events.ActionTop, events.ActionCopy, events.ActionArchivePath, events.ActionExtractToDir, events.ActionExport, events.ActionImport, events.ActionSave, events.ActionLoad, events.ActionTag, events.ActionUnTag, events.ActionPush, events.ActionPull, events.ActionPrune, events.ActionDelete, events.ActionEnable, events.ActionDisable, events.ActionConnect, events.ActionDisconnect, events.ActionReload, events.ActionMount, events.ActionUnmount, events.ActionExecCreate, events.ActionExecStart, events.ActionExecDie, events.ActionExecDetach, events.ActionHealthStatus, events.ActionHealthStatusRunning, events.ActionHealthStatusHealthy, events.ActionHealthStatusUnhealthy (exhaustive)
                switch event.Action {
                ^
    daemon/cluster/executor/container/controller.go:723:4: missing cases in switch of type events.Action: events.ActionCreate, events.ActionStart, events.ActionRestart, events.ActionStop, events.ActionCheckpoint, events.ActionPause, events.ActionUnPause, events.ActionAttach, events.ActionDetach, events.ActionResize, events.ActionUpdate, events.ActionRename, events.ActionKill, events.ActionDie, events.ActionOOM, events.ActionDestroy, events.ActionRemove, events.ActionCommit, events.ActionTop, events.ActionCopy, events.ActionArchivePath, events.ActionExtractToDir, events.ActionExport, events.ActionImport, events.ActionSave, events.ActionLoad, events.ActionTag, events.ActionUnTag, events.ActionPush, events.ActionPull, events.ActionPrune, events.ActionDelete, events.ActionEnable, events.ActionDisable, events.ActionConnect, events.ActionDisconnect, events.ActionReload, events.ActionMount, events.ActionUnmount, events.ActionExecCreate, events.ActionExecStart, events.ActionExecDie, events.ActionExecDetach, events.ActionHealthStatus, events.ActionHealthStatusRunning, events.ActionHealthStatusHealthy (exhaustive)
                switch event.Action {
                ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-09 13:22:52 +01:00
Sebastiaan van Stijn
bf3b4d4986 daemon/cluster/convert: make switches exhaustive (exhaustive)
Adding a `default` statement so that disabling the "default-signifies-exhaustive"
linter option will  make it show up.

    daemon/cluster/convert/service.go:59:3: missing cases in switch of type api.UpdateStatus_UpdateState: api.UpdateStatus_UNKNOWN (exhaustive)
            switch s.UpdateStatus.State {
            ^
    daemon/cluster/convert/volume.go:304:2: missing cases in switch of type api.VolumeSpec_VolumeAvailability: api.VolumeAvailabilityDrain (exhaustive)
        switch availability {
        ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-09 13:22:52 +01:00
Sebastiaan van Stijn
4d8dfc1409 daemon/cluster: make switches exhaustive (exhaustive)
Adding a `default` statement so that disabling the "default-signifies-exhaustive"
linter option will  make it show up.

    daemon/cluster/services.go:560:5: missing cases in switch of type api.LogStream: api.LogStreamUnknown (exhaustive)
                    switch msg.Stream {
                    ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-09 13:22:52 +01:00
Sebastiaan van Stijn
6929a3fd22 libnetwork/networkdb: make switches exhaustive (exhaustive)
Adding a `default` statement so that disabling the "default-signifies-exhaustive"
linter option will  make it show up.

    libnetwork/networkdb/delegate.go:49:2: missing cases in switch of type networkdb.NodeEvent_Type: networkdb.NodeEventTypeInvalid (exhaustive)
        switch nEvent.Type {
        ^
    libnetwork/networkdb/delegate.go:223:2: missing cases in switch of type networkdb.TableEvent_Type: networkdb.TableEventTypeInvalid (exhaustive)
        switch tEvent.Type {
        ^
    libnetwork/networkdb/nodemgmt.go:51:2: missing cases in switch of type networkdb.nodeState: networkdb.nodeNotFound (exhaustive)
        switch newState {
        ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-09 13:22:51 +01:00
Sebastiaan van Stijn
827f84d3ef volume/mounts: parseMountSpec: make switch exhaustive (exhaustive)
Adding a `default` statement so that disabling the "default-signifies-exhaustive"
linter option will  make it show up.

    volume/mounts/linux_parser.go:353:2: missing cases in switch of type mount.Type: mount.TypeNamedPipe, mount.TypeCluster (exhaustive)
        switch cfg.Type {
        ^
    volume/mounts/windows_parser.go:392:2: missing cases in switch of type mount.Type: mount.TypeTmpfs, mount.TypeCluster, mount.TypeImage (exhaustive)
        switch cfg.Type {
        ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-09 13:22:51 +01:00
Sebastiaan van Stijn
0ee343222b daemon: eventTimestamp: make switch exhaustive (exhaustive)
Adding a `default` statement, and not an explicit "WatchActionKindUnknown",
so that disabling the "default-signifies-exhaustive" linter option will
make it show up.

    daemon/events.go:273:2: missing cases in switch of type api.WatchActionKind: api.WatchActionKindUnknown (exhaustive)
        switch action {
        ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-09 13:22:51 +01:00
Sebastiaan van Stijn
b343d235a0 container: State.conditionAlreadyMet: make switch exhaustive (exhaustive)
Adding a `default` statement, and not an explicit "WaitConditionNextExit",
so that disabling the "default-signifies-exhaustive" linter option will
make it show up.

    container/state.go:237:2: missing cases in switch of type container.WaitCondition: container.WaitConditionNextExit (exhaustive)
        switch condition {
        ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-09 13:22:51 +01:00
Sebastiaan van Stijn
8a35300b4a integration/internal/swarm: make switch excaustive (exhaustive)
integration/internal/swarm/states.go:62:4: missing cases in switch of type swarm.TaskState: swarm.TaskStateNew, swarm.TaskStateAllocated, swarm.TaskStatePending, swarm.TaskStateAssigned, swarm.TaskStateAccepted, swarm.TaskStatePreparing, swarm.TaskStateReady, swarm.TaskStateStarting, swarm.TaskStateComplete, swarm.TaskStateShutdown, swarm.TaskStateRejected, swarm.TaskStateRemove, swarm.TaskStateOrphaned (exhaustive)
                switch task.Status.State {
                ^
    integration/internal/swarm/states.go:121:4: missing cases in switch of type swarm.TaskState: swarm.TaskStateNew, swarm.TaskStateAllocated, swarm.TaskStatePending, swarm.TaskStateAssigned, swarm.TaskStateAccepted, swarm.TaskStatePreparing, swarm.TaskStateReady, swarm.TaskStateStarting, swarm.TaskStateShutdown, swarm.TaskStateFailed, swarm.TaskStateRejected, swarm.TaskStateRemove, swarm.TaskStateOrphaned (exhaustive)
                switch task.Status.State {
                ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-09 13:22:51 +01:00
Sebastiaan van Stijn
66ab2e9e77 plugin/executor/containerd: Executor.ProcessEvent: make switch excaustive (exhaustive)
plugin/executor/containerd/containerd.go:164:2: missing cases in switch of type types.EventType: types.EventUnknown, types.EventOOM, types.EventCreate, types.EventStart, types.EventExecAdded, types.EventExecStarted, types.EventPaused, types.EventResumed (exhaustive)
        switch et {
        ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-09 13:22:50 +01:00
Sebastiaan van Stijn
1a047bbe8b libnetwork: ignore unchecked json (Un)Marshal errors (errchkjson)
These need revisiting, similar to similar code in libnetwork/drivers/bridge.
There was already a TODO in place for this, so ignoring these for now.

    libnetwork/endpoint.go:148:11: Error return value of `encoding/json.Marshal` is not checked: unsafe type `interface{}` found (errchkjson)
        ib, _ := json.Marshal(epMap["ep_iface"])
                 ^
    libnetwork/endpoint.go:151:11: Error return value of `encoding/json.Marshal` is not checked: unsafe type `interface{}` found (errchkjson)
        jb, _ := json.Marshal(epMap["joinInfo"])
                 ^
    libnetwork/endpoint.go:154:11: Error return value of `encoding/json.Marshal` is not checked: unsafe type `interface{}` found (errchkjson)
        tb, _ := json.Marshal(epMap["exposed_ports"])
                 ^
    libnetwork/endpoint.go:159:11: Error return value of `encoding/json.Marshal` is not checked: unsafe type `interface{}` found (errchkjson)
        cb, _ := json.Marshal(epMap["sandbox"])
                 ^
    libnetwork/endpoint.go:237:12: Error return value of `encoding/json.Marshal` is not checked: unsafe type `interface{}` found (errchkjson)
        sal, _ := json.Marshal(epMap["svcAliases"])
                  ^
    libnetwork/endpoint.go:242:11: Error return value of `encoding/json.Marshal` is not checked: unsafe type `interface{}` found (errchkjson)
        pc, _ := json.Marshal(epMap["ingressPorts"])
                 ^
    libnetwork/endpoint.go:247:11: Error return value of `encoding/json.Marshal` is not checked: unsafe type `interface{}` found (errchkjson)
        ma, _ := json.Marshal(epMap["myAliases"])
                 ^
    libnetwork/endpoint.go:252:11: Error return value of `encoding/json.Marshal` is not checked: unsafe type `interface{}` found (errchkjson)
        dn, _ := json.Marshal(epMap["dnsNames"])
                 ^
    libnetwork/endpoint_info.go:123:11: Error return value of `encoding/json.Marshal` is not checked: unsafe type `interface{}` found (errchkjson)
        rb, _ := json.Marshal(epMap["routes"])
                 ^
    libnetwork/endpoint_info.go:490:12: Error return value of `encoding/json.Marshal` is not checked: unsafe type `interface{}` found (errchkjson)
            tb, _ := json.Marshal(v)
                     ^
    libnetwork/network.go:161:11: Error return value of `encoding/json.Marshal` is not checked: unsafe type `interface{}` found (errchkjson)
            b, _ := json.Marshal(v)
                    ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-09 13:22:50 +01:00
Sebastiaan van Stijn
63deb55263 libnetwork/drivers/bridge: bridgeEndpoint.UnmarshalJSON: fix unhandled errors (errchkjson)
Log errors, but continue, to keep the existing behavior, but add a TODO
to revisit the logic.

    libnetwork/drivers/bridge/bridge_store.go:316:10: Error return value of `encoding/json.Marshal` is not checked: unsafe type `interface{}` found (errchkjson)
        d, _ := json.Marshal(epMap["ContainerConfig"])
                ^
    libnetwork/drivers/bridge/bridge_store.go:320:9: Error return value of `encoding/json.Marshal` is not checked: unsafe type `interface{}` found (errchkjson)
        d, _ = json.Marshal(epMap["ExternalConnConfig"])
               ^
    libnetwork/drivers/bridge/bridge_store.go:324:9: Error return value of `encoding/json.Marshal` is not checked: unsafe type `interface{}` found (errchkjson)
        d, _ = json.Marshal(epMap["PortMapping"])
               ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-09 13:22:50 +01:00
Sebastiaan van Stijn
ccbcce2169 daemon/logger/templates: ignore unchecked error (errchkjson)
daemon/logger/templates/templates.go:17:3: Error return value of `(*encoding/json.Encoder).Encode` is not checked: unsafe type `interface{}` found (errchkjson)
            enc.Encode(v)
            ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-09 13:22:50 +01:00
Sebastiaan van Stijn
32153dee9f daemon: Daemon.Reload: fix unhandled errors printing config (errchkjson)
Print a warning when failing to marshal the JSON for printing

    daemon/reload.go:118:19: Error return value of `encoding/json.Marshal` is not checked: unsafe type `net.IP` found (errchkjson)
        jsonString, _ := json.Marshal(&struct {
                         ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-09 13:22:50 +01:00
Sebastiaan van Stijn
664558f916 daemon/cluster/convert: tmpfsOptionsToGRPC: ignore unchecked error (errchkjson)
The function describes that errors are OK to ignore, so we can suppress
the linter warning.

    daemon/cluster/convert/container.go:582:18: Error return value of `encoding/json.Marshal` is not checked (errchkjson)
        jsonBytes, _ := json.Marshal(options)
                        ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-09 13:22:49 +01:00
Sebastiaan van Stijn
4a7f891fc3 integration/plugin: fix unhandled errors in tests (errchkjson)
integration/plugin/logging/cmd/discard/driver.go:84:2: Error return value of `(*encoding/json.Encoder).Encode` is not checked (errchkjson)
        json.NewEncoder(w).Encode(&res)
        ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-09 13:22:49 +01:00
Sebastiaan van Stijn
196a66a643 integration-cli: fix unhandled errors in tests (errchkjson)
integration-cli/docker_cli_external_volume_driver_test.go:116:4: Error return value of `(*encoding/json.Encoder).Encode` is not checked: unsafe type `interface{}` found (errchkjson)
                json.NewEncoder(w).Encode(&data)
                ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-09 13:22:49 +01:00
Sebastiaan van Stijn
26d30159f7 libnetwork/driverapi: ignore unchecked error (for now) (errchkjson)
libnetwork/driverapi/ipamdata.go:52:11: Error return value of `encoding/json.Marshal` is not checked: unsafe type `interface{}` found (errchkjson)
            b, _ := json.Marshal(v)
                    ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-09 13:22:49 +01:00
Sebastiaan van Stijn
b87c9fb3f4 libnetwork/diagnostic: ignore unchecked error (errchkjson)
libnetwork/diagnostic/server.go:234:19: Error return value of `encoding/json.MarshalIndent` is not checked: unsafe type `github.com/docker/docker/libnetwork/diagnostic.StringInterface` found (errchkjson)
                    response, _ = json.MarshalIndent(FailCommand(err), "", "  ")
                                  ^
    libnetwork/diagnostic/server.go:239:19: Error return value of `encoding/json.Marshal` is not checked: unsafe type `github.com/docker/docker/libnetwork/diagnostic.StringInterface` found (errchkjson)
                    response, _ = json.Marshal(FailCommand(err))
                                  ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-09 13:22:49 +01:00
Sebastiaan van Stijn
7dbceec8aa api/server/router/volume: fix unhandled errors in tests (errchkjson)
Also fixing some minor other linting issues.

    api/server/router/volume/volume_routes_test.go:193:2: Error return value of `(*encoding/json.Encoder).Encode` is not checked (errchkjson)
        e.Encode(volumeCreate)
        ^
    api/server/router/volume/volume_routes_test.go:231:2: Error return value of `(*encoding/json.Encoder).Encode` is not checked (errchkjson)
        json.NewEncoder(&buf).Encode(volumeCreate)
        ^
    api/server/router/volume/volume_routes_test.go:260:2: Error return value of `(*encoding/json.Encoder).Encode` is not checked (errchkjson)
        json.NewEncoder(&buf).Encode(volumeCreate)
        ^
    api/server/router/volume/volume_routes_test.go:292:2: Error return value of `(*encoding/json.Encoder).Encode` is not checked (errchkjson)
        json.NewEncoder(&buf).Encode(volumeCreate)
        ^
    api/server/router/volume/volume_routes_test.go:339:2: Error return value of `(*encoding/json.Encoder).Encode` is not checked (errchkjson)
        json.NewEncoder(&buf).Encode(volumeUpdate)
        ^
    api/server/router/volume/volume_routes_test.go:366:2: Error return value of `(*encoding/json.Encoder).Encode` is not checked (errchkjson)
        json.NewEncoder(&buf).Encode(volumeUpdate)
        ^
    api/server/router/volume/volume_routes_test.go:396:2: Error return value of `(*encoding/json.Encoder).Encode` is not checked (errchkjson)
        json.NewEncoder(&buf).Encode(volumeUpdate)
        ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-09 13:22:49 +01:00
Sebastiaan van Stijn
07e2fc83ae pkg/plugins: fix "Multiplication of durations" (durationcheck)
Change some variables to a time.Duration to reduce conversions between
integers and durations, which also makes the code slightly more transparent.

    pkg/plugins/client_test.go:109:9: Multiplication of durations: `tc.expTimeOff * time.Second` (durationcheck)
                s := tc.expTimeOff * time.Second
                     ^
    pkg/plugins/client_test.go:132:9: Multiplication of durations: `tc.timeOff * time.Second` (durationcheck)
                s := tc.timeOff * time.Second
                     ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-09 13:22:48 +01:00
Sebastiaan van Stijn
1ffbcb566b pkg/jsonmessage: fix "Multiplication of durations" (durationcheck)
pkg/jsonmessage/jsonmessage.go:111:10: Multiplication of durations: `(left / time.Second) * time.Second` (durationcheck)
            left = (left / time.Second) * time.Second
                   ^

This code was rounding down time remaining to the nearest second;

- Use go's time.Duration.Round() instead
- Make the calculation conditional, as it was only used if there's enough
  space available to print
- Move the declaration of the timeLeftBox var closer to where used.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-09 13:22:48 +01:00
Sebastiaan van Stijn
eac45daf06 runconfig: fix declaration has 3 blank identifiers (dogsled)
runconfig/config_test.go:114:2: declaration has 3 blank identifiers (dogsled)
        _, _, _, err = decodeContainerConfig(bytes.NewReader(requestJSON), sysinfo.New())
        ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-09 13:22:48 +01:00
Sebastiaan van Stijn
09c5a01346 pks/plugins/pluginrpc-gen: fix unused value assign (wastedassign)
pkg/plugins/pluginrpc-gen/parser_test.go:80:2: assigned to arg, but reassigned without using the value (wastedassign)
        arg = f.Args[0]
        ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-09 13:22:48 +01:00
Sebastiaan van Stijn
a4dba91424 daemon/containerd: fix unused value assign (wastedassign)
daemon/containerd/image_exporter.go:406:2: assigned to msg, but reassigned without using the value (wastedassign)
        msg := ""
        ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-09 13:22:48 +01:00
Sebastiaan van Stijn
f1d7bd60ab integration/image: TestRemoveByDigest fixed unused values (wastedassign)
Add some assertions, and removed a log, instead using it as message
if the assertion fails.

    integration/image/remove_test.go:88:2: assigned to inspect, but reassigned without using the value (wastedassign)
        inspect, err = client.ImageInspect(ctx, "busybox")
        ^
    integration/image/remove_test.go:91:2: assigned to inspect, but never used afterwards (wastedassign)
        inspect, err = client.ImageInspect(ctx, "test-remove-by-digest")
        ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-09 13:22:47 +01:00
Sebastiaan van Stijn
9f8eafc101 plugin: withFetchProgress work around "nested context in loop (fatcontext)"
This needs a better solution, but this allows enabling the "fatcontext"
linter.

    plugin/fetch_linux.go:250:6: nested context in loop (fatcontext)
                        ctx = context.Background()
                        ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-09 13:22:47 +01:00
Sebastiaan van Stijn
e9c90834fa opts: host:port should be constructed with net.JoinHostPort (nosprintfhostport)
opts/hosts_test.go:110:30: host:port in url should be constructed with net.JoinHostPort and not directly with fmt.Sprintf (nosprintfhostport)
            "tcp://:5555":             fmt.Sprintf("tcp://%s:5555", DefaultHTTPHost),
                                       ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-09 13:22:47 +01:00
Sebastiaan van Stijn
0bf8c8b99e pkg/tailfile: avoid allocations with (*os.File).WriteString (mirror)
pkg/tailfile/tailfile_test.go:149:16: avoid allocations with (*os.File).WriteString (mirror)
            if _, err := f.Write([]byte("tailfile pretty interesting line\n")); err != nil {
                         ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-09 13:22:47 +01:00
Sebastiaan van Stijn
4e6c91cc56 pkg/pools: avoid allocations with (*bufio.Writer).WriteString (mirror)
pkg/pools/pools_test.go:100:18: avoid allocations with (*bufio.Writer).WriteString (mirror)
        written, err := writer.Write([]byte("foobar"))
                        ^
    pkg/pools/pools_test.go:112:14: avoid allocations with (*bufio.Writer).WriteString (mirror)
        if _, err = writer.Write([]byte("barfoo")); err != nil {
                    ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-09 13:22:47 +01:00
Sebastiaan van Stijn
f0a233bdc3 pkg/archive: avoid allocations with strings.Compare (mirror)
pkg/archive/changes_linux.go:146:10: avoid allocations with strings.Compare (mirror)
            switch bytes.Compare([]byte(ni1.name), []byte(ni2.name)) {
                   ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-09 13:22:47 +01:00
Sebastiaan van Stijn
17f32e8822 libnetwork/internal/resolvconf: avoid allocations with bytes.NewBufferString (mirror)
libnetwork/internal/resolvconf/resolvconf_test.go:63:21: avoid allocations with bytes.NewBufferString (mirror)
                rc, err := Parse(bytes.NewBuffer([]byte("options "+tc.options)), "")
                                 ^
    libnetwork/internal/resolvconf/resolvconf_test.go:106:19: avoid allocations with bytes.NewBufferString (mirror)
        rc, err := Parse(bytes.NewBuffer([]byte("nameserver 1.2.3.4")), "")
                         ^
    libnetwork/internal/resolvconf/resolvconf_test.go:214:21: avoid allocations with bytes.NewBufferString (mirror)
                rc, err := Parse(bytes.NewBuffer([]byte(input)), "")
                                 ^
    libnetwork/internal/resolvconf/resolvconf_test.go:311:21: avoid allocations with bytes.NewBufferString (mirror)
                rc, err := Parse(bytes.NewBuffer([]byte(tc.input)), "/etc/resolv.conf")
                                 ^
    libnetwork/internal/resolvconf/resolvconf_test.go:418:21: avoid allocations with bytes.NewBufferString (mirror)
                rc, err := Parse(bytes.NewBuffer([]byte(tc.input)), "/etc/resolv.conf")
                                 ^
    libnetwork/internal/resolvconf/resolvconf_test.go:492:21: avoid allocations with bytes.NewBufferString (mirror)
                rc, err := Parse(bytes.NewBuffer([]byte(content)), "/etc/resolv.conf")
                                 ^
    libnetwork/internal/resolvconf/resolvconf_test.go:535:19: avoid allocations with bytes.NewBufferString (mirror)
        rc, err := Parse(bytes.NewBuffer([]byte("nameserver 1.2.3.4.5")), "")
                         ^
    libnetwork/internal/resolvconf/resolvconf_test.go:548:19: avoid allocations with bytes.NewBufferString (mirror)
        rc, err := Parse(bytes.NewBuffer([]byte("nameserver 127.0.0.53")), "/etc/resolv.conf")
                         ^
    libnetwork/internal/resolvconf/resolvconf_test.go:569:19: avoid allocations with bytes.NewBufferString (mirror)
        rc, err := Parse(bytes.NewBuffer([]byte(input)), "/etc/resolv.conf")
                         ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-09 13:22:46 +01:00
Sebastiaan van Stijn
0c8d086ed3 libnetwork: avoid allocations with regexp.Match (mirror)
libnetwork/drivers/bridge/bridge_linux_test.go:978:17: avoid allocations with regexp.Match (mirror)
            matched, _ := regexp.MatchString(regex, string(out[:]))
                          ^
    libnetwork/drivers/bridge/bridge_linux_test.go:1004:17: avoid allocations with regexp.Match (mirror)
            matched, _ := regexp.MatchString(regex, string(out[:]))
                          ^
    libnetwork/drivers/bridge/bridge_linux_test.go:1032:18: avoid allocations with regexp.Match (mirror)
                matched, _ := regexp.MatchString(regex, string(out[:]))
                              ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-09 13:22:46 +01:00
Sebastiaan van Stijn
6ff3dfd88a integration-cli: avoid allocations with (*os.File).WriteString (mirror)
integration-cli/docker_cli_attach_unix_test.go:107:3: avoid allocations with (*os.File).WriteString (mirror)
            cpty.Write([]byte("\n"))
            ^
    integration-cli/docker_cli_attach_unix_test.go:144:11: avoid allocations with (*os.File).WriteString (mirror)
        _, err = cpty.Write([]byte("hello\n"))
                 ^
    integration-cli/docker_cli_exec_test.go:422:16: avoid allocations with (*os.File).WriteString (mirror)
            if _, err := f.Write([]byte("success2\n")); err != nil {
                         ^
    integration-cli/docker_cli_exec_unix_test.go:57:11: avoid allocations with (*os.File).WriteString (mirror)
        _, err = p.Write([]byte("cat /foo && exit\n"))
                 ^
    integration-cli/docker_cli_run_test.go:4092:15: avoid allocations with (*os.File).WriteString (mirror)
        if _, err := tmpFile.Write([]byte(data)); err != nil {
                     ^
    integration-cli/docker_cli_run_unix_test.go:110:11: avoid allocations with (*os.File).WriteString (mirror)
        _, err = cpty.Write([]byte("hello\n"))
                 ^
    integration-cli/docker_cli_run_unix_test.go:169:15: avoid allocations with (*os.File).WriteString (mirror)
        if _, err := cpty.Write([]byte("hello\n")); err != nil {
                     ^
    integration-cli/docker_cli_run_unix_test.go:283:15: avoid allocations with (*os.File).WriteString (mirror)
        if _, err := cpty.Write([]byte("hello\n")); err != nil {
                     ^
    integration-cli/docker_cli_run_unix_test.go:364:15: avoid allocations with (*os.File).WriteString (mirror)
        if _, err := cpty.Write([]byte("hello\n")); err != nil {
                     ^
    integration-cli/docker_cli_run_unix_test.go:438:15: avoid allocations with (*os.File).WriteString (mirror)
        if _, err := cpty.Write([]byte("\n")); err != nil {
                     ^
    integration-cli/docker_cli_run_unix_test.go:880:15: avoid allocations with (*os.File).WriteString (mirror)
        if _, err := tmpFile.Write([]byte(jsonData)); err != nil {
                     ^
    integration-cli/docker_cli_run_unix_test.go:915:15: avoid allocations with (*os.File).WriteString (mirror)
        if _, err := tmpFile.Write([]byte(jsonData)); err != nil {
                     ^
    integration-cli/docker_cli_run_unix_test.go:952:15: avoid allocations with (*os.File).WriteString (mirror)
        if _, err := tmpFile.Write([]byte(jsonData)); err != nil {
                     ^
    integration-cli/docker_cli_run_unix_test.go:1418:11: avoid allocations with (*os.File).WriteString (mirror)
        _, err = tmpFile.Write([]byte(jsonData))
                 ^
    integration-cli/docker_cli_run_unix_test.go:1445:11: avoid allocations with (*os.File).WriteString (mirror)
        _, err = tmpFile.Write([]byte(jsonData))
                 ^
    integration-cli/docker_cli_run_unix_test.go:1483:11: avoid allocations with (*os.File).WriteString (mirror)
        _, err = tmpFile.Write([]byte(jsonData))
                 ^
    integration-cli/docker_cli_run_unix_test.go:1517:11: avoid allocations with (*os.File).WriteString (mirror)
        _, err = tmpFile.Write([]byte(jsonData))
                 ^
    integration-cli/docker_cli_update_unix_test.go:235:11: avoid allocations with (*os.File).WriteString (mirror)
        _, err = cpty.Write([]byte("exit\n"))
                 ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-09 13:22:46 +01:00
Sebastiaan van Stijn
405ce2ef15 distribution/xfer: avoid allocations with bytes.NewBufferString (mirror)
distribution/xfer/download_test.go:196:22: avoid allocations with bytes.NewBufferString (mirror)
        return io.NopCloser(bytes.NewBuffer([]byte(d.id + d.id + d.id + d.id + d.id)))
                            ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-09 13:22:46 +01:00
Sebastiaan van Stijn
d50492a70d container/stream: avoid allocations with (*bytes.Buffer).WriteString (mirror)
container/stream/unbuffered_test.go:139:3: avoid allocations with (*bytes.Buffer).WriteString (mirror)
            buf.Write([]byte(testLine + "\n"))
            ^
    container/stream/unbuffered_test.go:142:2: avoid allocations with (*bytes.Buffer).WriteString (mirror)
        buf.Write([]byte(testLine))
        ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-09 13:22:46 +01:00
Sebastiaan van Stijn
dbf2cdd06c integration/networking: fix append to non-zero initialized length (makezero)
integration/networking/bridge_linux_test.go:1233:17: append to slice `wantProxies` with non-zero initialized length (makezero)
            wantProxies = append(wantProxies, makeExpStr(e.proto, e.hostIP, e.hostPort, ctrIP, e.ctrPort))
                          ^
    integration/networking/bridge_linux_test.go:1254:16: append to slice `gotProxies` with non-zero initialized length (makezero)
            gotProxies = append(gotProxies, makeExpStr(proto, hostIP, hostPort, ctrIP, ctrPort))
                         ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-09 13:22:45 +01:00
Sebastiaan van Stijn
dd8ee9eeb1 libnetwork/cnmallocator: fix append to non-zero initialized length (makezero)
libnetwork/cnmallocator/networkallocator.go:876:17: append to slice `ipamConfigs` with non-zero initialized length (makezero)
            ipamConfigs = append(ipamConfigs, &api.IPAMConfig{Family: api.IPAMConfig_IPV4})
                          ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-09 13:22:45 +01:00
Sebastiaan van Stijn
8e9fce7970 libnetwork/bitmap: fix append to non-zero initialized length (makezero)
Changing to use binary.LittleEndian.AppendUint64, which does not require
the slice to have an initial size, and makes the code slightly more
straightforward.

    libnetwork/bitmap/sequence.go:296:7: append to slice `ba` with non-zero initialized length (makezero)
        ba = append(ba, bm...)
             ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-09 13:22:45 +01:00
Sebastiaan van Stijn
f9890d97d1 libnet: kvstore/boltdb: fix append to non-zero initialized length (makezero)
Changing to use binary.LittleEndian.AppendUint64, which does not require
the slice to have an initial size, and makes the code slightly more
straightforward.

    libnetwork/internal/kvstore/boltdb/boltdb.go:79:11: append to slice `dbval` with non-zero initialized length (makezero)
            dbval = append(dbval, value...)
                    ^
    libnetwork/internal/kvstore/boltdb/boltdb.go:228:11: append to slice `dbval` with non-zero initialized length (makezero)
            dbval = append(dbval, value...)
                    ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-09 13:22:45 +01:00
Sebastiaan van Stijn
1f7d497a99 errdefs: remove duplicate "causer" interface definition (iface)
errdefs/helpers_test.go:11:6: identical: interface causal contains identical methods or type constraints from another interface, causing redundancy (iface)
    type causal interface {
         ^
    errdefs/is.go:8:6: identical: interface causer contains identical methods or type constraints from another interface, causing redundancy (iface)
    type causer interface {
         ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-09 13:22:45 +01:00
Akihiro Suda
7adac77d6b Merge pull request #49416 from thaJeztah/bump_golangci_lint
Dockerfile: update golangci-lint to v1.63.4
2025-02-09 18:37:37 +09:00
Nathan Baulch
1784026740 client: custom trace options
Signed-off-by: Nathan Baulch <nathan.baulch@gmail.com>
2025-02-08 18:04:18 +11:00
Sebastiaan van Stijn
cab2157182 Dockerfile: update golangci-lint to v1.63.4
full diff: https://github.com/golangci/golangci-lint/compare/v1.62.0...v1.63.4
Changelog: https://golangci-lint.run/product/changelog/#v1634

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-07 13:45:21 +01:00
Sebastiaan van Stijn
f34a1aafe9 vendor: cloud.google.com/go/compute/metadata v0.5.2
- compute/metadata: Check error chain for retryable error
- compute/metadata: Close Response Body for failed request

full diff: https://github.com/googleapis/google-cloud-go/compare/compute/metadata/v0.5.0...compute/metadata/v0.5.2

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-07 13:31:37 +01:00
Sebastiaan van Stijn
9c7112d118 daemon: configureMaxThreads: remove unused arg
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-07 02:24:31 +01:00
5681 changed files with 359535 additions and 170527 deletions

View File

@@ -1,4 +1,6 @@
.git
bundles/
cli/winresources/**/winres.json
cli/winresources/**/*.syso
/.git
# build artifacts
/bundles/
/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

155
.github/labeler.yml vendored Normal file
View File

@@ -0,0 +1,155 @@
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:
- changed-files:
- any-glob-to-any-file:
- 'go.mod'
- 'go.sum'
- 'vendor/**'
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,11 +16,11 @@ on:
workflow_call:
env:
ALPINE_VERSION: "3.21"
ALPINE_VERSION: "3.22"
jobs:
run:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
timeout-minutes: 10 # guardrails timeout for the whole job
steps:
-

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-20.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));
});

123
.github/workflows/.test-unit.yml vendored Normal file
View File

@@ -0,0 +1,123 @@
# reusable workflow
name: .test-unit
# 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:
env:
GO_VERSION: "1.25.2"
GOTESTLIST_VERSION: v0.3.1
TESTSTAT_VERSION: v0.1.25
SETUP_BUILDX_VERSION: edge
SETUP_BUILDKIT_IMAGE: moby/buildkit:latest
jobs:
unit:
runs-on: ubuntu-24.04
timeout-minutes: 120 # guardrails timeout for the whole job
continue-on-error: ${{ github.event_name != 'pull_request' }}
strategy:
fail-fast: false
matrix:
mode:
- ""
- firewalld
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Set up runner
uses: ./.github/actions/setup-runner
-
name: Prepare
run: |
CACHE_DEV_SCOPE=dev
if [[ "${{ matrix.mode }}" == *"firewalld"* ]]; then
echo "FIREWALLD=true" >> $GITHUB_ENV
CACHE_DEV_SCOPE="${CACHE_DEV_SCOPE}firewalld"
fi
echo "CACHE_DEV_SCOPE=${CACHE_DEV_SCOPE}" >> $GITHUB_ENV
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
version: ${{ env.SETUP_BUILDX_VERSION }}
driver-opts: image=${{ env.SETUP_BUILDKIT_IMAGE }}
buildkitd-flags: --debug
-
name: Build dev image
uses: docker/bake-action@v6
with:
targets: dev
set: |
dev.cache-from=type=gha,scope=${{ env.CACHE_DEV_SCOPE }}
-
name: Test
run: |
make -o build test-unit
-
name: Prepare reports
if: always()
run: |
mkdir -p bundles /tmp/reports
find bundles -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 /tmp/reports
sudo chown -R $(id -u):$(id -g) /tmp/reports
tree -nh /tmp/reports
-
name: Send to Codecov
uses: codecov/codecov-action@v4
with:
directory: ./bundles
env_vars: RUNNER_OS
flags: unit
token: ${{ secrets.CODECOV_TOKEN }} # used to upload coverage reports: https://github.com/moby/buildkit/pull/4660#issue-2142122533
-
name: Upload reports
if: always()
uses: actions/upload-artifact@v4
with:
name: test-reports-unit--${{ matrix.mode }}
path: /tmp/reports/*
retention-days: 1
unit-report:
runs-on: ubuntu-24.04
timeout-minutes: 10
continue-on-error: ${{ github.event_name != 'pull_request' }}
if: always()
needs:
- unit
steps:
-
name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache: false
-
name: Download reports
uses: actions/download-artifact@v4
with:
pattern: test-reports-unit-*
path: /tmp/reports
-
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

@@ -21,148 +21,19 @@ on:
default: "graphdriver"
env:
GO_VERSION: "1.23.6"
GO_VERSION: "1.25.2"
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
jobs:
unit-prepare:
runs-on: ubuntu-20.04
timeout-minutes: 10 # guardrails timeout for the whole job
continue-on-error: ${{ github.event_name != 'pull_request' }}
outputs:
includes: ${{ steps.set.outputs.includes }}
steps:
-
name: Create matrix includes
id: set
uses: actions/github-script@v7
with:
script: |
let includes = [
{ mode: '' },
{ mode: 'rootless' },
{ mode: 'systemd' },
];
if ("${{ inputs.storage }}" == "snapshotter") {
includes.push({ mode: 'firewalld' });
}
await core.group(`Set matrix`, async () => {
core.info(`matrix: ${JSON.stringify(includes)}`);
core.setOutput('includes', JSON.stringify(includes));
});
-
name: Show matrix
run: |
echo ${{ steps.set.outputs.includes }}
unit:
runs-on: ubuntu-20.04
timeout-minutes: 120 # guardrails timeout for the whole job
continue-on-error: ${{ github.event_name != 'pull_request' }}
needs:
- unit-prepare
strategy:
fail-fast: false
matrix:
include: ${{ fromJson(needs.unit-prepare.outputs.includes) }}
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Set up runner
uses: ./.github/actions/setup-runner
-
name: Prepare
run: |
CACHE_DEV_SCOPE=dev
if [[ "${{ matrix.mode }}" == *"firewalld"* ]]; then
echo "DOCKER_FIREWALLD=true" >> $GITHUB_ENV
CACHE_DEV_SCOPE="${CACHE_DEV_SCOPE}firewalld"
fi
echo "CACHE_DEV_SCOPE=${CACHE_DEV_SCOPE}" >> $GITHUB_ENV
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
version: ${{ env.SETUP_BUILDX_VERSION }}
driver-opts: image=${{ env.SETUP_BUILDKIT_IMAGE }}
buildkitd-flags: --debug
-
name: Build dev image
uses: docker/bake-action@v6
with:
targets: dev
set: |
dev.cache-from=type=gha,scope=dev
-
name: Test
run: |
make -o build test-unit
-
name: Prepare reports
if: always()
run: |
mkdir -p bundles /tmp/reports
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 /tmp/reports
sudo chown -R $(id -u):$(id -g) /tmp/reports
tree -nh /tmp/reports
-
name: Send to Codecov
uses: codecov/codecov-action@v4
with:
directory: ./bundles
env_vars: RUNNER_OS
flags: unit
token: ${{ secrets.CODECOV_TOKEN }} # used to upload coverage reports: https://github.com/moby/buildkit/pull/4660#issue-2142122533
-
name: Upload reports
if: always()
uses: actions/upload-artifact@v4
with:
name: test-reports-unit-${{ inputs.storage }}-${{ matrix.mode }}
path: /tmp/reports/*
retention-days: 1
unit-report:
runs-on: ubuntu-20.04
timeout-minutes: 10
continue-on-error: ${{ github.event_name != 'pull_request' }}
if: always()
needs:
- unit
steps:
-
name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache-dependency-path: vendor.sum
-
name: Download reports
uses: actions/download-artifact@v4
with:
pattern: test-reports-unit-${{ inputs.storage }}-*
path: /tmp/reports
-
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
docker-py:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
timeout-minutes: 120 # guardrails timeout for the whole job
continue-on-error: ${{ github.event_name != 'pull_request' }}
steps:
@@ -192,7 +63,7 @@ jobs:
-
name: Test
run: |
make -o build test-docker-py
make TEST_SKIP_INTEGRATION_CLI=1 -o build test-docker-py
-
name: Prepare reports
if: always()
@@ -219,7 +90,7 @@ jobs:
retention-days: 1
integration-flaky:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
timeout-minutes: 120 # guardrails timeout for the whole job
continue-on-error: ${{ github.event_name != 'pull_request' }}
steps:
@@ -251,7 +122,7 @@ jobs:
TEST_SKIP_INTEGRATION_CLI: 1
integration-prepare:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
timeout-minutes: 10 # guardrails timeout for the whole job
continue-on-error: ${{ github.event_name != 'pull_request' }}
outputs:
@@ -264,17 +135,18 @@ jobs:
with:
script: |
let includes = [
{ os: 'ubuntu-20.04', mode: '' },
{ os: 'ubuntu-20.04', mode: 'rootless' },
{ os: 'ubuntu-20.04', mode: 'systemd' },
{ os: 'ubuntu-22.04', mode: '' },
{ os: 'ubuntu-22.04', mode: 'rootless' },
{ os: 'ubuntu-22.04', mode: 'systemd' },
// { os: 'ubuntu-20.04', mode: 'rootless-systemd' }, // FIXME: https://github.com/moby/moby/issues/44084
// { os: 'ubuntu-22.04', mode: 'rootless-systemd' }, // FIXME: https://github.com/moby/moby/issues/44084
{ os: 'ubuntu-24.04', mode: '' },
// { os: 'ubuntu-24.04', mode: 'rootless' }, // FIXME: https://github.com/moby/moby/pull/49579#issuecomment-2698622223
{ os: 'ubuntu-24.04', mode: 'systemd' },
// { os: 'ubuntu-24.04', mode: 'rootless-systemd' }, // FIXME: https://github.com/moby/moby/issues/44084
];
if ("${{ inputs.storage }}" == "snapshotter") {
includes.push({ os: 'ubuntu-22.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)}`);
@@ -317,9 +189,12 @@ jobs:
CACHE_DEV_SCOPE="${CACHE_DEV_SCOPE}systemd"
fi
if [[ "${{ matrix.mode }}" == *"firewalld"* ]]; then
echo "DOCKER_FIREWALLD=true" >> $GITHUB_ENV
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
@@ -383,7 +258,7 @@ jobs:
retention-days: 1
integration-report:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
timeout-minutes: 10
continue-on-error: ${{ github.event_name != 'pull_request' }}
if: always()
@@ -395,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
@@ -413,7 +288,7 @@ jobs:
find /tmp/reports -type f -name '*-go-test-report.json' -exec teststat -markdown {} \+ >> $GITHUB_STEP_SUMMARY
integration-cli-prepare:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
timeout-minutes: 120 # guardrails timeout for the whole job
continue-on-error: ${{ github.event_name != 'pull_request' }}
outputs:
@@ -427,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:
@@ -458,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'
});
}
@@ -484,7 +383,7 @@ jobs:
echo ${{ steps.set.outputs.matrix }}
integration-cli:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
timeout-minutes: 120 # guardrails timeout for the whole job
continue-on-error: ${{ github.event_name != 'pull_request' }}
needs:
@@ -507,9 +406,12 @@ jobs:
run: |
CACHE_DEV_SCOPE=dev
if [[ "${{ matrix.mode }}" == *"firewalld"* ]]; then
echo "DOCKER_FIREWALLD=true" >> $GITHUB_ENV
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
@@ -567,12 +469,12 @@ 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
integration-cli-report:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
timeout-minutes: 10
continue-on-error: ${{ github.event_name != 'pull_request' }}
if: always()
@@ -584,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.2"
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.23.6"
GO_VERSION: "1.25.2"
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,10 @@ 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 TEST_INTEGRATION_USE_GRAPHDRIVER=1
echo "TEST_INTEGRATION_USE_GRAPHDRIVER=1" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
}
Write-Host "Starting service"
Start-Service -Name docker
@@ -428,12 +404,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 +411,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 +419,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 +495,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.23.6"
GO_VERSION: "1.25.2"
TESTSTAT_VERSION: v0.1.25
DESTDIR: ./build
SETUP_BUILDX_VERSION: edge
@@ -35,8 +35,9 @@ jobs:
uses: ./.github/workflows/.dco.yml
build:
runs-on: ubuntu-22.04-arm
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:
@@ -68,8 +69,9 @@ jobs:
find ${{ env.DESTDIR }} -type f -exec file -e ascii -- {} +
build-dev:
runs-on: ubuntu-22.04-arm
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-22.04-arm
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
@@ -147,10 +153,10 @@ jobs:
retention-days: 1
test-unit-report:
runs-on: ubuntu-20.04
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
@@ -176,9 +182,10 @@ jobs:
find /tmp/reports -type f -name '*-go-test-report.json' -exec teststat -markdown {} \+ >> $GITHUB_STEP_SUMMARY
test-integration:
runs-on: ubuntu-22.04-arm
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
@@ -246,10 +256,10 @@ jobs:
retention-days: 1
test-integration-report:
runs-on: ubuntu-20.04
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

@@ -40,8 +40,9 @@ jobs:
uses: ./.github/workflows/.dco.yml
prepare:
runs-on: ubuntu-20.04
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,20 +59,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
## any push
# moby/moby-bin:sha-ad132f5
## push on 28.x branch
# moby/moby-bin:28.x
tags: |
type=semver,pattern={{version}}
type=ref,event=branch
type=ref,event=pr
type=sha
type=semver,pattern={{major}}
type=semver,pattern={{major}}.{{minor}}
-
name: Rename meta bake definition file
# see https://github.com/docker/metadata-action/issues/381#issuecomment-1918607161
@@ -93,12 +95,12 @@ jobs:
echo "matrix=$(docker buildx bake bin-image-cross --print | jq -cr '.target."bin-image-cross".platforms')" >>${GITHUB_OUTPUT}
build:
runs-on: ubuntu-20.04
timeout-minutes: 120 # guardrails timeout for the whole job
runs-on: ubuntu-24.04
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:
@@ -169,11 +171,11 @@ jobs:
retention-days: 1
merge:
runs-on: ubuntu-20.04
timeout-minutes: 120 # guardrails timeout for the whole job
runs-on: ubuntu-24.04
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.23.6"
GO_VERSION: "1.25.2"
DESTDIR: ./build
SETUP_BUILDX_VERSION: edge
SETUP_BUILDKIT_IMAGE: moby/buildkit:latest
@@ -32,9 +32,10 @@ jobs:
validate-dco:
uses: ./.github/workflows/.dco.yml
build:
runs-on: ubuntu-20.04
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:
@@ -59,11 +60,12 @@ jobs:
if-no-files-found: error
retention-days: 1
test:
runs-on: ubuntu-20.04
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
- build-linux
env:
TEST_IMAGE_BUILD: "0"
TEST_IMAGE_ID: "buildkit-tests"
@@ -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: |
@@ -162,3 +164,210 @@ jobs:
TESTPKGS: "./${{ matrix.pkg }}"
TESTFLAGS: "-v --parallel=1 --timeout=30m --run=//worker=${{ matrix.worker }}$"
working-directory: buildkit
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:
GOPATH: ${{ github.workspace }}\go
GOBIN: ${{ github.workspace }}\go\bin
BIN_OUT: ${{ github.workspace }}\out
WINDOWS_BASE_IMAGE: mcr.microsoft.com/windows/servercore
WINDOWS_BASE_TAG_2022: ltsc2022
TEST_IMAGE_NAME: moby:test
TEST_CTN_NAME: moby
defaults:
run:
working-directory: ${{ env.GOPATH }}/src/github.com/docker/docker
steps:
- name: Checkout
uses: actions/checkout@v4
with:
path: ${{ env.GOPATH }}/src/github.com/docker/docker
- name: Env
run: |
Get-ChildItem Env: | Out-String
- name: Moby - Init
run: |
New-Item -ItemType "directory" -Path "${{ github.workspace }}\go-build"
New-Item -ItemType "directory" -Path "${{ github.workspace }}\go\pkg\mod"
echo "WINDOWS_BASE_IMAGE_TAG=${{ env.WINDOWS_BASE_TAG_2022 }}" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache: false
- name: Docker info
run: |
docker info
- name: Build base image
run: |
& docker build `
--build-arg WINDOWS_BASE_IMAGE `
--build-arg WINDOWS_BASE_IMAGE_TAG `
-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
go install github.com/distribution/distribution/v3/cmd/registry@latest
- name: Checkout BuildKit
uses: actions/checkout@v4
with:
repository: moby/buildkit
ref: master
path: buildkit
- name: Add buildctl to binaries
run: |
go install ./cmd/buildctl
working-directory: buildkit
- name: Copy artifacts
run: |
New-Item -ItemType "directory" -Path "${{ env.BIN_OUT }}"
docker cp "${{ env.TEST_CTN_NAME }}`:c`:\gopath\src\github.com\docker\docker\bundles\docker.exe" ${{ env.BIN_OUT }}\
docker cp "${{ env.TEST_CTN_NAME }}`:c`:\gopath\src\github.com\docker\docker\bundles\dockerd.exe" ${{ env.BIN_OUT }}\
docker cp "${{ env.TEST_CTN_NAME }}`:c`:\gopath\bin\gotestsum.exe" ${{ env.BIN_OUT }}\
docker cp "${{ env.TEST_CTN_NAME }}`:c`:\containerd\bin\containerd.exe" ${{ env.BIN_OUT }}\
docker cp "${{ env.TEST_CTN_NAME }}`:c`:\containerd\bin\containerd-shim-runhcs-v1.exe" ${{ env.BIN_OUT }}\
cp ${{ env.GOPATH }}\bin\registry.exe ${{ env.BIN_OUT }}
cp ${{ env.GOPATH }}\bin\buildctl.exe ${{ env.BIN_OUT }}
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: build-windows
path: ${{ env.BIN_OUT }}/*
if-no-files-found: error
retention-days: 2
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:
TEST_IMAGE_BUILD: "0"
TEST_IMAGE_ID: "buildkit-tests"
GOPATH: ${{ github.workspace }}\go
GOBIN: ${{ github.workspace }}\go\bin
BIN_OUT: ${{ github.workspace }}\out
TESTFLAGS: "-v --timeout=90m"
TEST_DOCKERD: "1"
strategy:
fail-fast: false
matrix:
worker:
- dockerd-containerd
pkg:
- ./client#1-4
- ./client#2-4
- ./client#3-4
- ./client#4-4
- ./cmd/buildctl
- ./frontend
- ./frontend/dockerfile#1-12
- ./frontend/dockerfile#2-12
- ./frontend/dockerfile#3-12
- ./frontend/dockerfile#4-12
- ./frontend/dockerfile#5-12
- ./frontend/dockerfile#6-12
- ./frontend/dockerfile#7-12
- ./frontend/dockerfile#8-12
- ./frontend/dockerfile#9-12
- ./frontend/dockerfile#10-12
- ./frontend/dockerfile#11-12
- ./frontend/dockerfile#12-12
steps:
- name: Prepare
shell: bash
run: |
disabledFeatures="cache_backend_azblob,cache_backend_s3"
if [ "${{ matrix.worker }}" = "dockerd" ]; then
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: 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:
repository: ${{ env.BUILDKIT_REPO }}
ref: ${{ env.BUILDKIT_REF }}
path: buildkit
- name: Download Moby artifacts
uses: actions/download-artifact@v4
with:
name: build-windows
path: ${{ env.BIN_OUT }}
- name: Add binaries to PATH
run: |
ls ${{ env.BIN_OUT }}
Write-Output "${{ env.BIN_OUT }}" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Test Prep
shell: bash
run: |
TESTPKG=$(echo "${{ matrix.pkg }}" | awk '-F#' '{print $1}')
echo "TESTPKG=$TESTPKG" >> $GITHUB_ENV
echo "TEST_REPORT_NAME=${{ github.job }}-$(echo "${{ matrix.pkg }}-${{ matrix.worker }}" | tr -dc '[:alnum:]-\n\r' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
testFlags="${{ env.TESTFLAGS }}"
testSlice=$(echo "${{ matrix.pkg }}" | awk '-F#' '{print $2}')
testSliceOffset=""
if [ -n "$testSlice" ]; then
testSliceOffset="slice=$testSlice/"
fi
if [ -n "${{ matrix.worker }}" ]; then
testFlags="${testFlags} --run=TestIntegration/$testSliceOffset.*/worker=${{ matrix.worker }}"
fi
echo "TESTFLAGS=${testFlags}" >> $GITHUB_ENV
- name: Test
shell: bash
run: |
mkdir -p ./bin/testreports
gotestsum \
--jsonfile="./bin/testreports/go-test-report-${{ env.TEST_REPORT_NAME }}.json" \
--junitfile="./bin/testreports/junit-report-${{ env.TEST_REPORT_NAME }}.xml" \
--packages="${{ env.TESTPKG }}" \
-- \
"-mod=vendor" \
"-coverprofile" "./bin/testreports/coverage-${{ env.TEST_REPORT_NAME }}.txt" \
"-covermode" "atomic" ${{ env.TESTFLAGS }}
working-directory: buildkit

View File

@@ -32,7 +32,7 @@ jobs:
uses: ./.github/workflows/.dco.yml
build:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
timeout-minutes: 20 # guardrails timeout for the whole job
needs:
- validate-dco
@@ -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:
@@ -87,8 +88,9 @@ jobs:
echo ${{ steps.platforms.outputs.matrix }}
cross:
runs-on: ubuntu-20.04
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
@@ -154,3 +157,24 @@ jobs:
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: ${{ env.DESTDIR }}/govulncheck.out
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:
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
version: ${{ env.SETUP_BUILDX_VERSION }}
driver-opts: image=${{ env.SETUP_BUILDKIT_IMAGE }}
buildkitd-flags: --debug
-
name: Build dind image
uses: docker/bake-action@v6
with:
targets: dind
set: |
*.output=type=cacheonly

View File

@@ -32,6 +32,9 @@ on:
# * * * * *
- cron: '0 9 * * 4'
env:
GO_VERSION: "1.25.2"
jobs:
codeql:
runs-on: ubuntu-24.04
@@ -46,19 +49,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.23.6"
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.23.6"
GO_VERSION: "1.25.2"
GIT_PAGER: "cat"
PAGER: "cat"
SETUP_BUILDX_VERSION: edge
@@ -34,7 +34,7 @@ jobs:
uses: ./.github/workflows/.dco.yml
build-dev:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
timeout-minutes: 120 # guardrails timeout for the whole job
needs:
- validate-dco
@@ -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
@@ -83,8 +85,16 @@ jobs:
with:
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
uses: ./.github/workflows/.test-unit.yml
secrets: inherit
validate-prepare:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
timeout-minutes: 10 # guardrails timeout for the whole job
needs:
- validate-dco
@@ -106,7 +116,7 @@ jobs:
echo ${{ steps.scripts.outputs.matrix }}
validate:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
timeout-minutes: 30 # guardrails timeout for the whole job
needs:
- validate-prepare
@@ -144,8 +154,9 @@ jobs:
make -o build validate-${{ matrix.script }}
smoke-prepare:
runs-on: ubuntu-20.04
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:
@@ -166,8 +177,9 @@ jobs:
echo ${{ steps.platforms.outputs.matrix }}
smoke:
runs-on: ubuntu-20.04
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,20 +14,25 @@ on:
types: [opened, edited, labeled, unlabeled, synchronize]
jobs:
check-area-label:
runs-on: ubuntu-20.04
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
check-changelog:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
timeout-minutes: 120 # guardrails timeout for the whole job
env:
HAS_IMPACT_LABEL: ${{ contains(join(github.event.pull_request.labels.*.name, ','), 'impact/') }}
@@ -65,7 +70,7 @@ jobs:
echo "$desc"
check-pr-branch:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
timeout-minutes: 120 # guardrails timeout for the whole job
env:
PR_TITLE: ${{ github.event.pull_request.title }}

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

7
.gitignore vendored
View File

@@ -14,10 +14,9 @@ thumbs.db
.editorconfig
# build artifacts
bundles/
cli/winresources/*/*.syso
cli/winresources/*/winres.json
contrib/builder/rpm/*/changelog
/bundles/
/cmd/dockerd/winresources/winres.json
/cmd/dockerd/*.syso
# ci artifacts
*.exe

View File

@@ -1,191 +1,359 @@
linters:
enable:
- copyloopvar # Detects places where loop variables are copied.
- depguard
- dupword # Detects duplicate words.
- goimports
- gosec # Detects security problems.
- gosimple
- govet
- forbidigo
- importas
- ineffassign
- misspell # Detects commonly misspelled English words in comments.
- revive # Metalinter; drop-in replacement for golint.
- staticcheck
- typecheck
- unconvert # Detects unnecessary type conversions.
- unused
disable:
- errcheck
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.23.6"
go: "1.25.2"
concurrency: 2
# Only supported with go modules enabled (build flag -mod=vendor only valid when using modules)
# modules-download-mode: vendor
linters-settings:
depguard:
formatters:
enable:
- gofmt
- goimports
linters:
enable:
- asasalint # Detects "[]any" used as argument for variadic "func(...any)".
- copyloopvar # Detects places where loop variables are copied.
- depguard
- dogsled # Detects assignments with too many blank identifiers.
- dupword # Detects duplicate words.
- durationcheck # Detect cases where two time.Duration values are being multiplied in possibly erroneous ways.
- errorlint # Detects code that will cause problems with the error wrapping scheme introduced in Go 1.13.
- errchkjson # Detects unsupported types passed to json encoding functions and reports if checks for the returned error can be omitted.
- exhaustive # Detects missing options in enum switch statements.
- exptostd # Detects functions from golang.org/x/exp/ that can be replaced by std functions.
- fatcontext # Detects nested contexts in loops and function literals.
- forbidigo
- gocheckcompilerdirectives # Detects invalid go compiler directive comments (//go:).
- gocritic # Detects for bugs, performance and style issues.
- gosec # Detects security problems.
- govet
- iface # Detects incorrect use of interfaces. Currently only used for "identical" interfaces in the same package.
- importas
- ineffassign
- makezero # Finds slice declarations with non-zero initial length.
- mirror # Detects wrong mirror patterns of bytes/strings usage.
- misspell # Detects commonly misspelled English words in comments.
- nakedret # Detects uses of naked returns.
- nilnesserr # Detects returning nil errors. It combines the features of nilness and nilerr,
- nosprintfhostport # Detects misuse of Sprintf to construct a host with port in a URL.
- reassign # Detects reassigning a top-level variable in another package.
- revive # Metalinter; drop-in replacement for golint.
- spancheck # Detects mistakes with OpenTelemetry/Census spans.
- staticcheck
- thelper
- unconvert # Detects unnecessary type conversions.
- unused
- usestdlibvars # Detects the possibility to use variables/constants from the Go standard library.
- wastedassign # Detects wasted assignment statements.
disable:
- errcheck
- spancheck # FIXME
settings:
depguard:
rules:
main:
deny:
- pkg: "github.com/stretchr/testify/assert"
desc: Use "gotest.tools/v3/assert" instead
- pkg: "github.com/stretchr/testify/require"
desc: Use "gotest.tools/v3/assert" instead
- pkg: "github.com/stretchr/testify/suite"
desc: Do not use
- pkg: "github.com/containerd/containerd/pkg/userns"
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:
- "true" # some tests use this as expected output
- "false" # some tests use this as expected output
- "root" # for tests using "ls" output with files owned by "root:root"
errorlint:
# Check whether fmt.Errorf uses the %w verb for formatting errors.
# See the https://github.com/polyfloyd/go-errorlint for caveats.
errorf: false
# Check for plain type assertions and type switches.
asserts: false
exhaustive:
# Program elements to check for exhaustiveness.
# Default: [ switch ]
check:
- switch
# - map # TODO(thaJeztah): also enable for maps
# Presence of "default" case in switch statements satisfies exhaustiveness,
# even if all enum members are not listed.
# Default: false
#
# TODO(thaJeztah): consider not allowing this to catch new values being added (and falling through to "default")
default-signifies-exhaustive: true
forbidigo:
forbid:
- pkg: ^sync/atomic$
pattern: ^atomic\.(Add|CompareAndSwap|Load|Store|Swap).
msg: Go 1.19 atomic types should be used instead.
- pkg: ^regexp$
pattern: ^regexp\.MustCompile
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/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
gocritic:
disabled-checks:
- appendAssign
- appendCombine
- assignOp
- builtinShadow
- builtinShadowDecl
- captLocal
- commentedOutCode
- deferInLoop
- dupImport
- dupSubExpr
- elseif
- emptyFallthrough
- equalFold
- evalOrder
- exitAfterDefer
- exposedSyncMutex
- filepathJoin
- hexLiteral
- hugeParam
- ifElseChain
- importShadow
- indexAlloc
- methodExprCall
- nestingReduce
- nilValReturn
- octalLiteral
- paramTypeCombine
- preferStringWriter
- ptrToRefParam
- rangeValCopy
- redundantSprint
- regexpMust
- regexpSimplify
- singleCaseSwitch
- sloppyReassign
- stringXbytes
- typeAssertChain
- typeDefFirst
- typeUnparen
- uncheckedInlineErr
- unlambda
- unnamedResult
- unnecessaryDefer
- unslice
- valSwap
- whyNoLint
enable-all: true
gosec:
excludes:
- G104 # G104: Errors unhandled; (TODO: reduce unhandled errors, or explicitly ignore)
- G115 # G115: integer overflow conversion; (TODO: verify these: https://github.com/moby/moby/issues/48358)
- G204 # G204: Subprocess launched with variable; too many false positives.
- G301 # G301: Expect directory permissions to be 0750 or less (also EXC0009); too restrictive
- G302 # G302: Expect file permissions to be 0600 or less (also EXC0009); too restrictive
- G304 # G304: Potential file inclusion via variable.
- G306 # G306: Expect WriteFile permissions to be 0600 or less (too restrictive; also flags "0o644" permissions)
- G307 # G307: Deferring unsafe method "*os.File" on type "Close" (also EXC0008); (TODO: evaluate these and fix where needed: G307: Deferring unsafe method "*os.File" on type "Close")
- G504 # G504: Blocklisted import net/http/cgi: Go versions < 1.6.3 are vulnerable to Httpoxy attack: (CVE-2016-5386); (only affects go < 1.6.3)
govet:
enable-all: true
disable:
- fieldalignment # TODO: evaluate which ones should be updated.
importas:
# Do not allow unaliased imports of aliased packages.
no-unaliased: true
alias:
# Enforce alias to prevent it accidentally being used instead of our
# own errdefs package (or vice-versa).
- pkg: github.com/containerd/errdefs
alias: cerrdefs
- pkg: github.com/containerd/containerd/images
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"
- pkg: gotest.tools/v3/assert/cmp
alias: is
nakedret:
# Disallow naked returns if func has more lines of code than this setting.
# Default: 30
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:
- all
- -QF1008 # Omit embedded fields from selector expression; https://staticcheck.dev/docs/checks/#QF1008
- -ST1000 # Incorrect or missing package comment; https://staticcheck.dev/docs/checks/#ST1000
- -ST1003 # Poorly chosen identifier; https://staticcheck.dev/docs/checks/#ST1003
- -ST1005 # Incorrectly formatted error string; https://staticcheck.dev/docs/checks/#ST1005
spancheck:
# Default: ["end"]
checks:
- end # check that `span.End()` is called
- record-error # check that `span.RecordError(err)` is called when an error is returned
- set-status # check that `span.SetStatus(codes.Error, msg)` is called when an error is returned
thelper:
test:
# Check *testing.T is first param (or after context.Context) of helper function.
first: false
# Check t.Helper() begins helper function.
begin: false
benchmark:
# Check *testing.B is first param (or after context.Context) of helper function.
first: false
# Check b.Helper() begins helper function.
begin: false
tb:
# Check *testing.TB is first param (or after context.Context) of helper function.
first: false
# Check *testing.TB param has name tb.
name: false
# Check tb.Helper() begins helper function.
begin: false
fuzz:
# Check *testing.F is first param (or after context.Context) of helper function.
first: false
# Check f.Helper() begins helper function.
begin: false
usestdlibvars:
# Suggest the use of http.MethodXX.
http-method: true
# Suggest the use of http.StatusXX.
http-status-code: true
exclusions:
rules:
main:
deny:
- pkg: io/ioutil
desc: The io/ioutil package has been deprecated, see https://go.dev/doc/go1.16#ioutil
- pkg: "github.com/stretchr/testify/assert"
desc: Use "gotest.tools/v3/assert" instead
- pkg: "github.com/stretchr/testify/require"
desc: Use "gotest.tools/v3/assert" instead
- pkg: "github.com/stretchr/testify/suite"
desc: Do not use
- pkg: "github.com/containerd/containerd/errdefs"
desc: The errdefs package has moved to a separate module, https://github.com/containerd/errdefs
- pkg: "github.com/containerd/containerd/log"
desc: The logs package has moved to a separate module, https://github.com/containerd/log
- pkg: "github.com/containerd/containerd/pkg/userns"
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.
# 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
# defaults when updating golang-ci-lint versions.
# Unfortunately, this means we have to copy the whole exclusion pattern, as
# (unlike the "include" option), the "exclude" option does not take exclusion
# ID's.
#
# These exclusion patterns are copied from the default excludes at:
# https://github.com/golangci/golangci-lint/blob/v1.61.0/pkg/config/issues.go#L11-L104
#
# The default list of exclusions can be found at:
# https://golangci-lint.run/usage/false-positives/#default-exclusions
dupword:
ignore:
- "true" # some tests use this as expected output
- "false" # some tests use this as expected output
- "root" # for tests using "ls" output with files owned by "root:root"
# Exclude some linters from running on tests files.
- path: _test\.go
linters:
- errcheck
forbidigo:
forbid:
- pkg: ^sync/atomic$
p: ^atomic\.(Add|CompareAndSwap|Load|Store|Swap).
msg: Go 1.19 atomic types should be used instead.
- pkg: ^regexp$
p: ^regexp\.MustCompile
msg: Use internal/lazyregexp.New instead.
- pkg: github.com/vishvananda/netlink$
p: ^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$
p: ^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
- text: "G404: Use of weak random number generator"
path: _test\.go
linters:
- gosec
gosec:
excludes:
- G104 # G104: Errors unhandled; (TODO: reduce unhandled errors, or explicitly ignore)
- G113 # G113: Potential uncontrolled memory consumption in Rat.SetString (CVE-2022-23772); (only affects go < 1.16.14. and go < 1.17.7)
- G115 # G115: integer overflow conversion; (TODO: verify these: https://github.com/moby/moby/issues/48358)
- G204 # G204: Subprocess launched with variable; too many false positives.
- G301 # G301: Expect directory permissions to be 0750 or less (also EXC0009); too restrictive
- G302 # G302: Expect file permissions to be 0600 or less (also EXC0009); too restrictive
- G304 # G304: Potential file inclusion via variable.
- G306 # G306: Expect WriteFile permissions to be 0600 or less (too restrictive; also flags "0o644" permissions)
- G307 # G307: Deferring unsafe method "*os.File" on type "Close" (also EXC0008); (TODO: evaluate these and fix where needed: G307: Deferring unsafe method "*os.File" on type "Close")
- G504 # G504: Blocklisted import net/http/cgi: Go versions < 1.6.3 are vulnerable to Httpoxy attack: (CVE-2016-5386); (only affects go < 1.6.3)
# Suppress golint complaining about generated types in api/types/
- text: "type name will be used as (container|volume)\\.(Container|Volume).* by other packages, and that stutters; consider calling this"
path: "api/types/(volume|container)/"
linters:
- revive
govet:
enable-all: true
disable:
- fieldalignment # TODO: evaluate which ones should be updated.
# FIXME: ignoring unused assigns to ctx for now; too many hits in libnetwork/xxx functions that setup traces
- text: "assigned to ctx, but never used afterwards"
linters:
- wastedassign
importas:
# Do not allow unaliased imports of aliased packages.
no-unaliased: true
- text: "ineffectual assignment to ctx"
source: "ctx[, ].*=.*\\(ctx[,)]"
linters:
- ineffassign
alias:
# Enforce alias to prevent it accidentally being used instead of our
# own errdefs package (or vice-versa).
- pkg: github.com/containerd/errdefs
alias: cerrdefs
- pkg: github.com/containerd/containerd/images
alias: c8dimages
- pkg: github.com/opencontainers/image-spec/specs-go/v1
alias: ocispec
- text: "SA4006: this value of ctx is never used"
source: "ctx[, ].*=.*\\(ctx[,)]"
linters:
- staticcheck
revive:
rules:
# FIXME make sure all packages have a description. Currently, there's many packages without.
- name: package-comments
disabled: true
# 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'
path: '((main|check)_(linux_|)test\.go)|testutil/helpers\.go'
linters:
- fatcontext
- text: '^shadow: declaration of "(ctx|err|ok)" shadows declaration'
linters:
- govet
- text: '^shadow: declaration of "(out)" shadows declaration'
path: _test\.go
linters:
- govet
- text: 'use of `regexp.MustCompile` forbidden'
path: _test\.go
linters:
- forbidigo
- text: 'use of `regexp.MustCompile` forbidden'
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
warn-unused: true
issues:
# The default exclusion rules are a bit too permissive, so copying the relevant ones below
exclude-use-default: false
exclude-dirs:
- docs
exclude-rules:
# We prefer to use an "exclude-list" so that new "default" exclusions are not
# automatically inherited. We can decide whether or not to follow upstream
# defaults when updating golang-ci-lint versions.
# Unfortunately, this means we have to copy the whole exclusion pattern, as
# (unlike the "include" option), the "exclude" option does not take exclusion
# ID's.
#
# These exclusion patterns are copied from the default excludes at:
# https://github.com/golangci/golangci-lint/blob/v1.61.0/pkg/config/issues.go#L11-L104
#
# The default list of exclusions can be found at:
# https://golangci-lint.run/usage/false-positives/#default-exclusions
# EXC0001
- text: "Error return value of .((os\\.)?std(out|err)\\..*|.*Close|.*Flush|os\\.Remove(All)?|.*print(f|ln)?|os\\.(Un)?Setenv). is not checked"
linters:
- errcheck
# Exclude some linters from running on tests files.
- path: _test\.go
linters:
- errcheck
- text: "G404: Use of weak random number generator"
path: _test\.go
linters:
- gosec
# Suppress golint complaining about generated types in api/types/
- text: "type name will be used as (container|volume)\\.(Container|Volume).* by other packages, and that stutters; consider calling this"
path: "api/types/(volume|container)/"
linters:
- revive
# FIXME temporarily suppress these (see https://github.com/gotestyourself/gotest.tools/issues/272)
- text: "SA1019: (assert|cmp|is)\\.ErrorType is deprecated"
linters:
- staticcheck
- text: "ineffectual assignment to ctx"
source: "ctx[, ].*=.*\\(ctx[,)]"
linters:
- ineffassign
- text: "SA4006: this value of `ctx` is never used"
source: "ctx[, ].*=.*\\(ctx[,)]"
linters:
- staticcheck
- text: '^shadow: declaration of "(ctx|err|ok)" shadows declaration'
linters:
- govet
- text: '^shadow: declaration of "(out)" shadows declaration'
path: _test\.go
linters:
- govet
- text: 'use of `regexp.MustCompile` forbidden'
path: _test\.go
linters:
- forbidigo
- text: 'use of `regexp.MustCompile` forbidden'
path: "internal/lazyregexp"
linters:
- forbidigo
- text: 'use of `regexp.MustCompile` forbidden'
path: "libnetwork/cmd/networkdb-test/dbclient"
linters:
- forbidigo
# Maximum issues count per one linter. Set to 0 to disable. Default is 50.
max-issues-per-linter: 0

View File

@@ -94,6 +94,10 @@ Arnaud Rebillout <arnaud.rebillout@collabora.com>
Arnaud Rebillout <arnaud.rebillout@collabora.com> <elboulangero@gmail.com>
Arthur Gautier <baloo@gandi.net> <superbaloo+registrations.github@superbaloo.net>
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>
@@ -136,6 +140,7 @@ Chen Mingjie <chenmingjie0828@163.com>
Chen Qiu <cheney-90@hotmail.com>
Chen Qiu <cheney-90@hotmail.com> <21321229@zju.edu.cn>
Chengfei Shang <cfshang@alauda.io>
Chengyu Zhu <hudson@cyzhu.com>
Chentianze <cmoman@126.com>
Chris Dias <cdias@microsoft.com>
Chris McKinnel <chris.mckinnel@tangentlabs.co.uk>
@@ -507,6 +512,7 @@ Moorthy RS <rsmoorthy@gmail.com> <rsmoorthy@users.noreply.github.com>
Moysés Borges <moysesb@gmail.com>
Moysés Borges <moysesb@gmail.com> <moyses.furtado@wplex.com.br>
mrfly <mr.wrfly@gmail.com> <wrfly@users.noreply.github.com>
Myeongjoon Kim <kimmj8409@gmail.com>
Nace Oroz <orkica@gmail.com>
Natasha Jarus <linuxmercedes@gmail.com>
Nathan LeClaire <nathan.leclaire@docker.com> <nathan.leclaire@gmail.com>
@@ -529,6 +535,8 @@ Ouyang Liduo <oyld0210@163.com>
Patrick St. laurent <patrick@saint-laurent.us>
Patrick Stapleton <github@gdi2290.com>
Paul Liljenberg <liljenberg.paul@gmail.com> <letters@paulnotcom.se>
Paweł Gronowski <pawel.gronowski@docker.com>
Paweł Gronowski <pawel.gronowski@docker.com> <me@woland.xyz>
Pavel Tikhomirov <ptikhomirov@virtuozzo.com> <ptikhomirov@parallels.com>
Pawel Konczalski <mail@konczalski.de>
Peter Choi <phkchoi89@gmail.com> <reikani@Peters-MacBook-Pro.local>
@@ -556,6 +564,8 @@ Robert Terhaar <rterhaar@atlanticdynamic.com> <robbyt@users.noreply.github.com>
Roberto G. Hashioka <roberto.hashioka@docker.com> <roberto_hashioka@hotmail.com>
Roberto Muñoz Fernández <robertomf@gmail.com> <roberto.munoz.fernandez.contractor@bbva.com>
Robin Thoni <robin@rthoni.com>
Rodrigo Campos <rodrigoca@microsoft.com>
Rodrigo Campos <rodrigoca@microsoft.com> <rodrigo@kinvolk.io>
Roman Dudin <katrmr@gmail.com> <decadent@users.noreply.github.com>
Rong Zhang <rongzhang@alauda.io>
Rongxiang Song <tinysong1226@gmail.com>

64
AUTHORS
View File

@@ -2,7 +2,10 @@
# This file lists all contributors to the repository.
# See hack/generate-authors.sh to make modifications.
17neverends <ionianrise@gmail.com>
7sunarni <710720732@qq.com>
Aanand Prasad <aanand.prasad@gmail.com>
Aarni Koskela <akx@iki.fi>
Aaron Davidson <aaron@databricks.com>
Aaron Feng <aaron.feng@gmail.com>
Aaron Hnatiw <aaron@griddio.com>
@@ -11,6 +14,7 @@ Aaron L. Xu <liker.xu@foxmail.com>
Aaron Lehmann <alehmann@netflix.com>
Aaron Welch <welch@packet.net>
Aaron Yoshitake <airandfingers@gmail.com>
Abdur Rehman <abdur_rehman@mentor.com>
Abel Muiño <amuino@gmail.com>
Abhijeet Kasurde <akasurde@redhat.com>
Abhinandan Prativadi <aprativadi@gmail.com>
@@ -19,14 +23,17 @@ 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>
Adam Eijdenberg <adam.eijdenberg@gmail.com>
Adam Kunk <adam.kunk@tiaa-cref.org>
Adam Lamers <adam.lamers@wmsdev.pl>
Adam Miller <admiller@redhat.com>
Adam Mills <adam@armills.info>
Adam Pointer <adam.pointer@skybettingandgaming.com>
Adam Simon <adamsimon85100@gmail.com>
Adam Singer <financeCoding@gmail.com>
Adam Thornton <adam.thornton@maryville.com>
Adam Walz <adam@adamwalz.net>
@@ -43,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>
@@ -75,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>
@@ -119,6 +128,7 @@ amangoel <amangoel@gmail.com>
Amen Belayneh <amenbelayneh@gmail.com>
Ameya Gawde <agawde@mirantis.com>
Amir Goldstein <amir73il@aquasec.com>
AmirBuddy <badinlu.amirhossein@gmail.com>
Amit Bakshi <ambakshi@gmail.com>
Amit Krishnan <amit.krishnan@oracle.com>
Amit Shukla <amit.shukla@docker.com>
@@ -164,10 +174,12 @@ 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>
André Martins <aanm90@gmail.com>
Andrés Maldonado <maldonado@codelutin.com>
Andy Chambers <anchambers@paypal.com>
andy diller <dillera@gmail.com>
Andy Goldstein <agoldste@redhat.com>
@@ -182,6 +194,7 @@ Anes Hasicic <anes.hasicic@gmail.com>
Angel Velazquez <angelcar@amazon.com>
Anil Belur <askb23@gmail.com>
Anil Madhavapeddy <anil@recoil.org>
Anirudh Aithal <aithal@amazon.com>
Ankit Jain <ajatkj@yahoo.co.in>
Ankush Agarwal <ankushagarwal11@gmail.com>
Anonmily <michelle@michelleliu.io>
@@ -191,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>
@@ -219,7 +233,8 @@ Artur Meyster <arthurfbi@yahoo.com>
Arun Gupta <arun.gupta@gmail.com>
Asad Saeeduddin <masaeedu@gmail.com>
Asbjørn Enge <asbjorn@hanafjedle.net>
Austin Vazquez <macedonv@amazon.com>
Ashly Mathew <ashly.mathew@sap.com>
Austin Vazquez <austin.vazquez.dev@gmail.com>
averagehuman <averagehuman@users.noreply.github.com>
Avi Das <andas222@gmail.com>
Avi Kivity <avi@scylladb.com>
@@ -285,6 +300,7 @@ Brandon Liu <bdon@bdon.org>
Brandon Philips <brandon.philips@coreos.com>
Brandon Rhodes <brandon@rhodesmill.org>
Brendan Dixon <brendand@microsoft.com>
Brendon Smith <bws@bws.bio>
Brennan Kinney <5098581+polarathene@users.noreply.github.com>
Brent Salisbury <brent.salisbury@docker.com>
Brett Higgins <brhiggins@arbor.net>
@@ -334,17 +350,20 @@ 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>
Ce Gao <ce.gao@outlook.com>
Cedric Davies <cedricda@microsoft.com>
Cesar Talledo <cesar.talledo@docker.com>
Cezar Sa Espinola <cezarsa@gmail.com>
Chad Swenson <chadswen@gmail.com>
Chance Zibolski <chance.zibolski@gmail.com>
Chander Govindarajan <chandergovind@gmail.com>
Chanhun Jeong <keyolk@gmail.com>
Chao Wang <wangchao.fnst@cn.fujitsu.com>
Charity Kathure <ckathure@microsoft.com>
Charles Chan <charleswhchan@users.noreply.github.com>
Charles Hooper <charles.hooper@dotcloud.com>
Charles Law <claw@conduce.com>
@@ -366,6 +385,7 @@ Chen Qiu <cheney-90@hotmail.com>
Cheng-mean Liu <soccerl@microsoft.com>
Chengfei Shang <cfshang@alauda.io>
Chengguang Xu <cgxu519@gmx.com>
Chengyu Zhu <hudson@cyzhu.com>
Chentianze <cmoman@126.com>
Chenyang Yan <memory.yancy@gmail.com>
chenyuzhu <chenyuzhi@oschina.cn>
@@ -480,6 +500,7 @@ Daniel Farrell <dfarrell@redhat.com>
Daniel Garcia <daniel@danielgarcia.info>
Daniel Gasienica <daniel@gasienica.ch>
Daniel Grunwell <mwgrunny@gmail.com>
Daniel Guns <danbguns@gmail.com>
Daniel Helfand <helfand.4@gmail.com>
Daniel Hiltgen <daniel.hiltgen@docker.com>
Daniel J Walsh <dwalsh@redhat.com>
@@ -763,6 +784,7 @@ Frank Macreery <frank@macreery.com>
Frank Rosquin <frank.rosquin+github@gmail.com>
Frank Villaro-Dixon <frank.villarodixon@merkle.com>
Frank Yang <yyb196@gmail.com>
François Scala <github@arcenik.net>
Fred Lifton <fred.lifton@docker.com>
Frederick F. Kautz IV <fkautz@redhat.com>
Frederico F. de Oliveira <FreddieOliveira@users.noreply.github.com>
@@ -798,6 +820,7 @@ GennadySpb <lipenkov@gmail.com>
Geoff Levand <geoff@infradead.org>
Geoffrey Bachelet <grosfrais@gmail.com>
Geon Kim <geon0250@gmail.com>
George Adams <georgeadams1995@gmail.com>
George Kontridze <george@bugsnag.com>
George Ma <mayangang@outlook.com>
George MacRorie <gmacr31@gmail.com>
@@ -826,6 +849,7 @@ Gopikannan Venugopalsamy <gopikannan.venugopalsamy@gmail.com>
Gosuke Miyashita <gosukenator@gmail.com>
Gou Rao <gou@portworx.com>
Govinda Fichtner <govinda.fichtner@googlemail.com>
Grace Choi <grace.54109@gmail.com>
Grant Millar <rid@cylo.io>
Grant Reaber <grant.reaber@gmail.com>
Graydon Hoare <graydon@pobox.com>
@@ -853,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>
@@ -872,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>
@@ -966,6 +992,7 @@ James Nugent <james@jen20.com>
James Sanders <james3sanders@gmail.com>
James Turnbull <james@lovedthanlost.net>
James Watkins-Harvey <jwatkins@progi-media.com>
Jameson Hyde <jameson.hyde@docker.com>
Jamie Hannaford <jamie@limetree.org>
Jamshid Afshar <jafshar@yahoo.com>
Jan Breig <git@pygos.space>
@@ -1064,13 +1091,17 @@ Jim Perrin <jperrin@centos.org>
Jimmy Cuadra <jimmy@jimmycuadra.com>
Jimmy Puckett <jimmy.puckett@spinen.com>
Jimmy Song <rootsongjc@gmail.com>
jinjiadu <jinjiadu@aliyun.com>
Jinsoo Park <cellpjs@gmail.com>
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>
Joan Grau <grautxo.dev@proton.me>
Joao Fernandes <joao.fernandes@docker.com>
Joao Trindade <trindade.joao@gmail.com>
Joe Beda <joe.github@bedafamily.com>
@@ -1155,6 +1186,7 @@ Josiah Kiehl <jkiehl@riotgames.com>
José Tomás Albornoz <jojo@eljojo.net>
Joyce Jang <mail@joycejang.com>
JP <jpellerin@leapfrogonline.com>
JSchltggr <jschltggr@gmail.com>
Julian Taylor <jtaylor.debian@googlemail.com>
Julien Barbier <write0@gmail.com>
Julien Bisconti <veggiemonk@users.noreply.github.com>
@@ -1189,6 +1221,7 @@ K. Heller <pestophagous@gmail.com>
Kai Blin <kai@samba.org>
Kai Qiang Wu (Kennan) <wkq5325@gmail.com>
Kaijie Chen <chen@kaijie.org>
Kaita Nakamura <kaita.nakamura0830@gmail.com>
Kamil Domański <kamil@domanski.co>
Kamjar Gerami <kami.gerami@gmail.com>
Kanstantsin Shautsou <kanstantsin.sha@gmail.com>
@@ -1263,6 +1296,7 @@ Krasi Georgiev <krasi@vip-consult.solutions>
Krasimir Georgiev <support@vip-consult.co.uk>
Kris-Mikael Krister <krismikael@protonmail.com>
Kristian Haugene <kristian.haugene@capgemini.com>
Kristian Heljas <kristian@kristian.ee>
Kristina Zabunova <triara.xiii@gmail.com>
Krystian Wojcicki <kwojcicki@sympatico.ca>
Kunal Kushwaha <kushwaha_kunal_v7@lab.ntt.co.jp>
@@ -1289,11 +1323,13 @@ Laura Brehm <laurabrehm@hey.com>
Laura Frank <ljfrank@gmail.com>
Laurent Bernaille <laurent.bernaille@datadoghq.com>
Laurent Erignoux <lerignoux@gmail.com>
Laurent Goderre <laurent.goderre@docker.com>
Laurie Voss <github@seldo.com>
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>
@@ -1369,6 +1405,7 @@ Madhan Raj Mookkandy <MadhanRaj.Mookkandy@microsoft.com>
Madhav Puri <madhav.puri@gmail.com>
Madhu Venugopal <mavenugo@gmail.com>
Mageee <fangpuyi@foxmail.com>
maggie44 <64841595+maggie44@users.noreply.github.com>
Mahesh Tiyyagura <tmahesh@gmail.com>
malnick <malnick@gmail..com>
Malte Janduda <mail@janduda.net>
@@ -1380,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>
@@ -1394,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>
@@ -1462,6 +1501,7 @@ Matthias Kühnle <git.nivoc@neverbox.com>
Matthias Rampke <mr@soundcloud.com>
Matthieu Fronton <m@tthieu.fr>
Matthieu Hauglustaine <matt.hauglustaine@gmail.com>
Matthieu MOREL <matthieu.morel35@gmail.com>
Mattias Jernberg <nostrad@gmail.com>
Mauricio Garavaglia <mauricio@medallia.com>
mauriyouth <mauriyouth@gmail.com>
@@ -1476,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>
@@ -1576,9 +1617,11 @@ 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>
Myeongjoon Kim <kimmj8409@gmail.com>
Máximo Cuadros <mcuadros@gmail.com>
Médi-Rémi Hashim <medimatrix@users.noreply.github.com>
Nace Oroz <orkica@gmail.com>
@@ -1593,6 +1636,7 @@ Natasha Jarus <linuxmercedes@gmail.com>
Nate Brennand <nate.brennand@clever.com>
Nate Eagleson <nate@nateeag.com>
Nate Jones <nate@endot.org>
Nathan Baulch <nathan.baulch@gmail.com>
Nathan Carlson <carl4403@umn.edu>
Nathan Herald <me@nathanherald.com>
Nathan Hsieh <hsieh.nathan@gmail.com>
@@ -1655,6 +1699,7 @@ Nuutti Kotivuori <naked@iki.fi>
nzwsch <hi@nzwsch.com>
O.S. Tezer <ostezer@gmail.com>
objectified <objectified@gmail.com>
Octol1ttle <l1ttleofficial@outlook.com>
Odin Ugedal <odin@ugedal.com>
Oguz Bilgic <fisyonet@gmail.com>
Oh Jinkyun <tintypemolly@gmail.com>
@@ -1689,6 +1734,7 @@ Patrick Hemmer <patrick.hemmer@gmail.com>
Patrick St. laurent <patrick@saint-laurent.us>
Patrick Stapleton <github@gdi2290.com>
Patrik Cyvoct <patrik@ptrk.io>
Patrik Leifert <patrikleifert@hotmail.com>
pattichen <craftsbear@gmail.com>
Paul "TBBle" Hampson <Paul.Hampson@Pobox.com>
Paul <paul9869@gmail.com>
@@ -1763,6 +1809,7 @@ Pierre Carrier <pierre@meteor.com>
Pierre Dal-Pra <dalpra.pierre@gmail.com>
Pierre Wacrenier <pierre.wacrenier@gmail.com>
Pierre-Alain RIVIERE <pariviere@ippon.fr>
pinglanlu <pinglanlu@outlook.com>
Piotr Bogdan <ppbogdan@gmail.com>
Piotr Karbowski <piotr.karbowski@protonmail.ch>
Porjo <porjo38@yahoo.com.au>
@@ -1790,6 +1837,7 @@ Quentin Tayssier <qtayssier@gmail.com>
r0n22 <cameron.regan@gmail.com>
Rachit Sharma <rachitsharma613@gmail.com>
Radostin Stoyanov <rstoyanov1@gmail.com>
Rafael Fernández López <ereslibre@ereslibre.es>
Rafal Jeczalik <rjeczalik@gmail.com>
Rafe Colton <rafael.colton@gmail.com>
Raghavendra K T <raghavendra.kt@linux.vnet.ibm.com>
@@ -1845,6 +1893,7 @@ Robert Obryk <robryk@gmail.com>
Robert Schneider <mail@shakeme.info>
Robert Shade <robert.shade@gmail.com>
Robert Stern <lexandro2000@gmail.com>
Robert Sturla <robertsturla@outlook.com>
Robert Terhaar <rterhaar@atlanticdynamic.com>
Robert Wallis <smilingrob@gmail.com>
Robert Wang <robert@arctic.tw>
@@ -1856,7 +1905,7 @@ Robin Speekenbrink <robin@kingsquare.nl>
Robin Thoni <robin@rthoni.com>
robpc <rpcann@gmail.com>
Rodolfo Carvalho <rhcarvalho@gmail.com>
Rodrigo Campos <rodrigo@kinvolk.io>
Rodrigo Campos <rodrigoca@microsoft.com>
Rodrigo Vaz <rodrigo.vaz@gmail.com>
Roel Van Nyen <roel.vannyen@gmail.com>
Roger Peppe <rogpeppe@gmail.com>
@@ -1988,13 +2037,16 @@ 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>
Shawn Landden <shawn@churchofgit.com>
Shawn Siefkas <shawn.siefkas@meredith.com>
@@ -2013,6 +2065,7 @@ Shijun Qin <qinshijun16@mails.ucas.ac.cn>
Shishir Mahajan <shishir.mahajan@redhat.com>
Shoubhik Bose <sbose78@gmail.com>
Shourya Sarcar <shourya.sarcar@gmail.com>
Shreenidhi Shedi <shreenidhi.shedi@broadcom.com>
Shu-Wai Chow <shu-wai.chow@seattlechildrens.org>
shuai-z <zs.broccoli@gmail.com>
Shukui Yang <yangshukui@huawei.com>
@@ -2083,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>
@@ -2100,6 +2154,7 @@ Sébastien Stormacq <sebsto@users.noreply.github.com>
Sören Tempel <soeren+git@soeren-tempel.net>
Tabakhase <mail@tabakhase.com>
Tadej Janež <tadej.j@nez.si>
Tadeusz Dudkiewicz <tadeusz.dudkiewicz@rtbhouse.com>
Takuto Sato <tockn.jp@gmail.com>
tang0th <tang0th@gmx.com>
Tangi Colin <tangicolin@gmail.com>
@@ -2107,6 +2162,7 @@ Tatsuki Sugiura <sugi@nemui.org>
Tatsushi Inagaki <e29253@jp.ibm.com>
Taylan Isikdemir <taylani@google.com>
Taylor Jones <monitorjbl@gmail.com>
tcpdumppy <847462026@qq.com>
Ted M. Young <tedyoung@gmail.com>
Tehmasp Chaudhri <tehmasp@gmail.com>
Tejaswini Duggaraju <naduggar@microsoft.com>
@@ -2137,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>
@@ -2237,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>
@@ -2391,6 +2449,7 @@ You-Sheng Yang (楊有勝) <vicamo@gmail.com>
youcai <omegacoleman@gmail.com>
Youcef YEKHLEF <yyekhlef@gmail.com>
Youfu Zhang <zhangyoufu@gmail.com>
YR Chen <stevapple@icloud.com>
Yu Changchun <yuchangchun1@huawei.com>
Yu Chengxia <yuchengxia@huawei.com>
Yu Peng <yu.peng36@zte.com.cn>
@@ -2452,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

@@ -83,6 +83,39 @@ contributions, see [the advanced contribution
section](https://docs.docker.com/opensource/workflow/advanced-contributing/) in
the contributors guide.
### Where to put your changes
You can make changes to any Go package within Moby outside of the vendor directory. There are no
restrictions on packages but a few guidelines to follow for deciding on making these changes.
When adding new packages, first consider putting them in an internal directory to prevent
unintended importing from other modules. Code changes should either go under `api`, `client`,
or `daemon` modules, or one of the integration test directories.
Try to put a new package under the appropriate directories. The root directory is reserved for
configuration and build files, no source files will be accepted in the root.
- `api` - All types shared by client and daemon along with swagger definitions.
- `client` - All Go files for the docker client
- `contrib` - Files, configurations, and packages related to external tools or libraries
- `daemon` - All Go files and packages for building the daemon
- `docs` - All Moby technical documentation using markdown
- `hack` - All scripts used for testing, development, and CI
- `integration` - Testing the integration of the API, client, and daemon
- `integration-cli` - Deprecated integration tests of the docker cli with the daemon, no new tests allowed
- `pkg` - Legacy Go packages used externally, no new packages should be added here
- `project` - All files related to Moby project governance
- `vendor` - Autogenerated vendor files from `make vendor` command, do not manually edit files here
The daemon module has many subpackages. Consider putting new packages under one of these
directories.
- `daemon/cmd` - All Go main packages and the packages used only for that main package
- `daemon/internal` - All utility packages used by daemon and not intended for external use
- `daemon/man`- All Moby reference manuals used for the `man` command
- `daemon/plugins` - All included daemon plugins which are intended to be registered via init
- `daemon/pkg` - All libraries used by daemon and for integration testing
- `daemon/version` - Version package with the current daemon version
### Connect with other Moby Project contributors
<table class="tg">

View File

@@ -1,19 +1,30 @@
# syntax=docker/dockerfile:1.7
# syntax=docker/dockerfile:1
ARG GO_VERSION=1.23.6
ARG GO_VERSION=1.25.2
ARG BASE_DEBIAN_DISTRO="bookworm"
ARG GOLANG_IMAGE="golang:${GO_VERSION}-${BASE_DEBIAN_DISTRO}"
ARG XX_VERSION=1.6.1
ARG VPNKIT_VERSION=0.5.0
# 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.5.0
ARG DOCKERCLI_REPOSITORY="https://github.com/docker/cli.git"
ARG DOCKERCLI_VERSION=v27.5.0
# cli version used for integration-cli tests
ARG DOCKERCLI_INTEGRATION_REPOSITORY="https://github.com/docker/cli.git"
ARG DOCKERCLI_INTEGRATION_VERSION=v17.06.2-ce
ARG BUILDX_VERSION=0.20.0
ARG COMPOSE_VERSION=v2.32.4
ARG DOCKERCLI_INTEGRATION_VERSION=v18.06.3-ce
# BUILDX_VERSION is the version of buildx to install in the dev container.
ARG BUILDX_VERSION=0.29.1
# COMPOSE_VERSION is the version of compose to install in the dev container.
ARG COMPOSE_VERSION=v2.40.0
ARG SYSTEMD="false"
ARG FIREWALLD="false"
@@ -23,11 +34,16 @@ ARG DOCKER_STATIC=1
# https://hub.docker.com/r/distribution/distribution. This version of
# the registry is used to test schema 2 manifests. Generally, the version
# specified here should match a current release.
ARG REGISTRY_VERSION=3.0.0-rc.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.8.1/pkg/proc/native/support_sentinel.go#L1-L6
ARG DELVE_SUPPORTED=${TARGETPLATFORM#linux/amd64} DELVE_SUPPORTED=${DELVE_SUPPORTED#linux/arm64}
# 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:
# https://github.com/go-delve/delve/commit/71f12207175a1cc09668f856340d8a543c87dcca
ARG DELVE_SUPPORTED=${TARGETPLATFORM#linux/amd64} DELVE_SUPPORTED=${DELVE_SUPPORTED#linux/arm64} DELVE_SUPPORTED=${DELVE_SUPPORTED#linux/ppc64le}
ARG DELVE_SUPPORTED=${DELVE_SUPPORTED:+"unsupported"}
ARG DELVE_SUPPORTED=${DELVE_SUPPORTED:-"supported"}
@@ -44,9 +60,13 @@ COPY --from=build-dummy /build /build
# base
FROM --platform=$BUILDPLATFORM ${GOLANG_IMAGE} AS base
COPY --from=xx / /
# Disable collecting local telemetry, as collected by Go and Delve;
#
# - https://github.com/go-delve/delve/blob/v1.24.1/CHANGELOG.md#1231-2024-09-23
# - https://go.dev/doc/telemetry#background
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
@@ -60,62 +80,22 @@ RUN --mount=type=cache,sharing=locked,id=moby-criu-aptlib,target=/var/lib/apt \
&& /build/criu --version
# registry
FROM base AS registry-src
WORKDIR /usr/src/registry
RUN git init . && git remote add origin "https://github.com/distribution/distribution.git"
FROM base AS registry
WORKDIR /go/src/github.com/docker/distribution
# REGISTRY_VERSION_SCHEMA1 specifies the version of the registry to build and
# install from the https://github.com/docker/distribution repository. This is
# an older (pre v2.3.0) version of the registry that only supports schema1
# manifests. This version of the registry is not working on arm64, so installation
# is skipped on that architecture.
ARG REGISTRY_VERSION_SCHEMA1=v2.1.0
ARG TARGETPLATFORM
RUN --mount=from=registry-src,src=/usr/src/registry,rw \
--mount=type=cache,target=/root/.cache/go-build,id=registry-build-$TARGETPLATFORM \
--mount=type=cache,target=/go/pkg/mod \
--mount=type=tmpfs,target=/go/src <<EOT
set -ex
export GOPATH="/go/src/github.com/docker/distribution/Godeps/_workspace:$GOPATH"
# Make the /build directory no matter what so that it doesn't fail on arm64 or
# any other platform where we don't build this registry
mkdir /build
case $TARGETPLATFORM in
linux/amd64|linux/arm/v7|linux/ppc64le|linux/s390x)
git fetch -q --depth 1 origin "${REGISTRY_VERSION_SCHEMA1}" +refs/tags/*:refs/tags/*
git checkout -q FETCH_HEAD
CGO_ENABLED=0 xx-go build -o /build/registry-v2-schema1 -v ./cmd/registry
xx-verify /build/registry-v2-schema1
;;
esac
EOT
FROM distribution/distribution:$REGISTRY_VERSION AS registry-v2
RUN mkdir /build && mv /bin/registry /build/registry-v2
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
@@ -136,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 \
@@ -150,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.23.0
ARG DELVE_VERSION=v1.25.0
RUN git fetch -q --depth 1 origin "${DELVE_VERSION}" +refs/tags/*:refs/tags/* && git checkout -q FETCH_HEAD
FROM base AS delve-supported
@@ -160,32 +140,19 @@ 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
FROM binary-dummy AS delve-unsupported
FROM delve-${DELVE_SUPPORTED} AS delve
FROM base AS tomll
# GOTOML_VERSION specifies the version of the tomll binary to build and install
# from the https://github.com/pelletier/go-toml repository. This binary is used
# in CI in the hack/validate/toml script.
#
# When updating this version, consider updating the github.com/pelletier/go-toml
# dependency in vendor.mod accordingly.
ARG GOTOML_VERSION=v1.8.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/pelletier/go-toml/cmd/tomll@${GOTOML_VERSION}" \
&& /build/tomll --help
FROM base AS gowinres
# GOWINRES_VERSION defines go-winres tool version
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
@@ -195,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.25
# specified here.
ARG CONTAINERD_VERSION=v1.7.28
RUN git fetch -q --depth 1 origin "${CONTAINERD_VERSION}" +refs/tags/*:refs/tags/* && git checkout -q FETCH_HEAD
FROM base AS containerd-build
@@ -230,30 +194,31 @@ FROM binary-dummy AS containerd-windows
FROM containerd-${TARGETOS} AS containerd
FROM base AS golangci_lint
ARG GOLANGCI_LINT_VERSION=v1.62.0
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/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.8.2
# 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
@@ -287,9 +252,8 @@ 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
# 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.4
# project first, and update both after that is merged.
ARG RUNC_VERSION=v1.3.0
RUN git fetch -q --depth 1 origin "${RUNC_VERSION}" +refs/tags/*:refs/tags/* && git checkout -q FETCH_HEAD
FROM base AS runc-build
@@ -356,8 +320,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.2
# 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
@@ -369,7 +333,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 \
@@ -387,7 +350,8 @@ FROM binary-dummy AS rootlesskit-windows
FROM rootlesskit-${TARGETOS} AS rootlesskit
FROM base AS crun
ARG CRUN_VERSION=1.12
# CRUN_VERSION is the version of crun to install in the dev-container.
ARG CRUN_VERSION=1.21
RUN --mount=type=cache,sharing=locked,id=moby-crun-aptlib,target=/var/lib/apt \
--mount=type=cache,sharing=locked,id=moby-crun-aptcache,target=/var/cache/apt \
apt-get update && apt-get install -y --no-install-recommends \
@@ -418,8 +382,8 @@ FROM scratch AS vpnkit-linux-arm
FROM scratch AS vpnkit-linux-ppc64le
FROM scratch AS vpnkit-linux-riscv64
FROM scratch AS vpnkit-linux-s390x
FROM djs55/vpnkit:${VPNKIT_VERSION} AS vpnkit-linux-amd64
FROM djs55/vpnkit:${VPNKIT_VERSION} AS vpnkit-linux-arm64
FROM moby/vpnkit-bin:${VPNKIT_VERSION} AS vpnkit-linux-amd64
FROM moby/vpnkit-bin:${VPNKIT_VERSION} AS vpnkit-linux-arm64
FROM vpnkit-linux-${TARGETARCH} AS vpnkit-linux
FROM vpnkit-${TARGETOS} AS vpnkit
@@ -451,18 +415,16 @@ FROM binary-dummy AS containerutil-linux
FROM containerutil-build AS containerutil-windows-amd64
FROM containerutil-windows-${TARGETARCH} AS containerutil-windows
FROM containerutil-${TARGETOS} AS containerutil
FROM docker/buildx-bin:${BUILDX_VERSION} as buildx
FROM docker/compose-bin:${COMPOSE_VERSION} as compose
FROM docker/buildx-bin:${BUILDX_VERSION} AS buildx
FROM docker/compose-bin:${COMPOSE_VERSION} AS compose
FROM base AS dev-systemd-false
COPY --link --from=frozen-images /build/ /docker-frozen-images
COPY --link --from=swagger /build/ /usr/local/bin/
COPY --link --from=delve /build/ /usr/local/bin/
COPY --link --from=tomll /build/ /usr/local/bin/
COPY --link --from=gowinres /build/ /usr/local/bin/
COPY --link --from=tini /build/ /usr/local/bin/
COPY --link --from=registry /build/ /usr/local/bin/
COPY --link --from=registry-v2 /build/ /usr/local/bin/
# Skip the CRIU stage for now, as the opensuse package repository is sometimes
# unstable, and we're currently not using it in CI.
@@ -509,7 +471,6 @@ RUN --mount=type=cache,sharing=locked,id=moby-dev-aptlib,target=/var/lib/apt \
--mount=type=cache,sharing=locked,id=moby-dev-aptcache,target=/var/cache/apt \
apt-get update && apt-get install -y --no-install-recommends \
firewalld
RUN sed -i 's/FirewallBackend=nftables/FirewallBackend=iptables/' /etc/firewalld/firewalld.conf
FROM dev-firewalld-${FIREWALLD} AS dev-base
RUN groupadd -r docker
@@ -532,15 +493,19 @@ RUN --mount=type=cache,sharing=locked,id=moby-dev-aptlib,target=/var/lib/apt \
apparmor \
bash-completion \
bzip2 \
fuse-overlayfs \
inetutils-ping \
iproute2 \
iptables \
nftables \
jq \
libcap2-bin \
libnet1 \
libnftables-dev \
libnl-3-200 \
libprotobuf-c1 \
libyajl2 \
nano \
net-tools \
netcat-openbsd \
patch \
@@ -555,11 +520,6 @@ RUN --mount=type=cache,sharing=locked,id=moby-dev-aptlib,target=/var/lib/apt \
xz-utils \
zip \
zstd
# Switch to use iptables instead of nftables (to match the CI hosts)
# TODO use some kind of runtime auto-detection instead if/when nftables is supported (https://github.com/moby/moby/issues/26824)
RUN update-alternatives --set iptables /usr/sbin/iptables-legacy || true \
&& update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy || true \
&& update-alternatives --set arptables /usr/sbin/arptables-legacy || true
RUN --mount=type=cache,sharing=locked,id=moby-dev-aptlib,target=/var/lib/apt \
--mount=type=cache,sharing=locked,id=moby-dev-aptcache,target=/var/cache/apt \
apt-get update && apt-get install --no-install-recommends -y \
@@ -575,20 +535,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
@@ -612,7 +573,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")
@@ -647,7 +607,7 @@ COPY --link --from=build /build /
# smoke tests
# usage:
# > docker buildx bake binary-smoketest
FROM --platform=$TARGETPLATFORM base AS smoketest
FROM base AS smoketest
WORKDIR /usr/local/bin
COPY --from=build /build .
RUN <<EOT
@@ -663,6 +623,15 @@ FROM dev-base AS devcontainer
COPY --link . .
COPY --link --from=gopls /build/ /usr/local/bin/
# usage:
# > docker buildx bake dind
# > docker run -d --restart always --privileged --name devdind -p 12375:2375 docker-dind --debug --host=tcp://0.0.0.0:2375 --tlsverify=false
FROM docker:dind AS dind
COPY --link --from=dockercli /build/docker /usr/local/bin/
COPY --link --from=buildx /buildx /usr/local/libexec/docker/cli-plugins/docker-buildx
COPY --link --from=compose /docker-compose /usr/local/libexec/docker/cli-plugins/docker-compose
COPY --link --from=all / /usr/local/bin/
# usage:
# > make shell
# > SYSTEMD=true make shell

View File

@@ -5,18 +5,17 @@
# This represents the bare minimum required to build and test Docker.
ARG GO_VERSION=1.23.6
ARG GO_VERSION=1.25.2
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 \
@@ -35,10 +34,10 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
vim-common \
&& rm -rf /var/lib/apt/lists/*
# Install runc, containerd, tini and docker-proxy
# Install runc, containerd, and tini
# Please edit hack/dockerfile/install/<name>.installer to update them.
COPY hack/dockerfile/install hack/dockerfile/install
RUN for i in runc containerd tini proxy dockercli; \
RUN set -e; for i in runc containerd tini dockercli; \
do hack/dockerfile/install/install.sh $i; \
done
ENV PATH=/usr/local/cli:$PATH

View File

@@ -161,10 +161,14 @@ 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.23.6
ARG GOTESTSUM_VERSION=v1.8.2
ARG GOWINRES_VERSION=v0.3.1
ARG CONTAINERD_VERSION=v1.7.25
ARG GO_VERSION=1.25.2
# 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.28
# Environment variable notes:
# - GO_VERSION must be consistent with 'Dockerfile' used by Linux.
@@ -174,7 +178,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} `
@@ -255,14 +258,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"""; `
@@ -274,13 +274,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..."'; `
} `
@@ -290,13 +288,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

@@ -1,597 +1,33 @@
# Moby maintainers file
#
# This file describes the maintainer groups within the moby/moby project.
# More detail on Moby project governance is available in the
# project/GOVERNANCE.md file found in this repository.
# See project/GOVERNANCE.md for committer versus reviewer roles
#
# It is structured to be consumable by both humans and programs.
# To extract its contents programmatically, use any TOML-compliant
# parser.
# COMMITTERS
# 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","austin.vazquez.dev@gmail.com"
"corhere","Cory Snider","csnider@mirantis.com"
"cpuguy83","Brian Goff","cpuguy83@gmail.com"
"robmry","Rob Murray","rob.murray@docker.com"
"thaJeztah","Sebastiaan van Stijn","github@gone.nl"
"tianon","Tianon Gravi","admwiggin@gmail.com"
"tonistiigi","Tõnis Tiigi","tonis@docker.com"
"vvoland","Paweł Gronowski","pawel.gronowski@docker.com"
#
# TODO(estesp): This file should not necessarily depend on docker/opensource
# This file is compiled into the MAINTAINERS file in docker/opensource.
#
[Org]
[Org."Core maintainers"]
# The Core maintainers are the ghostbusters of the project: when there's a problem others
# can't solve, they show up and fix it with bizarre devices and weaponry.
# They have final say on technical implementation and coding style.
# They are ultimately responsible for quality in all its forms: usability polish,
# bugfixes, performance, stability, etc. When ownership can cleanly be passed to
# a subsystem, they are responsible for doing so and holding the
# subsystem maintainers accountable. If ownership is unclear, they are the de facto owners.
people = [
"akerouanton",
"akihirosuda",
"anusha",
"austinvazquez",
"coolljt0725",
"corhere",
"cpuguy83",
"crazy-max",
"estesp",
"johnstep",
"justincormack",
"kolyshkin",
"laurazard",
"mhbauer",
"neersighted",
"robmry",
"rumpl",
"runcom",
"samuelkarp",
"stevvooe",
"thajeztah",
"tianon",
"tibor",
"tonistiigi",
"unclejack",
"vdemeester",
"vieux",
"vvoland",
"yongtang"
]
[Org.Curators]
# The curators help ensure that incoming issues and pull requests are properly triaged and
# that our various contribution and reviewing processes are respected. With their knowledge of
# the repository activity, they can also guide contributors to relevant material or
# discussions.
#
# They are neither code nor docs reviewers, so they are never expected to merge. They can
# however:
# - close an issue or pull request when it's an exact duplicate
# - close an issue or pull request when it's inappropriate or off-topic
people = [
"alexellis",
"andrewhsu",
"bsousaa",
"dmcgowan",
"fntlnz",
"gianarb",
"olljanat",
"programmerq",
"ripcurld",
"sam-thibault",
"samwhited",
"thajeztah",
"thompson-shaun",
]
[Org.Alumni]
# This list contains maintainers that are no longer active on the project.
# It is thanks to these people that the project has become what it is today.
# Thank you!
people = [
# Aaron Lehmann was a maintainer for swarmkit, the registry, and the engine,
# and contributed many improvements, features, and bugfixes in those areas,
# among which "automated service rollbacks", templated secrets and configs,
# and resumable image layer downloads.
"aaronlehmann",
# Harald Albers is the mastermind behind the bash completion scripts for the
# Docker CLI. The completion scripts moved to the Docker CLI repository, so
# you can now find him perform his magic in the https://github.com/docker/cli repository.
"albers",
# Andrea Luzzardi started contributing to the Docker codebase in the "dotCloud"
# era, even before it was called "Docker". He is one of the architects of both
# Swarm and SwarmKit, and its integration into the Docker engine.
"aluzzardi",
# David Calavera contributed many features to Docker, such as an improved
# event system, dynamic configuration reloading, volume plugins, fancy
# new templating options, and an external client credential store. As a
# maintainer, David was release captain for Docker 1.8, and competing
# with Jess Frazelle to be "top dream killer".
# David is now doing amazing stuff as CTO for https://www.netlify.com,
# and tweets as @calavera.
"calavera",
# Michael Crosby was "chief maintainer" of the Docker project.
# During his time as a maintainer, Michael contributed to many
# milestones of the project; he was release captain of Docker v1.0.0,
# started the development of "libcontainer" (what later became runc)
# and containerd, as well as demoing cool hacks such as live migrating
# a game server container with checkpoint/restore.
#
# Michael is currently a maintainer of containerd, but you may see
# him around in other projects on GitHub.
"crosbymichael",
# Before becoming a maintainer, Daniel Nephin was a core contributor
# to "Fig" (now known as Docker Compose). As a maintainer for both the
# Engine and Docker CLI, Daniel contributed many features, among which
# the `docker stack` commands, allowing users to deploy their Docker
# Compose projects as a Swarm service.
"dnephin",
# Doug Davis contributed many features and fixes for the classic builder,
# such as "wildcard" copy, the dockerignore file, custom paths/names
# for the Dockerfile, as well as enhancements to the API and documentation.
# Follow Doug on Twitter, where he tweets as @duginabox.
"duglin",
# As a maintainer, Erik was responsible for the "builder", and
# started the first designs for the new networking model in
# Docker. Erik is now working on all kinds of plugins for Docker
# (https://github.com/contiv) and various open source projects
# in his own repository https://github.com/erikh. You may
# still stumble into him in our issue tracker, or on IRC.
"erikh",
# Evan Hazlett is the creator of the Shipyard and Interlock open source projects,
# and the author of "Orca", which became the foundation of Docker Universal Control
# Plane (UCP). As a maintainer, Evan helped integrating SwarmKit (secrets, tasks)
# into the Docker engine.
"ehazlett",
# Arnaud Porterie (AKA "icecrime") was in charge of maintaining the maintainers.
# As a maintainer, he made life easier for contributors to the Docker open-source
# projects, bringing order in the chaos by designing a triage- and review workflow
# using labels (see https://icecrime.net/technology/a-structured-approach-to-labeling/),
# and automating the hell out of things with his buddies GordonTheTurtle and Poule
# (a chicken!).
#
# A lesser-known fact is that he created the first commit in the libnetwork repository
# even though he didn't know anything about it. Some say, he's now selling stuff on
# the internet ;-)
"icecrime",
# After a false start with his first PR being rejected, James Turnbull became a frequent
# contributor to the documentation, and became a docs maintainer on December 5, 2013. As
# a maintainer, James lifted the docs to a higher standard, and introduced the community
# guidelines ("three strikes"). James is currently changing the world as CTO of https://www.empatico.org,
# meanwhile authoring various books that are worth checking out. You can find him on Twitter,
# rambling as @kartar, and although no longer active as a maintainer, he's always "game" to
# help out reviewing docs PRs, so you may still see him around in the repository.
"jamtur01",
# Jessica Frazelle, also known as the "Keyser Söze of containers",
# runs *everything* in containers. She started contributing to
# Docker with a (fun fun) change involving both iptables and regular
# expressions (coz, YOLO!) on July 10, 2014
# https://github.com/docker/docker/pull/6950/commits/f3a68ffa390fb851115c77783fa4031f1d3b2995.
# Jess was Release Captain for Docker 1.4, 1.6 and 1.7, and contributed
# many features and improvement, among which "seccomp profiles" (making
# containers a lot more secure). Besides being a maintainer, she
# set up the CI infrastructure for the project, giving everyone
# something to shout at if a PR failed ("noooo Janky!").
# Be sure you don't miss her talks at a conference near you (a must-see),
# read her blog at https://blog.jessfraz.com (a must-read), and
# check out her open source projects on GitHub https://github.com/jessfraz (a must-try).
"jessfraz",
# As a maintainer, John Howard managed to make the impossible possible;
# to run Docker on Windows. After facing many challenges, teaching
# fellow-maintainers that 'Windows is not Linux', and many changes in
# Windows Server to facilitate containers, native Windows containers
# saw the light of day in 2015.
#
# John is now enjoying life without containers: playing piano, painting,
# and walking his dogs, but you may occasionally see him drop by on GitHub.
"lowenna",
# Alexander Morozov contributed many features to Docker, worked on the premise of
# what later became containerd (and worked on that too), and made a "stupid" Go
# vendor tool specifically for docker/docker needs: vndr (https://github.com/LK4D4/vndr).
# Not many know that Alexander is a master negotiator, being able to change course
# of action with a single "Nope, we're not gonna do that".
"lk4d4",
# Madhu Venugopal was part of the SocketPlane team that joined Docker.
# As a maintainer, he was working with Jana for the Container Network
# Model (CNM) implemented through libnetwork, and the "routing mesh" powering
# Swarm mode networking.
"mavenugo",
# As a maintainer, Kenfe-Mickaël Laventure worked on the container runtime,
# integrating containerd 1.0 with the daemon, and adding support for custom
# OCI runtimes, as well as implementing the `docker prune` subcommands,
# which was a welcome feature to be added. You can keep up with Mickaél on
# Twitter (@kmlaventure).
"mlaventure",
# As a docs maintainer, Mary Anthony contributed greatly to the Docker
# docs. She wrote the Docker Contributor Guide and Getting Started
# Guides. She helped create a doc build system independent of
# docker/docker project, and implemented a new docs.docker.com theme and
# nav for 2015 Dockercon. Fun fact: the most inherited layer in DockerHub
# public repositories was originally referenced in
# maryatdocker/docker-whale back in May 2015.
"moxiegirl",
# Jana Radhakrishnan was part of the SocketPlane team that joined Docker.
# As a maintainer, he was the lead architect for the Container Network
# Model (CNM) implemented through libnetwork, and the "routing mesh" powering
# Swarm mode networking.
#
# Jana started new adventures in networking, but you can find him tweeting as @mrjana,
# coding on GitHub https://github.com/mrjana, and he may be hiding on the Docker Community
# slack channel :-)
"mrjana",
# Sven Dowideit became a well known person in the Docker ecosphere, building
# boot2docker, and became a regular contributor to the project, starting as
# early as October 2013 (https://github.com/docker/docker/pull/2119), to become
# a maintainer less than two months later (https://github.com/docker/docker/pull/3061).
#
# As a maintainer, Sven took on the task to convert the documentation from
# ReStructuredText to Markdown, migrate to Hugo for generating the docs, and
# writing tooling for building, testing, and publishing them.
#
# If you're not in the occasion to visit "the Australian office", you
# can keep up with Sven on Twitter (@SvenDowideit), his blog http://fosiki.com,
# and of course on GitHub.
"sven",
# Vincent "vbatts!" Batts made his first contribution to the project
# in November 2013, to become a maintainer a few months later, on
# May 10, 2014 (https://github.com/docker/docker/commit/d6e666a87a01a5634c250358a94c814bf26cb778).
# As a maintainer, Vincent made important contributions to core elements
# of Docker, such as "distribution" (tarsum) and graphdrivers (btrfs, devicemapper).
# He also contributed the "tar-split" library, an important element
# for the content-addressable store.
# Vincent is currently a member of the Open Containers Initiative
# Technical Oversight Board (TOB), besides his work at Red Hat and
# Project Atomic. You can still find him regularly hanging out in
# our repository and the #docker-dev and #docker-maintainers IRC channels
# for a chat, as he's always a lot of fun.
"vbatts",
# Vishnu became a maintainer to help out on the daemon codebase and
# libcontainer integration. He's currently involved in the
# Open Containers Initiative, working on the specifications,
# besides his work on cAdvisor and Kubernetes for Google.
"vishh"
]
[people]
# A reference list of all people associated with the project.
# All other sections should refer to people by their canonical key
# in the people section.
# ADD YOURSELF HERE IN ALPHABETICAL ORDER
[people.aaronlehmann]
Name = "Aaron Lehmann"
Email = "aaron.lehmann@docker.com"
GitHub = "aaronlehmann"
[people.akerouanton]
Name = "Albin Kerouanton"
Email = "albinker@gmail.com"
GitHub = "akerouanton"
[people.alexellis]
Name = "Alex Ellis"
Email = "alexellis2@gmail.com"
GitHub = "alexellis"
[people.akihirosuda]
Name = "Akihiro Suda"
Email = "akihiro.suda.cz@hco.ntt.co.jp"
GitHub = "AkihiroSuda"
[people.aluzzardi]
Name = "Andrea Luzzardi"
Email = "al@docker.com"
GitHub = "aluzzardi"
[people.albers]
Name = "Harald Albers"
Email = "github@albersweb.de"
GitHub = "albers"
[people.andrewhsu]
Name = "Andrew Hsu"
Email = "andrewhsu@docker.com"
GitHub = "andrewhsu"
[people.austinvazquez]
Name = "Austin Vazquez"
Email = "macedonv@amazon.com"
GitHub = "austinvazquez"
[people.anusha]
Name = "Anusha Ragunathan"
Email = "anusha@docker.com"
GitHub = "anusha-ragunathan"
[people.bsousaa]
Name = "Bruno de Sousa"
Email = "bruno.sousa@docker.com"
GitHub = "bsousaa"
[people.calavera]
Name = "David Calavera"
Email = "david.calavera@gmail.com"
GitHub = "calavera"
[people.coolljt0725]
Name = "Lei Jitang"
Email = "leijitang@huawei.com"
GitHub = "coolljt0725"
[people.corhere]
Name = "Cory Snider"
Email = "csnider@mirantis.com"
GitHub = "corhere"
[people.cpuguy83]
Name = "Brian Goff"
Email = "cpuguy83@gmail.com"
GitHub = "cpuguy83"
[people.crazy-max]
Name = "Kevin Alvarez"
Email = "contact@crazymax.dev"
GitHub = "crazy-max"
[people.crosbymichael]
Name = "Michael Crosby"
Email = "crosbymichael@gmail.com"
GitHub = "crosbymichael"
[people.dnephin]
Name = "Daniel Nephin"
Email = "dnephin@gmail.com"
GitHub = "dnephin"
[people.dmcgowan]
Name = "Derek McGowan"
Email = "derek@mcgstyle.net"
GitHub = "dmcgowan"
[people.duglin]
Name = "Doug Davis"
Email = "dug@us.ibm.com"
GitHub = "duglin"
[people.ehazlett]
Name = "Evan Hazlett"
Email = "ejhazlett@gmail.com"
GitHub = "ehazlett"
[people.erikh]
Name = "Erik Hollensbe"
Email = "erik@docker.com"
GitHub = "erikh"
[people.estesp]
Name = "Phil Estes"
Email = "estesp@linux.vnet.ibm.com"
GitHub = "estesp"
[people.fntlnz]
Name = "Lorenzo Fontana"
Email = "fontanalorenz@gmail.com"
GitHub = "fntlnz"
[people.gianarb]
Name = "Gianluca Arbezzano"
Email = "ga@thumpflow.com"
GitHub = "gianarb"
[people.icecrime]
Name = "Arnaud Porterie"
Email = "icecrime@gmail.com"
GitHub = "icecrime"
[people.jamtur01]
Name = "James Turnbull"
Email = "james@lovedthanlost.net"
GitHub = "jamtur01"
[people.jessfraz]
Name = "Jessie Frazelle"
Email = "jess@linux.com"
GitHub = "jessfraz"
[people.johnstep]
Name = "John Stephens"
Email = "johnstep@docker.com"
GitHub = "johnstep"
[people.justincormack]
Name = "Justin Cormack"
Email = "justin.cormack@docker.com"
GitHub = "justincormack"
[people.kolyshkin]
Name = "Kir Kolyshkin"
Email = "kolyshkin@gmail.com"
GitHub = "kolyshkin"
[people.laurazard]
Name = "Laura Brehm"
Email = "laurabrehm@hey.com"
GitHub = "laurazard"
[people.lk4d4]
Name = "Alexander Morozov"
Email = "lk4d4@docker.com"
GitHub = "lk4d4"
[people.lowenna]
Name = "John Howard"
Email = "github@lowenna.com"
GitHub = "lowenna"
[people.mavenugo]
Name = "Madhu Venugopal"
Email = "madhu@docker.com"
GitHub = "mavenugo"
[people.mhbauer]
Name = "Morgan Bauer"
Email = "mbauer@us.ibm.com"
GitHub = "mhbauer"
[people.mlaventure]
Name = "Kenfe-Mickaël Laventure"
Email = "mickael.laventure@gmail.com"
GitHub = "mlaventure"
[people.moxiegirl]
Name = "Mary Anthony"
Email = "mary.anthony@docker.com"
GitHub = "moxiegirl"
[people.mrjana]
Name = "Jana Radhakrishnan"
Email = "mrjana@docker.com"
GitHub = "mrjana"
[people.neersighted]
Name = "Bjorn Neergaard"
Email = "bjorn@neersighted.com"
GitHub = "neersighted"
[people.olljanat]
Name = "Olli Janatuinen"
Email = "olli.janatuinen@gmail.com"
GitHub = "olljanat"
[people.programmerq]
Name = "Jeff Anderson"
Email = "jeff@docker.com"
GitHub = "programmerq"
[people.robmry]
Name = "Rob Murray"
Email = "rob.murray@docker.com"
GitHub = "robmry"
[people.ripcurld]
Name = "Boaz Shuster"
Email = "ripcurld.github@gmail.com"
GitHub = "ripcurld"
[people.rumpl]
Name = "Djordje Lukic"
Email = "djordje.lukic@docker.com"
GitHub = "rumpl"
[people.runcom]
Name = "Antonio Murdaca"
Email = "runcom@redhat.com"
GitHub = "runcom"
[people.sam-thibault]
Name = "Sam Thibault"
Email = "sam.thibault@docker.com"
GitHub = "sam-thibault"
[people.samuelkarp]
Name = "Samuel Karp"
Email = "me@samuelkarp.com"
GitHub = "samuelkarp"
[people.samwhited]
Name = "Sam Whited"
Email = "sam@samwhited.com"
GitHub = "samwhited"
[people.shykes]
Name = "Solomon Hykes"
Email = "solomon@docker.com"
GitHub = "shykes"
[people.stevvooe]
Name = "Stephen Day"
Email = "stephen.day@docker.com"
GitHub = "stevvooe"
[people.sven]
Name = "Sven Dowideit"
Email = "SvenDowideit@home.org.au"
GitHub = "SvenDowideit"
[people.thajeztah]
Name = "Sebastiaan van Stijn"
Email = "github@gone.nl"
GitHub = "thaJeztah"
[people.thompson-shaun]
Name = "Shaun Thompson"
Email = "shaun.thompson@docker.com"
GitHub = "thompson-shaun"
[people.tianon]
Name = "Tianon Gravi"
Email = "admwiggin@gmail.com"
GitHub = "tianon"
[people.tibor]
Name = "Tibor Vass"
Email = "tibor@docker.com"
GitHub = "tiborvass"
[people.tonistiigi]
Name = "Tõnis Tiigi"
Email = "tonis@docker.com"
GitHub = "tonistiigi"
[people.unclejack]
Name = "Cristian Staretu"
Email = "cristian.staretu@gmail.com"
GitHub = "unclejack"
[people.vbatts]
Name = "Vincent Batts"
Email = "vbatts@redhat.com"
GitHub = "vbatts"
[people.vdemeester]
Name = "Vincent Demeester"
Email = "vincent@sbr.pm"
GitHub = "vdemeester"
[people.vieux]
Name = "Victor Vieux"
Email = "vieux@docker.com"
GitHub = "vieux"
[people.vishh]
Name = "Vishnu Kannan"
Email = "vishnuk@google.com"
GitHub = "vishh"
[people.vvoland]
Name = "Paweł Gronowski"
Email = "pawel.gronowski@docker.com"
GitHub = "vvoland"
[people.yongtang]
Name = "Yong Tang"
Email = "yong.tang.github@outlook.com"
GitHub = "yongtang"
# REVIEWERS
# GitHub ID, Name, Email address, GPG fingerprint
"coolljt0725","Lei Jitang","leijitang@huawei.com"
"crazy-max","Kevin Alvarez","contact@crazymax.dev"
"dmcgowan","Derek McGowan","derek@mcgstyle.net"
"estesp","Phil Estes","estesp@linux.vnet.ibm.com"
"justincormack","Justin Cormack","justin.cormack@docker.com"
"kolyshkin","Kir Kolyshkin","kolyshkin@gmail.com"
"laurazard","Laura Brehm","laurabrehm@hey.com"
"neersighted","Bjorn Neergaard","bjorn@neersighted.com"
"rumpl","Djordje Lukic","djordje.lukic@docker.com"
"samuelkarp","Samuel Karp","me@samuelkarp.com"
"stevvooe","Stephen Day","stephen.day@docker.com"
"thompson-shaun","Shaun Thompson","shaun.thompson@docker.com"
"tiborvass","Tibor Vass","tibor@docker.com"
"unclejack","Cristian Staretu","cristian.staretu@gmail.com"

View File

@@ -38,9 +38,10 @@ DOCKER_ENVS := \
-e DOCKERCLI_INTEGRATION_REPOSITORY \
-e DOCKER_DEBUG \
-e DOCKER_EXPERIMENTAL \
-e DOCKER_FIREWALLD \
-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 \
@@ -50,14 +51,14 @@ DOCKER_ENVS := \
-e DOCKER_USERLANDPROXY \
-e DOCKERD_ARGS \
-e DELVE_PORT \
-e FIREWALLD \
-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 \
-e TEST_IGNORE_CGROUP_CHECK \
-e TESTCOVERAGE \
-e TESTDEBUG \
-e TESTDIRS \
@@ -84,11 +85,11 @@ DOCKER_ENVS := \
# to allow `make BIND_DIR=. shell` or `make BIND_DIR= test`
# (default to no bind mount if DOCKER_HOST is set)
# note: BINDDIR is supported for backwards-compatibility here
BIND_DIR := $(if $(BINDDIR),$(BINDDIR),$(if $(DOCKER_HOST),,bundles))
BIND_DIR := $(if $(BINDDIR),$(BINDDIR),$(if $(DOCKER_HOST),,.))
# DOCKER_MOUNT can be overridden, but use at your own risk!
ifndef DOCKER_MOUNT
DOCKER_MOUNT := $(if $(BIND_DIR),-v "$(CURDIR)/$(BIND_DIR):/go/src/github.com/docker/docker/$(BIND_DIR)")
DOCKER_MOUNT := $(if $(BIND_DIR),-v "$(BIND_DIR):/go/src/github.com/docker/docker/$(BIND_DIR)")
DOCKER_MOUNT := $(if $(DOCKER_BINDDIR_MOUNT_OPTS),$(DOCKER_MOUNT):$(DOCKER_BINDDIR_MOUNT_OPTS),$(DOCKER_MOUNT))
# This allows the test suite to be able to run without worrying about the underlying fs used by the container running the daemon (e.g. aufs-on-aufs), so long as the host running the container is running a supported fs.
@@ -150,7 +151,7 @@ DOCKER_BUILD_ARGS += --build-arg=DOCKERCLI_INTEGRATION_REPOSITORY
ifdef DOCKER_SYSTEMD
DOCKER_BUILD_ARGS += --build-arg=SYSTEMD=true
endif
ifdef DOCKER_FIREWALLD
ifdef FIREWALLD
DOCKER_BUILD_ARGS += --build-arg=FIREWALLD=true
endif
@@ -204,7 +205,7 @@ build: shell_target := --target=dev-base
else
build: shell_target := --target=dev
endif
build: bundles
build: validate-bind-dir bundles
$(BUILD_CMD) $(BUILD_OPTS) $(shell_target) --load -t "$(DOCKER_IMAGE)" .
.PHONY: shell
@@ -285,3 +286,10 @@ generate-files:
--file "./hack/dockerfiles/generate-files.Dockerfile" .
cp -R "$($@_TMP_OUT)"/. .
rm -rf "$($@_TMP_OUT)"/*
.PHONY: validate-bind-dir
validate-bind-dir:
@case "$(BIND_DIR)" in \
".."*|"/"*) echo "Make needs to be run from the project-root directory, with BIND_DIR set to \".\" or a subdir"; \
exit 1 ;; \
esac

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 // import "github.com/docker/docker/api"
// Common constants for daemon and client.
const (
// DefaultVersion of the current REST API.
DefaultVersion = "1.48"
// 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"
)

1083
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"
@@ -2857,8 +2857,11 @@ definitions:
com.example.some-other-label: "some-other-value"
Data:
description: |
Base64-url-safe-encoded ([RFC 4648](https://tools.ietf.org/html/rfc4648#section-3.2))
data to store as secret.
Data is the data to store as a secret, formatted as a Base64-url-safe-encoded
([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/api/validation#MaxSecretSize).
This field is only used to _create_ a secret, and is not returned by
other endpoints.
@@ -2899,8 +2902,9 @@ definitions:
type: "string"
Data:
description: |
Base64-url-safe-encoded ([RFC 4648](https://tools.ietf.org/html/rfc4648#section-3.2))
config data.
Data is the data to store as a config, formatted as a Base64-url-safe-encoded
([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5)) string.
The maximum allowed size is 1000KB, as defined in [MaxConfigSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0-20250103191802-8c1959736554/manager/controlapi#MaxConfigSize).
type: "string"
Config:
type: "object"
@@ -3179,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"
@@ -3329,8 +3329,11 @@ definitions:
com.example.some-other-label: "some-other-value"
Data:
description: |
Base64-url-safe-encoded ([RFC 4648](https://tools.ietf.org/html/rfc4648#section-3.2))
data to store as secret.
Data is the data to store as a secret, formatted as a Base64-url-safe-encoded
([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/api/validation#MaxSecretSize).
This field is only used to _create_ a secret, and is not returned by
other endpoints.
@@ -3372,8 +3375,9 @@ definitions:
type: "string"
Data:
description: |
Base64-url-safe-encoded ([RFC 4648](https://tools.ietf.org/html/rfc4648#section-3.2))
config data.
Data is the data to store as a config, formatted as a Base64-url-safe-encoded
([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5)) string.
The maximum allowed size is 1000KB, as defined in [MaxConfigSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0-20250103191802-8c1959736554/manager/controlapi#MaxConfigSize).
type: "string"
Config:
@@ -3514,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"
@@ -4391,7 +4391,6 @@ paths:
Memory: 0
MemorySwap: 0
MemoryReservation: 0
KernelMemory: 0
NanoCpus: 500000
CpuPercent: 80
CpuShares: 512
@@ -4699,7 +4698,6 @@ paths:
Memory: 0
MemorySwap: 0
MemoryReservation: 0
KernelMemory: 0
OomKillDisable: false
OomScoreAdj: 500
NetworkMode: "bridge"
@@ -5388,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"
@@ -3333,8 +3333,11 @@ definitions:
com.example.some-other-label: "some-other-value"
Data:
description: |
Base64-url-safe-encoded ([RFC 4648](https://tools.ietf.org/html/rfc4648#section-3.2))
data to store as secret.
Data is the data to store as a secret, formatted as a Base64-url-safe-encoded
([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/api/validation#MaxSecretSize).
This field is only used to _create_ a secret, and is not returned by
other endpoints.
@@ -3376,8 +3379,9 @@ definitions:
type: "string"
Data:
description: |
Base64-url-safe-encoded ([RFC 4648](https://tools.ietf.org/html/rfc4648#section-3.2))
config data.
Data is the data to store as a config, formatted as a Base64-url-safe-encoded
([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5)) string.
The maximum allowed size is 1000KB, as defined in [MaxConfigSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0-20250103191802-8c1959736554/manager/controlapi#MaxConfigSize).
type: "string"
Config:
@@ -3518,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"
@@ -4395,7 +4395,6 @@ paths:
Memory: 0
MemorySwap: 0
MemoryReservation: 0
KernelMemory: 0
NanoCpus: 500000
CpuPercent: 80
CpuShares: 512
@@ -4703,7 +4702,6 @@ paths:
Memory: 0
MemorySwap: 0
MemoryReservation: 0
KernelMemory: 0
OomKillDisable: false
OomScoreAdj: 500
NetworkMode: "bridge"
@@ -5392,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"
@@ -3361,8 +3361,11 @@ definitions:
com.example.some-other-label: "some-other-value"
Data:
description: |
Base64-url-safe-encoded ([RFC 4648](https://tools.ietf.org/html/rfc4648#section-3.2))
data to store as secret.
Data is the data to store as a secret, formatted as a Base64-url-safe-encoded
([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/api/validation#MaxSecretSize).
This field is only used to _create_ a secret, and is not returned by
other endpoints.
@@ -3404,8 +3407,9 @@ definitions:
type: "string"
Data:
description: |
Base64-url-safe-encoded ([RFC 4648](https://tools.ietf.org/html/rfc4648#section-3.2))
config data.
Data is the data to store as a config, formatted as a Base64-url-safe-encoded
([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5)) string.
The maximum allowed size is 1000KB, as defined in [MaxConfigSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0-20250103191802-8c1959736554/manager/controlapi#MaxConfigSize).
type: "string"
Config:
@@ -3546,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"
@@ -4423,7 +4423,6 @@ paths:
Memory: 0
MemorySwap: 0
MemoryReservation: 0
KernelMemory: 0
NanoCpus: 500000
CpuPercent: 80
CpuShares: 512
@@ -4731,7 +4730,6 @@ paths:
Memory: 0
MemorySwap: 0
MemoryReservation: 0
KernelMemory: 0
OomKillDisable: false
OomScoreAdj: 500
NetworkMode: "bridge"
@@ -5420,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"
@@ -3365,8 +3365,11 @@ definitions:
com.example.some-other-label: "some-other-value"
Data:
description: |
Base64-url-safe-encoded ([RFC 4648](https://tools.ietf.org/html/rfc4648#section-3.2))
data to store as secret.
Data is the data to store as a secret, formatted as a Base64-url-safe-encoded
([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/api/validation#MaxSecretSize).
This field is only used to _create_ a secret, and is not returned by
other endpoints.
@@ -3408,8 +3411,9 @@ definitions:
type: "string"
Data:
description: |
Base64-url-safe-encoded ([RFC 4648](https://tools.ietf.org/html/rfc4648#section-3.2))
config data.
Data is the data to store as a config, formatted as a Base64-url-safe-encoded
([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5)) string.
The maximum allowed size is 1000KB, as defined in [MaxConfigSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0-20250103191802-8c1959736554/manager/controlapi#MaxConfigSize).
type: "string"
Config:
@@ -3550,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"
@@ -4427,7 +4427,6 @@ paths:
Memory: 0
MemorySwap: 0
MemoryReservation: 0
KernelMemory: 0
NanoCpus: 500000
CpuPercent: 80
CpuShares: 512
@@ -4735,7 +4734,6 @@ paths:
Memory: 0
MemorySwap: 0
MemoryReservation: 0
KernelMemory: 0
OomKillDisable: false
OomScoreAdj: 500
NetworkMode: "bridge"
@@ -5429,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"
@@ -3378,8 +3382,11 @@ definitions:
com.example.some-other-label: "some-other-value"
Data:
description: |
Base64-url-safe-encoded ([RFC 4648](https://tools.ietf.org/html/rfc4648#section-3.2))
data to store as secret.
Data is the data to store as a secret, formatted as a Base64-url-safe-encoded
([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/api/validation#MaxSecretSize).
This field is only used to _create_ a secret, and is not returned by
other endpoints.
@@ -3421,8 +3428,9 @@ definitions:
type: "string"
Data:
description: |
Base64-url-safe-encoded ([RFC 4648](https://tools.ietf.org/html/rfc4648#section-3.2))
config data.
Data is the data to store as a config, formatted as a Base64-url-safe-encoded
([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5)) string.
The maximum allowed size is 1000KB, as defined in [MaxConfigSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0-20250103191802-8c1959736554/manager/controlapi#MaxConfigSize).
type: "string"
Config:

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"
@@ -3384,8 +3388,11 @@ definitions:
com.example.some-other-label: "some-other-value"
Data:
description: |
Base64-url-safe-encoded ([RFC 4648](https://tools.ietf.org/html/rfc4648#section-3.2))
data to store as secret.
Data is the data to store as a secret, formatted as a Base64-url-safe-encoded
([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/api/validation#MaxSecretSize).
This field is only used to _create_ a secret, and is not returned by
other endpoints.
@@ -3434,8 +3441,9 @@ definitions:
type: "string"
Data:
description: |
Base64-url-safe-encoded ([RFC 4648](https://tools.ietf.org/html/rfc4648#section-3.2))
config data.
Data is the data to store as a config, formatted as a Base64-url-safe-encoded
([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5)) string.
The maximum allowed size is 1000KB, as defined in [MaxConfigSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0-20250103191802-8c1959736554/manager/controlapi#MaxConfigSize).
type: "string"
Templating:
description: |

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"
@@ -3438,8 +3438,11 @@ definitions:
com.example.some-other-label: "some-other-value"
Data:
description: |
Base64-url-safe-encoded ([RFC 4648](https://tools.ietf.org/html/rfc4648#section-3.2))
data to store as secret.
Data is the data to store as a secret, formatted as a Base64-url-safe-encoded
([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/api/validation#MaxSecretSize).
This field is only used to _create_ a secret, and is not returned by
other endpoints.
@@ -3488,8 +3491,9 @@ definitions:
type: "string"
Data:
description: |
Base64-url-safe-encoded ([RFC 4648](https://tools.ietf.org/html/rfc4648#section-3.2))
config data.
Data is the data to store as a config, formatted as a Base64-url-safe-encoded
([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5)) string.
The maximum allowed size is 1000KB, as defined in [MaxConfigSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0-20250103191802-8c1959736554/manager/controlapi#MaxConfigSize).
type: "string"
Templating:
description: |
@@ -3637,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"
@@ -4514,7 +4514,6 @@ paths:
Memory: 0
MemorySwap: 0
MemoryReservation: 0
KernelMemory: 0
NanoCpus: 500000
CpuPercent: 80
CpuShares: 512
@@ -4832,7 +4831,6 @@ paths:
Memory: 0
MemorySwap: 0
MemoryReservation: 0
KernelMemory: 0
OomKillDisable: false
OomScoreAdj: 500
NetworkMode: "bridge"
@@ -5539,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.
@@ -4499,8 +4498,11 @@ definitions:
com.example.some-other-label: "some-other-value"
Data:
description: |
Base64-url-safe-encoded ([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5))
data to store as secret.
Data is the data to store as a secret, formatted as a Base64-url-safe-encoded
([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/api/validation#MaxSecretSize).
This field is only used to _create_ a secret, and is not returned by
other endpoints.
@@ -4551,8 +4553,9 @@ definitions:
type: "string"
Data:
description: |
Base64-url-safe-encoded ([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5))
config data.
Data is the data to store as a config, formatted as a Base64-url-safe-encoded
([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5)) string.
The maximum allowed size is 1000KB, as defined in [MaxConfigSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0-20250103191802-8c1959736554/manager/controlapi#MaxConfigSize).
type: "string"
Templating:
description: |
@@ -4885,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
@@ -5819,7 +5818,6 @@ paths:
Memory: 0
MemorySwap: 0
MemoryReservation: 0
KernelMemory: 0
NanoCpus: 500000
CpuPercent: 80
CpuShares: 512
@@ -6093,7 +6091,6 @@ paths:
Memory: 0
MemorySwap: 0
MemoryReservation: 0
KernelMemory: 0
OomKillDisable: false
OomScoreAdj: 500
NetworkMode: "bridge"
@@ -6831,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.
@@ -4623,8 +4627,11 @@ definitions:
com.example.some-other-label: "some-other-value"
Data:
description: |
Base64-url-safe-encoded ([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5))
data to store as secret.
Data is the data to store as a secret, formatted as a Base64-url-safe-encoded
([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/api/validation#MaxSecretSize).
This field is only used to _create_ a secret, and is not returned by
other endpoints.
@@ -4675,8 +4682,9 @@ definitions:
type: "string"
Data:
description: |
Base64-url-safe-encoded ([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5))
config data.
Data is the data to store as a config, formatted as a Base64-url-safe-encoded
([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5)) string.
The maximum allowed size is 1000KB, as defined in [MaxConfigSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0-20250103191802-8c1959736554/manager/controlapi#MaxConfigSize).
type: "string"
Templating:
description: |
@@ -7944,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.
@@ -4872,8 +4876,11 @@ definitions:
com.example.some-other-label: "some-other-value"
Data:
description: |
Base64-url-safe-encoded ([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5))
data to store as secret.
Data is the data to store as a secret, formatted as a Base64-url-safe-encoded
([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/api/validation#MaxSecretSize).
This field is only used to _create_ a secret, and is not returned by
other endpoints.
@@ -4924,8 +4931,9 @@ definitions:
type: "string"
Data:
description: |
Base64-url-safe-encoded ([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5))
config data.
Data is the data to store as a config, formatted as a Base64-url-safe-encoded
([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5)) string.
The maximum allowed size is 1000KB, as defined in [MaxConfigSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0-20250103191802-8c1959736554/manager/controlapi#MaxConfigSize).
type: "string"
Templating:
description: |
@@ -8233,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"
@@ -4223,6 +4226,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.
@@ -4891,8 +4895,11 @@ definitions:
com.example.some-other-label: "some-other-value"
Data:
description: |
Base64-url-safe-encoded ([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5))
data to store as secret.
Data is the data to store as a secret, formatted as a Base64-url-safe-encoded
([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/api/validation#MaxSecretSize).
This field is only used to _create_ a secret, and is not returned by
other endpoints.
@@ -4943,8 +4950,9 @@ definitions:
type: "string"
Data:
description: |
Base64-url-safe-encoded ([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5))
config data.
Data is the data to store as a config, formatted as a Base64-url-safe-encoded
([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5)) string.
The maximum allowed size is 1000KB, as defined in [MaxConfigSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0-20250103191802-8c1959736554/manager/controlapi#MaxConfigSize).
type: "string"
Templating:
description: |
@@ -8483,7 +8491,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"
@@ -4254,6 +4257,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.
@@ -4922,8 +4926,11 @@ definitions:
com.example.some-other-label: "some-other-value"
Data:
description: |
Base64-url-safe-encoded ([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5))
data to store as secret.
Data is the data to store as a secret, formatted as a Base64-url-safe-encoded
([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/api/validation#MaxSecretSize).
This field is only used to _create_ a secret, and is not returned by
other endpoints.
@@ -4974,8 +4981,9 @@ definitions:
type: "string"
Data:
description: |
Base64-url-safe-encoded ([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5))
config data.
Data is the data to store as a config, formatted as a Base64-url-safe-encoded
([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5)) string.
The maximum allowed size is 1000KB, as defined in [MaxConfigSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0-20250103191802-8c1959736554/manager/controlapi#MaxConfigSize).
type: "string"
Templating:
description: |
@@ -8501,7 +8509,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"
@@ -4322,6 +4309,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.
@@ -5037,8 +5025,11 @@ definitions:
com.example.some-other-label: "some-other-value"
Data:
description: |
Base64-url-safe-encoded ([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5))
data to store as secret.
Data is the data to store as a secret, formatted as a Base64-url-safe-encoded
([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/api/validation#MaxSecretSize).
This field is only used to _create_ a secret, and is not returned by
other endpoints.
@@ -5089,8 +5080,9 @@ definitions:
type: "string"
Data:
description: |
Base64-url-safe-encoded ([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5))
config data.
Data is the data to store as a config, formatted as a Base64-url-safe-encoded
([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5)) string.
The maximum allowed size is 1000KB, as defined in [MaxConfigSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0-20250103191802-8c1959736554/manager/controlapi#MaxConfigSize).
type: "string"
Templating:
description: |
@@ -8658,7 +8650,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"
@@ -9643,13 +9646,9 @@ paths:
### Image tarball format
An image tarball contains one directory per image layer (named using its long ID), each containing these files:
An image tarball contains [Content as defined in the OCI Image Layout Specification](https://github.com/opencontainers/image-spec/blob/v1.1.1/image-layout.md#content).
- `VERSION`: currently `1.0` - the file format version
- `json`: detailed layer information, similar to `docker inspect layer_id`
- `layer.tar`: A tarfile containing the filesystem changes in this layer
The `layer.tar` file contains `aufs` style `.wh..wh.aufs` files and directories for storing attribute changes and deletions.
Additionally, includes the manifest.json file associated with a backwards compatible docker save format.
If the tarball defines a repository, the tarball should also include a `repositories` file at the root that contains a list of repository and tag names mapped to layer IDs.

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"
@@ -4308,6 +4295,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.
@@ -5023,8 +5011,11 @@ definitions:
com.example.some-other-label: "some-other-value"
Data:
description: |
Base64-url-safe-encoded ([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5))
data to store as secret.
Data is the data to store as a secret, formatted as a Base64-url-safe-encoded
([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/api/validation#MaxSecretSize).
This field is only used to _create_ a secret, and is not returned by
other endpoints.
@@ -5075,8 +5066,9 @@ definitions:
type: "string"
Data:
description: |
Base64-url-safe-encoded ([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5))
config data.
Data is the data to store as a config, formatted as a Base64-url-safe-encoded
([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5)) string.
The maximum allowed size is 1000KB, as defined in [MaxConfigSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0-20250103191802-8c1959736554/manager/controlapi#MaxConfigSize).
type: "string"
Templating:
description: |
@@ -8644,7 +8636,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"
@@ -9623,13 +9626,9 @@ paths:
### Image tarball format
An image tarball contains one directory per image layer (named using its long ID), each containing these files:
An image tarball contains [Content as defined in the OCI Image Layout Specification](https://github.com/opencontainers/image-spec/blob/v1.1.1/image-layout.md#content).
- `VERSION`: currently `1.0` - the file format version
- `json`: detailed layer information, similar to `docker inspect layer_id`
- `layer.tar`: A tarfile containing the filesystem changes in this layer
The `layer.tar` file contains `aufs` style `.wh..wh.aufs` files and directories for storing attribute changes and deletions.
Additionally, includes the manifest.json file associated with a backwards compatible docker save format.
If the tarball defines a repository, the tarball should also include a `repositories` file at the root that contains a list of repository and tag names mapped to layer IDs.

View File

@@ -81,7 +81,6 @@ info:
{
"username": "string",
"password": "string",
"email": "string",
"serveraddress": "string"
}
```
@@ -1385,7 +1384,7 @@ definitions:
<p><br /></p>
> **Deprecated**: this field is not part of the image specification and is
> always empty. It must not be used, and will be removed in API v1.48.
> always empty. It must not be used, and will be removed in API v1.50.
type: "string"
example: ""
Domainname:
@@ -1395,7 +1394,7 @@ definitions:
<p><br /></p>
> **Deprecated**: this field is not part of the image specification and is
> always empty. It must not be used, and will be removed in API v1.48.
> always empty. It must not be used, and will be removed in API v1.50.
type: "string"
example: ""
User:
@@ -1409,7 +1408,7 @@ definitions:
<p><br /></p>
> **Deprecated**: this field is not part of the image specification and is
> always false. It must not be used, and will be removed in API v1.48.
> always false. It must not be used, and will be removed in API v1.50.
type: "boolean"
default: false
example: false
@@ -1420,7 +1419,7 @@ definitions:
<p><br /></p>
> **Deprecated**: this field is not part of the image specification and is
> always false. It must not be used, and will be removed in API v1.48.
> always false. It must not be used, and will be removed in API v1.50.
type: "boolean"
default: false
example: false
@@ -1431,7 +1430,7 @@ definitions:
<p><br /></p>
> **Deprecated**: this field is not part of the image specification and is
> always false. It must not be used, and will be removed in API v1.48.
> always false. It must not be used, and will be removed in API v1.50.
type: "boolean"
default: false
example: false
@@ -1458,7 +1457,7 @@ definitions:
<p><br /></p>
> **Deprecated**: this field is not part of the image specification and is
> always false. It must not be used, and will be removed in API v1.48.
> always false. It must not be used, and will be removed in API v1.50.
type: "boolean"
default: false
example: false
@@ -1469,7 +1468,7 @@ definitions:
<p><br /></p>
> **Deprecated**: this field is not part of the image specification and is
> always false. It must not be used, and will be removed in API v1.48.
> always false. It must not be used, and will be removed in API v1.50.
type: "boolean"
default: false
example: false
@@ -1480,7 +1479,7 @@ definitions:
<p><br /></p>
> **Deprecated**: this field is not part of the image specification and is
> always false. It must not be used, and will be removed in API v1.48.
> always false. It must not be used, and will be removed in API v1.50.
type: "boolean"
default: false
example: false
@@ -1517,7 +1516,7 @@ definitions:
<p><br /></p>
> **Deprecated**: this field is not part of the image specification and is
> always empty. It must not be used, and will be removed in API v1.48.
> always empty. It must not be used, and will be removed in API v1.50.
type: "string"
default: ""
example: ""
@@ -1556,7 +1555,7 @@ definitions:
<p><br /></p>
> **Deprecated**: this field is not part of the image specification and is
> always omitted. It must not be used, and will be removed in API v1.48.
> always omitted. It must not be used, and will be removed in API v1.50.
type: "boolean"
default: false
example: false
@@ -1568,7 +1567,7 @@ definitions:
<p><br /></p>
> **Deprecated**: this field is not part of the image specification and is
> always omitted. It must not be used, and will be removed in API v1.48.
> always omitted. It must not be used, and will be removed in API v1.50.
type: "string"
default: ""
example: ""
@@ -1602,7 +1601,7 @@ definitions:
<p><br /></p>
> **Deprecated**: this field is not part of the image specification and is
> always omitted. It must not be used, and will be removed in API v1.48.
> always omitted. It must not be used, and will be removed in API v1.50.
type: "integer"
default: 10
x-nullable: true
@@ -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"
@@ -4361,6 +4348,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.
@@ -5082,8 +5070,11 @@ definitions:
com.example.some-other-label: "some-other-value"
Data:
description: |
Base64-url-safe-encoded ([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5))
data to store as secret.
Data is the data to store as a secret, formatted as a Base64-url-safe-encoded
([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/api/validation#MaxSecretSize).
This field is only used to _create_ a secret, and is not returned by
other endpoints.
@@ -5134,8 +5125,9 @@ definitions:
type: "string"
Data:
description: |
Base64-url-safe-encoded ([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5))
config data.
Data is the data to store as a config, formatted as a Base64-url-safe-encoded
([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5)) string.
The maximum allowed size is 1000KB, as defined in [MaxConfigSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0-20250103191802-8c1959736554/manager/controlapi#MaxConfigSize).
type: "string"
Templating:
description: |
@@ -8765,7 +8757,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"
@@ -9757,13 +9760,9 @@ paths:
### Image tarball format
An image tarball contains one directory per image layer (named using its long ID), each containing these files:
An image tarball contains [Content as defined in the OCI Image Layout Specification](https://github.com/opencontainers/image-spec/blob/v1.1.1/image-layout.md#content).
- `VERSION`: currently `1.0` - the file format version
- `json`: detailed layer information, similar to `docker inspect layer_id`
- `layer.tar`: A tarfile containing the filesystem changes in this layer
The `layer.tar` file contains `aufs` style `.wh..wh.aufs` files and directories for storing attribute changes and deletions.
Additionally, includes the manifest.json file associated with a backwards compatible docker save format.
If the tarball defines a repository, the tarball should also include a `repositories` file at the root that contains a list of repository and tag names mapped to layer IDs.

View File

@@ -81,7 +81,6 @@ info:
{
"username": "string",
"password": "string",
"email": "string",
"serveraddress": "string"
}
```
@@ -1385,7 +1384,7 @@ definitions:
<p><br /></p>
> **Deprecated**: this field is not part of the image specification and is
> always empty. It must not be used, and will be removed in API v1.48.
> always empty. It must not be used, and will be removed in API v1.50.
type: "string"
example: ""
Domainname:
@@ -1395,7 +1394,7 @@ definitions:
<p><br /></p>
> **Deprecated**: this field is not part of the image specification and is
> always empty. It must not be used, and will be removed in API v1.48.
> always empty. It must not be used, and will be removed in API v1.50.
type: "string"
example: ""
User:
@@ -1409,7 +1408,7 @@ definitions:
<p><br /></p>
> **Deprecated**: this field is not part of the image specification and is
> always false. It must not be used, and will be removed in API v1.48.
> always false. It must not be used, and will be removed in API v1.50.
type: "boolean"
default: false
example: false
@@ -1420,7 +1419,7 @@ definitions:
<p><br /></p>
> **Deprecated**: this field is not part of the image specification and is
> always false. It must not be used, and will be removed in API v1.48.
> always false. It must not be used, and will be removed in API v1.50.
type: "boolean"
default: false
example: false
@@ -1431,7 +1430,7 @@ definitions:
<p><br /></p>
> **Deprecated**: this field is not part of the image specification and is
> always false. It must not be used, and will be removed in API v1.48.
> always false. It must not be used, and will be removed in API v1.50.
type: "boolean"
default: false
example: false
@@ -1458,7 +1457,7 @@ definitions:
<p><br /></p>
> **Deprecated**: this field is not part of the image specification and is
> always false. It must not be used, and will be removed in API v1.48.
> always false. It must not be used, and will be removed in API v1.50.
type: "boolean"
default: false
example: false
@@ -1469,7 +1468,7 @@ definitions:
<p><br /></p>
> **Deprecated**: this field is not part of the image specification and is
> always false. It must not be used, and will be removed in API v1.48.
> always false. It must not be used, and will be removed in API v1.50.
type: "boolean"
default: false
example: false
@@ -1480,7 +1479,7 @@ definitions:
<p><br /></p>
> **Deprecated**: this field is not part of the image specification and is
> always false. It must not be used, and will be removed in API v1.48.
> always false. It must not be used, and will be removed in API v1.50.
type: "boolean"
default: false
example: false
@@ -1517,7 +1516,7 @@ definitions:
<p><br /></p>
> **Deprecated**: this field is not part of the image specification and is
> always empty. It must not be used, and will be removed in API v1.48.
> always empty. It must not be used, and will be removed in API v1.50.
type: "string"
default: ""
example: ""
@@ -1556,7 +1555,7 @@ definitions:
<p><br /></p>
> **Deprecated**: this field is not part of the image specification and is
> always omitted. It must not be used, and will be removed in API v1.48.
> always omitted. It must not be used, and will be removed in API v1.50.
type: "boolean"
default: false
example: false
@@ -1568,7 +1567,7 @@ definitions:
<p><br /></p>
> **Deprecated**: this field is not part of the image specification and is
> always omitted. It must not be used, and will be removed in API v1.48.
> always omitted. It must not be used, and will be removed in API v1.50.
type: "string"
default: ""
example: ""
@@ -1602,7 +1601,7 @@ definitions:
<p><br /></p>
> **Deprecated**: this field is not part of the image specification and is
> always omitted. It must not be used, and will be removed in API v1.48.
> always omitted. It must not be used, and will be removed in API v1.50.
type: "integer"
default: 10
x-nullable: true
@@ -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"
@@ -4379,6 +4366,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.
@@ -5100,8 +5088,11 @@ definitions:
com.example.some-other-label: "some-other-value"
Data:
description: |
Base64-url-safe-encoded ([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5))
data to store as secret.
Data is the data to store as a secret, formatted as a Base64-url-safe-encoded
([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/api/validation#MaxSecretSize).
This field is only used to _create_ a secret, and is not returned by
other endpoints.
@@ -5152,8 +5143,9 @@ definitions:
type: "string"
Data:
description: |
Base64-url-safe-encoded ([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5))
config data.
Data is the data to store as a config, formatted as a Base64-url-safe-encoded
([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5)) string.
The maximum allowed size is 1000KB, as defined in [MaxConfigSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0-20250103191802-8c1959736554/manager/controlapi#MaxConfigSize).
type: "string"
Templating:
description: |
@@ -8906,7 +8898,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"
@@ -9898,13 +9901,9 @@ paths:
### Image tarball format
An image tarball contains one directory per image layer (named using its long ID), each containing these files:
An image tarball contains [Content as defined in the OCI Image Layout Specification](https://github.com/opencontainers/image-spec/blob/v1.1.1/image-layout.md#content).
- `VERSION`: currently `1.0` - the file format version
- `json`: detailed layer information, similar to `docker inspect layer_id`
- `layer.tar`: A tarfile containing the filesystem changes in this layer
The `layer.tar` file contains `aufs` style `.wh..wh.aufs` files and directories for storing attribute changes and deletions.
Additionally, includes the manifest.json file associated with a backwards compatible docker save format.
If the tarball defines a repository, the tarball should also include a `repositories` file at the root that contains a list of repository and tag names mapped to layer IDs.

13535
api/docs/v1.48.yaml Normal file

File diff suppressed because it is too large Load Diff

13535
api/docs/v1.49.yaml Normal file

File diff suppressed because it is too large Load Diff

13377
api/docs/v1.50.yaml Normal file

File diff suppressed because it is too large Load Diff

13398
api/docs/v1.51.yaml Normal file

File diff suppressed because it is too large Load Diff

13484
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/google/go-cmp v0.7.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
golang.org/x/time v0.11.0
gotest.tools/v3 v3.5.2
pgregory.net/rapid v1.2.0
)

16
api/go.sum Normal file
View File

@@ -0,0 +1,16 @@
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=
golang.org/x/time v0.11.0 h1:/bpjEDfN9tkoN/ryeYHnv5hcMlc8ncjMcM4XBk5NWV0=
golang.org/x/time v0.11.0/go.mod h1:CDIdPxbZBQxdj6cxyCIdrNogrJKMJ7pr37NYpMcMDSg=
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)
}
}
})
}
}

View File

@@ -0,0 +1,93 @@
package progress
import (
"fmt"
)
// Progress represents the progress of a transfer.
type Progress struct {
ID string
// Progress contains a Message or...
Message string
// ...progress of an action
Action string
Current int64
Total int64
// If true, don't show xB/yB
HideCounts bool
// If not empty, use units instead of bytes for counts
Units string
// Aux contains extra information not presented to the user, such as
// digests for push signing.
Aux any
LastUpdate bool
}
// Output is an interface for writing progress information. It's
// like a writer for progress, but we don't call it Writer because
// that would be confusing next to ProgressReader (also, because it
// doesn't implement the io.Writer interface).
type Output interface {
WriteProgress(Progress) error
}
type chanOutput chan<- Progress
func (out chanOutput) WriteProgress(p Progress) error {
// FIXME: workaround for panic in #37735
defer func() {
recover()
}()
out <- p
return nil
}
// ChanOutput returns an Output that writes progress updates to the
// supplied channel.
func ChanOutput(progressChan chan<- Progress) Output {
return chanOutput(progressChan)
}
type discardOutput struct{}
func (discardOutput) WriteProgress(Progress) error {
return nil
}
// DiscardOutput returns an Output that discards progress
func DiscardOutput() Output {
return discardOutput{}
}
// Update is a convenience function to write a progress update to the channel.
func Update(out Output, id, action string) {
out.WriteProgress(Progress{ID: id, Action: action})
}
// Updatef is a convenience function to write a printf-formatted progress update
// to the channel.
func Updatef(out Output, id, format string, a ...any) {
Update(out, id, fmt.Sprintf(format, a...))
}
// Message is a convenience function to write a progress message to the channel.
func Message(out Output, id, message string) {
out.WriteProgress(Progress{ID: id, Message: message})
}
// Messagef is a convenience function to write a printf-formatted progress
// message to the channel.
func Messagef(out Output, id, format string, a ...any) {
Message(out, id, fmt.Sprintf(format, a...))
}
// Aux sends auxiliary information over a progress interface, which will not be
// formatted for the UI. This is used for things such as push signing.
func Aux(out Output, a any) {
out.WriteProgress(Progress{Aux: a})
}

View File

@@ -0,0 +1,66 @@
package progress
import (
"io"
"time"
"golang.org/x/time/rate"
)
// Reader is a Reader with progress bar.
type Reader struct {
in io.ReadCloser // Stream to read from
out Output // Where to send progress bar to
size int64
current int64
lastUpdate int64
id string
action string
rateLimiter *rate.Limiter
}
// NewProgressReader creates a new ProgressReader.
func NewProgressReader(in io.ReadCloser, out Output, size int64, id, action string) *Reader {
return &Reader{
in: in,
out: out,
size: size,
id: id,
action: action,
rateLimiter: rate.NewLimiter(rate.Every(100*time.Millisecond), 1),
}
}
func (p *Reader) Read(buf []byte) (int, error) {
read, err := p.in.Read(buf)
p.current += int64(read)
updateEvery := int64(1024 * 512) // 512kB
if p.size > 0 {
// Update progress for every 1% read if 1% < 512kB
if increment := int64(0.01 * float64(p.size)); increment < updateEvery {
updateEvery = increment
}
}
if p.current-p.lastUpdate > updateEvery || err != nil {
p.updateProgress(err != nil && read == 0)
p.lastUpdate = p.current
}
return read, err
}
// Close closes the progress reader and its underlying reader.
func (p *Reader) Close() error {
if p.current < p.size {
// print a full progress bar when closing prematurely
p.current = p.size
p.updateProgress(false)
}
return p.in.Close()
}
func (p *Reader) updateProgress(last bool) {
if last || p.current == p.size || p.rateLimiter.Allow() {
p.out.WriteProgress(Progress{ID: p.id, Action: p.action, Current: p.current, Total: p.size, LastUpdate: last})
}
}

View File

@@ -1,4 +1,4 @@
package progress // import "github.com/docker/docker/pkg/progress"
package progress
import (
"bytes"

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,247 @@
// Package streamformatter provides helper functions to format a stream.
package streamformatter
import (
"encoding/json"
"fmt"
"io"
"strings"
"sync"
"time"
"github.com/docker/go-units"
"github.com/moby/moby/api/pkg/progress"
"github.com/moby/moby/api/types/jsonstream"
)
// jsonMessage defines a message struct. It describes
// the created time, where it from, status, ID of the
// message. It's used for docker events.
//
// It is a reduced set of [jsonmessage.JSONMessage].
type jsonMessage struct {
Stream string `json:"stream,omitempty"`
Status string `json:"status,omitempty"`
Progress *jsonstream.Progress `json:"progressDetail,omitempty"`
ID string `json:"id,omitempty"`
Error *jsonstream.Error `json:"errorDetail,omitempty"`
Aux *json.RawMessage `json:"aux,omitempty"` // Aux contains out-of-band data, such as digests for push signing and image id after building.
// ErrorMessage contains errors encountered during the operation.
//
// Deprecated: this field is deprecated since docker v0.6.0 / API v1.4. Use [Error.Message] instead. This field will be omitted in a future release.
ErrorMessage string `json:"error,omitempty"` // deprecated
}
const streamNewline = "\r\n"
type jsonProgressFormatter struct{}
func appendNewline(source []byte) []byte {
return append(source, []byte(streamNewline)...)
}
// FormatStatus formats the specified objects according to the specified format (and id).
func FormatStatus(id, format string, a ...any) []byte {
str := fmt.Sprintf(format, a...)
b, err := json.Marshal(&jsonMessage{ID: id, Status: str})
if err != nil {
return FormatError(err)
}
return appendNewline(b)
}
// FormatError formats the error as a JSON object
func FormatError(err error) []byte {
jsonError, ok := err.(*jsonstream.Error)
if !ok {
jsonError = &jsonstream.Error{Message: err.Error()}
}
if b, err := json.Marshal(&jsonMessage{Error: jsonError, ErrorMessage: err.Error()}); err == nil {
return appendNewline(b)
}
return []byte(`{"error":"format error"}` + streamNewline)
}
func (sf *jsonProgressFormatter) formatStatus(id, format string, a ...any) []byte {
return FormatStatus(id, format, a...)
}
// formatProgress formats the progress information for a specified action.
func (sf *jsonProgressFormatter) formatProgress(id, action string, progress *jsonstream.Progress, aux any) []byte {
if progress == nil {
progress = &jsonstream.Progress{}
}
var auxJSON *json.RawMessage
if aux != nil {
auxJSONBytes, err := json.Marshal(aux)
if err != nil {
return nil
}
auxJSON = new(json.RawMessage)
*auxJSON = auxJSONBytes
}
b, err := json.Marshal(&jsonMessage{
Status: action,
Progress: progress,
ID: id,
Aux: auxJSON,
})
if err != nil {
return nil
}
return appendNewline(b)
}
type rawProgressFormatter struct{}
func (sf *rawProgressFormatter) formatStatus(id, format string, a ...any) []byte {
return []byte(fmt.Sprintf(format, a...) + streamNewline)
}
func rawProgressString(p *jsonstream.Progress) string {
if p == nil || (p.Current <= 0 && p.Total <= 0) {
return ""
}
if p.Total <= 0 {
switch p.Units {
case "":
return fmt.Sprintf("%8v", units.HumanSize(float64(p.Current)))
default:
return fmt.Sprintf("%d %s", p.Current, p.Units)
}
}
percentage := int(float64(p.Current)/float64(p.Total)*100) / 2
if percentage > 50 {
percentage = 50
}
numSpaces := 0
if 50-percentage > 0 {
numSpaces = 50 - percentage
}
pbBox := fmt.Sprintf("[%s>%s] ", strings.Repeat("=", percentage), strings.Repeat(" ", numSpaces))
var numbersBox string
switch {
case p.HideCounts:
case p.Units == "": // no units, use bytes
current := units.HumanSize(float64(p.Current))
total := units.HumanSize(float64(p.Total))
numbersBox = fmt.Sprintf("%8v/%v", current, total)
if p.Current > p.Total {
// remove total display if the reported current is wonky.
numbersBox = fmt.Sprintf("%8v", current)
}
default:
numbersBox = fmt.Sprintf("%d/%d %s", p.Current, p.Total, p.Units)
if p.Current > p.Total {
// remove total display if the reported current is wonky.
numbersBox = fmt.Sprintf("%d %s", p.Current, p.Units)
}
}
var timeLeftBox string
if p.Current > 0 && p.Start > 0 && percentage < 50 {
fromStart := time.Since(time.Unix(p.Start, 0))
perEntry := fromStart / time.Duration(p.Current)
left := time.Duration(p.Total-p.Current) * perEntry
timeLeftBox = " " + left.Round(time.Second).String()
}
return pbBox + numbersBox + timeLeftBox
}
func (sf *rawProgressFormatter) formatProgress(id, action string, progress *jsonstream.Progress, aux any) []byte {
if progress == nil {
progress = &jsonstream.Progress{}
}
endl := "\r"
out := rawProgressString(progress)
if out == "" {
endl += "\n"
}
return []byte(action + " " + out + endl)
}
// NewProgressOutput returns a progress.Output object that can be passed to
// progress.NewProgressReader.
func NewProgressOutput(out io.Writer) progress.Output {
return &progressOutput{sf: &rawProgressFormatter{}, out: out, newLines: true}
}
// NewJSONProgressOutput returns a progress.Output that formats output
// using JSON objects
func NewJSONProgressOutput(out io.Writer, newLines bool) progress.Output {
return &progressOutput{sf: &jsonProgressFormatter{}, out: out, newLines: newLines}
}
type formatProgress interface {
formatStatus(id, format string, a ...any) []byte
formatProgress(id, action string, progress *jsonstream.Progress, aux any) []byte
}
type progressOutput struct {
sf formatProgress
out io.Writer
newLines bool
mu sync.Mutex
}
// WriteProgress formats progress information from a ProgressReader.
func (out *progressOutput) WriteProgress(prog progress.Progress) error {
var formatted []byte
if prog.Message != "" {
formatted = out.sf.formatStatus(prog.ID, prog.Message)
} else {
jsonProgress := jsonstream.Progress{
Current: prog.Current,
Total: prog.Total,
HideCounts: prog.HideCounts,
Units: prog.Units,
}
formatted = out.sf.formatProgress(prog.ID, prog.Action, &jsonProgress, prog.Aux)
}
out.mu.Lock()
defer out.mu.Unlock()
_, err := out.out.Write(formatted)
if err != nil {
return err
}
if out.newLines && prog.LastUpdate {
_, err = out.out.Write(out.sf.formatStatus("", ""))
return err
}
return nil
}
// AuxFormatter is a streamFormatter that writes aux progress messages
type AuxFormatter struct {
io.Writer
}
// Emit emits the given interface as an aux progress message
func (sf *AuxFormatter) Emit(id string, aux any) error {
auxJSONBytes, err := json.Marshal(aux)
if err != nil {
return err
}
auxJSON := new(json.RawMessage)
*auxJSON = auxJSONBytes
msgJSON, err := json.Marshal(&jsonMessage{ID: id, Aux: auxJSON})
if err != nil {
return err
}
msgJSON = appendNewline(msgJSON)
n, err := sf.Writer.Write(msgJSON)
if n != len(msgJSON) {
return io.ErrShortWrite
}
return err
}

View File

@@ -1,4 +1,4 @@
package streamformatter // import "github.com/docker/docker/pkg/streamformatter"
package streamformatter
import (
"bytes"
@@ -7,9 +7,8 @@ import (
"strings"
"testing"
"github.com/docker/docker/pkg/jsonmessage"
"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
"github.com/moby/moby/api/types/jsonstream"
"gotest.tools/v3/assert"
is "gotest.tools/v3/assert/cmp"
)
@@ -22,7 +21,7 @@ func TestRawProgressFormatterFormatStatus(t *testing.T) {
func TestRawProgressFormatterFormatProgress(t *testing.T) {
sf := rawProgressFormatter{}
jsonProgress := &jsonmessage.JSONProgress{
jsonProgress := &jsonstream.Progress{
Current: 15,
Total: 30,
Start: 1,
@@ -47,7 +46,7 @@ func TestFormatError(t *testing.T) {
}
func TestFormatJSONError(t *testing.T) {
err := &jsonmessage.JSONError{Code: 50, Message: "Json error"}
err := &jsonstream.Error{Code: 50, Message: "Json error"}
res := FormatError(err)
expected := `{"errorDetail":{"code":50,"message":"Json error"},"error":"Json error"}` + streamNewline
assert.Check(t, is.Equal(expected, string(res)))
@@ -55,19 +54,19 @@ func TestFormatJSONError(t *testing.T) {
func TestJsonProgressFormatterFormatProgress(t *testing.T) {
sf := &jsonProgressFormatter{}
jsonProgress := &jsonmessage.JSONProgress{
jsonProgress := &jsonstream.Progress{
Current: 15,
Total: 30,
Start: 1,
}
aux := "aux message"
res := sf.formatProgress("id", "action", jsonProgress, aux)
msg := &jsonmessage.JSONMessage{}
msg := &jsonMessage{}
assert.NilError(t, json.Unmarshal(res, msg))
rawAux := json.RawMessage(`"` + aux + `"`)
expected := &jsonmessage.JSONMessage{
expected := &jsonMessage{
ID: "id",
Status: "action",
Aux: &rawAux,
@@ -81,7 +80,6 @@ func cmpJSONMessageOpt() cmp.Option {
return path.String() == "ProgressMessage"
}
return cmp.Options{
cmpopts.IgnoreUnexported(jsonmessage.JSONProgress{}),
// Ignore deprecated property that is a derivative of Progress
cmp.FilterPath(progressMessagePath, cmp.Ignore()),
}

View File

@@ -0,0 +1,45 @@
package streamformatter
import (
"encoding/json"
"io"
)
type streamWriter struct {
io.Writer
lineFormat func([]byte) string
}
func (sw *streamWriter) Write(buf []byte) (int, error) {
formattedBuf := sw.format(buf)
n, err := sw.Writer.Write(formattedBuf)
if n != len(formattedBuf) {
return n, io.ErrShortWrite
}
return len(buf), err
}
func (sw *streamWriter) format(buf []byte) []byte {
msg := &jsonMessage{Stream: sw.lineFormat(buf)}
b, err := json.Marshal(msg)
if err != nil {
return FormatError(err)
}
return appendNewline(b)
}
// NewStdoutWriter returns a writer which formats the output as json message
// representing stdout lines
func NewStdoutWriter(out io.Writer) io.Writer {
return &streamWriter{Writer: out, lineFormat: func(buf []byte) string {
return string(buf)
}}
}
// NewStderrWriter returns a writer which formats the output as json message
// representing stderr lines
func NewStderrWriter(out io.Writer) io.Writer {
return &streamWriter{Writer: out, lineFormat: func(buf []byte) string {
return "\033[91m" + string(buf) + "\033[0m"
}}
}

View File

@@ -1,4 +1,4 @@
package streamformatter // import "github.com/docker/docker/pkg/streamformatter"
package streamformatter
import (
"bytes"

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 "github.com/docker/docker/api/server/backend/build"
import (
"context"
"fmt"
"strconv"
"github.com/distribution/reference"
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/backend"
"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 == types.BuilderBuildKit
tags, err := sanitizeRepoAndTags(options.Tags)
if err != nil {
return "", err
}
var build *builder.Result
if useBuildKit {
build, err = b.buildkit.Build(ctx, config)
if err != nil {
return "", err
}
} else {
build, err = b.builder.Build(ctx, config)
if err != nil {
return "", err
}
}
if build == nil {
return "", nil
}
imageID := build.ImageID
if options.Squash {
if imageID, err = squashBuild(build, b.imageComponent); err != nil {
return "", err
}
if config.ProgressWriter.AuxFormatter != nil {
if err = config.ProgressWriter.AuxFormatter.Emit("moby.image.id", types.BuildResult{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 types.BuildCachePruneOptions) (*types.BuildCachePruneReport, 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 &types.BuildCachePruneReport{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,143 +0,0 @@
package httpstatus // import "github.com/docker/docker/api/server/httpstatus"
import (
"context"
"fmt"
"net/http"
cerrdefs "github.com/containerd/errdefs"
"github.com/containerd/log"
"github.com/docker/distribution/registry/api/errcode"
"github.com/docker/docker/errdefs"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
type causer interface {
Cause() error
}
// FromError retrieves status code from error message.
func FromError(err error) int {
if err == nil {
log.G(context.TODO()).WithError(err).Error("unexpected HTTP error handling")
return http.StatusInternalServerError
}
// Stop right there
// Are you sure you should be adding a new error class here? Do one of the existing ones work?
// Note that the below functions are already checking the error causal chain for matches.
switch {
case errdefs.IsNotFound(err):
return http.StatusNotFound
case errdefs.IsInvalidParameter(err):
return http.StatusBadRequest
case errdefs.IsConflict(err):
return http.StatusConflict
case errdefs.IsUnauthorized(err):
return http.StatusUnauthorized
case errdefs.IsUnavailable(err):
return http.StatusServiceUnavailable
case errdefs.IsForbidden(err):
return http.StatusForbidden
case errdefs.IsNotModified(err):
return http.StatusNotModified
case errdefs.IsNotImplemented(err):
return http.StatusNotImplemented
case errdefs.IsSystem(err) || errdefs.IsUnknown(err) || errdefs.IsDataLoss(err) || errdefs.IsDeadline(err) || errdefs.IsCancelled(err):
return http.StatusInternalServerError
default:
if statusCode := statusCodeFromGRPCError(err); statusCode != http.StatusInternalServerError {
return statusCode
}
if statusCode := statusCodeFromContainerdError(err); statusCode != http.StatusInternalServerError {
return statusCode
}
if statusCode := statusCodeFromDistributionError(err); statusCode != http.StatusInternalServerError {
return statusCode
}
if e, ok := err.(causer); ok {
return FromError(e.Cause())
}
log.G(context.TODO()).WithFields(log.Fields{
"module": "api",
"error": err,
"error_type": fmt.Sprintf("%T", err),
}).Debug("FIXME: Got an API for which error does not match any expected type!!!")
return http.StatusInternalServerError
}
}
// statusCodeFromGRPCError returns status code according to gRPC error
func statusCodeFromGRPCError(err error) int {
switch status.Code(err) {
case codes.InvalidArgument: // code 3
return http.StatusBadRequest
case codes.NotFound: // code 5
return http.StatusNotFound
case codes.AlreadyExists: // code 6
return http.StatusConflict
case codes.PermissionDenied: // code 7
return http.StatusForbidden
case codes.FailedPrecondition: // code 9
return http.StatusBadRequest
case codes.Unauthenticated: // code 16
return http.StatusUnauthorized
case codes.OutOfRange: // code 11
return http.StatusBadRequest
case codes.Unimplemented: // code 12
return http.StatusNotImplemented
case codes.Unavailable: // code 14
return http.StatusServiceUnavailable
default:
// codes.Canceled(1)
// codes.Unknown(2)
// codes.DeadlineExceeded(4)
// codes.ResourceExhausted(8)
// codes.Aborted(10)
// codes.Internal(13)
// codes.DataLoss(15)
return http.StatusInternalServerError
}
}
// statusCodeFromDistributionError returns status code according to registry errcode
// code is loosely based on errcode.ServeJSON() in docker/distribution
func statusCodeFromDistributionError(err error) int {
switch errs := err.(type) {
case errcode.Errors:
if len(errs) < 1 {
return http.StatusInternalServerError
}
if _, ok := errs[0].(errcode.ErrorCoder); ok {
return statusCodeFromDistributionError(errs[0])
}
case errcode.ErrorCoder:
return errs.ErrorCode().Descriptor().HTTPStatusCode
}
return http.StatusInternalServerError
}
// statusCodeFromContainerdError returns status code for containerd errors when
// consumed directly (not through gRPC)
func statusCodeFromContainerdError(err error) int {
switch {
case cerrdefs.IsInvalidArgument(err):
return http.StatusBadRequest
case cerrdefs.IsNotFound(err):
return http.StatusNotFound
case cerrdefs.IsAlreadyExists(err):
return http.StatusConflict
case cerrdefs.IsFailedPrecondition(err):
return http.StatusPreconditionFailed
case cerrdefs.IsUnavailable(err):
return http.StatusServiceUnavailable
case cerrdefs.IsNotImplemented(err):
return http.StatusNotImplemented
default:
return http.StatusInternalServerError
}
}

View File

@@ -1,15 +0,0 @@
package httputils // import "github.com/docker/docker/api/server/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 "github.com/docker/docker/api/server/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,24 +0,0 @@
package server // import "github.com/docker/docker/api/server"
import (
"github.com/containerd/log"
"github.com/docker/docker/api/server/httputils"
"github.com/docker/docker/api/server/middleware"
)
// handlerWithGlobalMiddlewares wraps the handler function for a request with
// the server's global middlewares. The order of the middlewares is backwards,
// meaning that the first in the list will be evaluated last.
func (s *Server) handlerWithGlobalMiddlewares(handler httputils.APIFunc) httputils.APIFunc {
next := handler
for _, m := range s.middlewares {
next = m.WrapHandler(next)
}
if log.GetLevel() == log.DebugLevel {
next = middleware.DebugRequestMiddleware(next)
}
return next
}

View File

@@ -1,114 +0,0 @@
package middleware // import "github.com/docker/docker/api/server/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) (retErr 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,
}
logger.WithFields(fields).Debugf("handling %s request", r.Method)
defer func() {
if retErr != 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"] = retErr
fields["status"] = httpstatus.FromError(retErr)
logger.WithFields(fields).Debugf("error response for %s request", r.Method)
}
}()
if r.Method != http.MethodPost {
return handler(ctx, w, r, vars)
}
if err := httputils.CheckForJSON(r); err != nil {
return handler(ctx, w, r, vars)
}
maxBodySize := 4096 // 4KB
if r.ContentLength > int64(maxBodySize) {
return handler(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 handler(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 handler(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 "github.com/docker/docker/api/server/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,28 +0,0 @@
package middleware // import "github.com/docker/docker/api/server/middleware"
import (
"context"
"net/http"
)
// ExperimentalMiddleware is a the middleware in charge of adding the
// 'Docker-Experimental' header to every outgoing request
type ExperimentalMiddleware struct {
experimental string
}
// NewExperimentalMiddleware creates a new ExperimentalMiddleware
func NewExperimentalMiddleware(experimentalEnabled bool) ExperimentalMiddleware {
if experimentalEnabled {
return ExperimentalMiddleware{"true"}
}
return ExperimentalMiddleware{"false"}
}
// WrapHandler returns a new handler function wrapping the previous one in the request chain.
func (e ExperimentalMiddleware) 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("Docker-Experimental", e.experimental)
return handler(ctx, w, r, vars)
}
}

View File

@@ -1,12 +0,0 @@
package middleware // import "github.com/docker/docker/api/server/middleware"
import (
"context"
"net/http"
)
// Middleware is an interface to allow the use of ordinary functions as Docker API filters.
// Any struct that has the appropriate signature can be registered as a middleware.
type Middleware interface {
WrapHandler(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
}

View File

@@ -1,86 +0,0 @@
package middleware // import "github.com/docker/docker/api/server/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 "github.com/docker/docker/api/server/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", nil)
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, len(v) != 0)
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", nil)
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 "github.com/docker/docker/api/server/router/build"
import (
"context"
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/backend"
)
// 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)
// Prune build cache
PruneCache(context.Context, types.BuildCachePruneOptions) (*types.BuildCachePruneReport, error)
Cancel(context.Context, string) error
}
type experimentalProvider interface {
HasExperimental() bool
}

View File

@@ -1,60 +0,0 @@
package build // import "github.com/docker/docker/api/server/router/build"
import (
"runtime"
"github.com/docker/docker/api/server/router"
"github.com/docker/docker/api/types"
)
// 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 (r *buildRouter) Routes() []router.Route {
return r.routes
}
func (r *buildRouter) initRoutes() {
r.routes = []router.Route{
router.NewPostRoute("/build", r.postBuild),
router.NewPostRoute("/build/prune", r.postPrune),
router.NewPostRoute("/build/cancel", r.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) types.BuilderVersion {
// TODO(thaJeztah) move the default to daemon/config
if runtime.GOOS == "windows" {
return types.BuilderV1
}
bv := types.BuilderBuildKit
if v, ok := features["buildkit"]; ok && !v {
bv = types.BuilderV1
}
return bv
}

View File

@@ -1,10 +0,0 @@
package checkpoint // import "github.com/docker/docker/api/server/router/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/router/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 (r *checkpointRouter) Routes() []router.Route {
return r.routes
}
func (r *checkpointRouter) initRoutes() {
r.routes = []router.Route{
router.NewGetRoute("/containers/{name:.*}/checkpoints", r.getContainerCheckpoints, router.Experimental),
router.NewPostRoute("/containers/{name:.*}/checkpoints", r.postContainerCheckpoint, router.Experimental),
router.NewDeleteRoute("/containers/{name}/checkpoints/{checkpoint}", r.deleteContainerCheckpoint, router.Experimental),
}
}

View File

@@ -1,60 +0,0 @@
package checkpoint // import "github.com/docker/docker/api/server/router/checkpoint"
import (
"context"
"net/http"
"github.com/docker/docker/api/server/httputils"
"github.com/docker/docker/api/types/checkpoint"
)
func (s *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 := s.backend.CheckpointCreate(vars["name"], options)
if err != nil {
return err
}
w.WriteHeader(http.StatusCreated)
return nil
}
func (s *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 := s.backend.CheckpointList(vars["name"], checkpoint.ListOptions{
CheckpointDir: r.Form.Get("dir"),
})
if err != nil {
return err
}
return httputils.WriteJSON(w, http.StatusOK, checkpoints)
}
func (s *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 := s.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,80 +0,0 @@
package container // import "github.com/docker/docker/api/server/router/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"
containerpkg "github.com/docker/docker/container"
"github.com/docker/docker/pkg/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.ContainerUpdateOKBody, error)
ContainerWait(ctx context.Context, name string, condition containerpkg.WaitCondition) (<-chan containerpkg.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.ContainerTopOKBody, 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/router/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),
}
}

Some files were not shown because too many files have changed in this diff Show More