Compare commits

..

227 Commits

Author SHA1 Message Date
Austin Vazquez
4e04130911 Merge pull request #51410 from austinvazquez/test-containerd-1.7.29
[28.x] Dockerfile: test containerd v1.7.29
2025-11-05 21:10:10 -06:00
Austin Vazquez
f5cacc257a Dockerfile: test containerd v1.7.29
Update the version of containerd used in CI and for static binaries
to v1.7.29

Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-11-05 19:25:41 -06:00
Paweł Gronowski
89c5e8fd66 Merge pull request #51396 from thaJeztah/28.x_backport_api_docs
[28.x backport] api/docs: remove BuildCache.Parent field for API v1.42 and up
2025-11-05 15:19:32 +01:00
Austin Vazquez
9b93878308 Merge pull request #51395 from thaJeztah/28.x_backport_rootless_reject
[28.x backport] dockerd-rootless.sh: reject DOCKERD_ROOTLESS_ROOTLESSKIT_NET=host
2025-11-05 07:41:12 -06:00
Paweł Gronowski
6178456763 Merge pull request #51398 from vvoland/51397-28.x
[28.x backport] vendor: github.com/moby/buildkit v0.25.2
2025-11-05 14:14:53 +01:00
Paweł Gronowski
0cae4e5c8f vendor: github.com/moby/buildkit v0.25.2
full diff: https://github.com/moby/buildkit/compare/v0.25.1...v0.25.2

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
(cherry picked from commit 39f2dbffa1)
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-11-05 13:18:13 +01:00
Sebastiaan van Stijn
33cc06f616 Merge pull request #51394 from vvoland/51393-28.x
[28.x backport] Dockerfile: update runc binary to v1.3.3
2025-11-05 12:47:15 +01:00
Sebastiaan van Stijn
d525277410 api/docs: remove BuildCache.Parent field for API v1.42 and up
The BuildCache.Parent field was removed in API v1.42 in [moby@e0db820].
While we had to keep the Go struct field around to backfil the field for
older API versions, it's no longer part of API v1.42 and up (using the
"omitempty" is just an implementation detail).

This patch corrects the swagger files to match this.

[moby@e0db820]: e0db8207f3

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit a5d9619093)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-05 12:04:25 +01:00
Akihiro Suda
2fbc51b4f8 dockerd-rootless.sh: reject DOCKERD_ROOTLESS_ROOTLESSKIT_NET=host
`rootlesskit --net=host` does not work with Docker.

Alternative ways to run Rootless Docker without the network overhead:
- Use https://github.com/rootless-containers/bypass4netns
- Or, use `docker run --net=host` with a PR 47103 (WIP)

See issue 51363

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
(cherry picked from commit 76b1d304e4)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-05 12:00:54 +01:00
Paweł Gronowski
bd98008c07 integration-cli: Adjust nofile limits
runc v1.3.3 needs more file descriptors now.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-11-05 11:31:32 +01:00
Paweł Gronowski
19675151a3 Dockerfile: update runc binary to v1.3.3
Update the version used in CI and for the static binaries.

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

This release contains fixes for three high-severity security
vulnerabilities in runc (CVE-2025-31133, CVE-2025-52565, and
CVE-2025-52881). All three vulnerabilities ultimately allow (through
different methods) for full container breakouts by bypassing runc's
restrictions for writing to arbitrary /proc files.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
(cherry picked from commit 35f6a78082)
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-11-05 11:00:17 +01:00
Sebastiaan van Stijn
44896604b8 Merge pull request #51387 from thaJeztah/28.x_bump_go
[28.x] update to go1.24.9
2025-11-04 14:50:31 +01:00
Sebastiaan van Stijn
d24eab928b update to go1.24.9
go1.24.9 (released 2025-10-13) includes fixes to the crypto/x509 package.
See the Go 1.24.9 milestone on our issue tracker for details:

- https://github.com/golang/go/issues?q=milestone%3AGo1.24.9+label%3ACherryPickApproved
- full diff: https://github.com/golang/go/compare/go1.24.8...go1.24.9

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-04 11:05:26 +01:00
Sebastiaan van Stijn
b651c094e2 Merge pull request #51162 from vvoland/51149-28.x
[28.x backport] dockerd-rootless.sh: if no slirp4netns, try pasta
2025-10-10 13:53:40 +02:00
Rob Murray
df58dd519b 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>
(cherry picked from commit a6206f2da9)
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-10-10 12:40:00 +02:00
Rob Murray
f822c9f39c dockerd-rootless.sh: if no slirp4netns, try pasta
Signed-off-by: Rob Murray <rob.murray@docker.com>
(cherry picked from commit 7e63d2a81b)
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-10-10 12:39:57 +02:00
Austin Vazquez
f8215cc266 Merge pull request #51137 from austinvazquez/cherry-pick-vendor-buildkit-0.25.1-to-28.x
[28.x] vendor: update buildkit to v0.25.1
2025-10-07 19:34:32 -07:00
Tonis Tiigi
40a856a593 hack: add patch to buildkit tests
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
(cherry picked from commit 1b1608f2cd)
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-07 20:01:53 -05:00
Tonis Tiigi
5d1c3119f2 vendor: update buildkit to v0.25.1
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
(cherry picked from commit 3c418bea4e)
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-07 20:01:34 -05:00
Austin Vazquez
90506c1144 Merge pull request #51133 from vvoland/51132-28.x
[28.x backport] update to go1.24.8
2025-10-07 16:35:30 -07:00
Austin Vazquez
17db0cd834 Merge pull request #51128 from thaJeztah/28.x_backport_gcpolicy-invalid-calculations
[28.x backport] builder: use proper percentage calculations for default gc policy
2025-10-07 13:56:48 -07:00
Paweł Gronowski
f7c40ea344 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>
(cherry picked from commit d7b4bb25bda9f86dc47bf5a8921ceb8b3a4a498c)
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-10-07 21:50:05 +02:00
Jonathan A. Sternberg
dccf7c889c 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>
(cherry picked from commit 1a7d7cc015)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-07 19:10:14 +02:00
Sebastiaan van Stijn
0f040aa194 Merge pull request #51126 from vvoland/51124-28.x
[28.x backport] ci: fix cache for go modules
2025-10-07 18:25:08 +02:00
CrazyMax
5b1a039e6f ci: fix cache for go modules
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
(cherry picked from commit dbcbe87d52)
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-10-07 17:25:37 +02:00
Paweł Gronowski
8fa4bd5e0d Merge pull request #51121 from crazy-max/28.x_ci-caches-fixes
[28.x] ci: update gha cache attributes
2025-10-07 13:31:15 +02:00
CrazyMax
e59129b9cc ci: update gha cache attributes
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2025-10-07 12:41:00 +02:00
Paweł Gronowski
28d9ed5878 Merge pull request #51116 from austinvazquez/cherry-pick-fix-go-validation-to-28.x
[28.x] Rework Go mod tidy/vendor checks
2025-10-07 08:43:48 +02:00
Austin Vazquez
adcea7bdc9 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>
(cherry picked from commit f6e1bf2808)
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-06 19:19:23 -05:00
Austin Vazquez
bab04642ff Add existence check for go.mod and go.sum files
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
(cherry picked from commit 0ad35e3ef0)
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-06 19:11:11 -05:00
Austin Vazquez
7841b1c65b Merge pull request #51110 from thaJeztah/28.x_backport_deprecate_plugin_dockerversion
[28.x backport] api/types/plugin: deprecate Config.DockerVersion field
2025-10-06 08:04:17 -07:00
Sebastiaan van Stijn
1dcce6800f api/types/plugin: deprecate Config.DockerVersion field
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit c4fda95bea)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-06 14:22:41 +02:00
Sebastiaan van Stijn
b67c30f946 Merge pull request #51105 from thaJeztah/28.x_backport_deprecate_legacy_inspect_fields
[28.x backport] api/types/image: InspectResponse: deprecate Parent, DockerVersion
2025-10-06 11:43:29 +02:00
Sebastiaan van Stijn
3388108f9a 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>
(cherry picked from commit bd8a99b400)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-05 23:06:38 +02:00
Austin Vazquez
5c2c3c2ae1 Merge pull request #51091 from austinvazquez/add-vendor-sum-to-28.x
[28.x] Add back vendor.sum
2025-10-03 13:27:18 -07:00
Austin Vazquez
e468481ff0 Add back vendor.sum
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-02 17:21:18 -05:00
Sebastiaan van Stijn
cd048300a4 Merge pull request #51075 from vvoland/51074-28.x
[28.x backport] vendor: github.com/moby/buildkit v0.25.0
2025-10-01 17:26:18 +02:00
Jonathan A. Sternberg
e29d6be7a5 vendor: github.com/moby/buildkit v0.25.0
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
(cherry picked from commit 3f3bbe4430)
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-10-01 11:53:21 +02:00
Sebastiaan van Stijn
9b4369035b Merge pull request #51069 from thaJeztah/28.x_backport_docs_rm_deprecated_virtualsize
[28.x backport] api: swagger: remove VirtualSize fields for API > v1.43
2025-09-30 14:56:00 +02:00
Sebastiaan van Stijn
4f3572596b 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>
(cherry picked from commit 51cbd2ed16)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-30 13:19:32 +02:00
Sebastiaan van Stijn
79f310d4bc Merge pull request #51067 from austinvazquez/cherry-pick-deprecate-kernel-memocy-tcp-to-28.x
[28.x backport] api: deprecate `KernelMemoryTCP` support
2025-09-30 10:31:27 +02:00
Austin Vazquez
deb4bbbfe0 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>
(cherry picked from commit fb2f8115c8)
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-30 10:19:06 +02:00
Sebastiaan van Stijn
423a7fd6af Merge pull request #51064 from thaJeztah/28.x_backport_fix_epcnt_warning
[28.x backport] Eliminate warning about endpoint count store delete
2025-09-29 17:21:26 +02:00
Rob Murray
fbf2fe8b7d 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>
(cherry picked from commit 94bcf89412)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-29 15:15:55 +02:00
Austin Vazquez
252a1ebe7e Merge pull request #51061 from thaJeztah/28.x_backport_rm_email_example
[28.x backport] api/docs: remove email field from example auth
2025-09-29 05:30:22 -07:00
Sebastiaan van Stijn
2c15eb6617 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>
(cherry picked from commit 08d014cac8)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-29 11:30:57 +02:00
Sebastiaan van Stijn
f984f7218f Merge pull request #51052 from vvoland/51051-28.x
[28.x backport] api/checkpoint: Don't return null if no checkpoints
2025-09-27 00:50:13 +02:00
Paweł Gronowski
fd10938136 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>
(cherry picked from commit 646e068cf1)
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-09-26 16:47:16 +02:00
Paweł Gronowski
73f8d82c4b Merge pull request #51038 from thaJeztah/28.x_backport_api_rm_BridgeNfIptables
[28.x backport] api: docs: remove deprecated BridgeNfIptables, BridgeNfIp6tables
2025-09-25 11:25:46 +00:00
Sebastiaan van Stijn
1096e39142 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>
(cherry picked from commit 0fb46d08ad)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-25 12:38:26 +02:00
Paweł Gronowski
dc504e1e68 Merge pull request #51039 from thaJeztah/28.x_backport_gha-validate-only
[28.x backport] gha: Add conditional skip for jobs with 'ci/validate-only' label
2025-09-25 10:14:40 +02:00
Paweł Gronowski
9fa8529070 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>
(cherry picked from commit f0c069ffc9)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-25 00:05:16 +02:00
Paweł Gronowski
d21856f25d Merge pull request #51032 from vvoland/51029-28.x
[28.x] vendor: github.com/moby/buildkit v0.25.0-rc1
2025-09-24 18:26:09 +02:00
Austin Vazquez
b7496d9ec0 Merge pull request #51035 from vvoland/51009-28.x
[28.x backport] ipams: Re-enable legacy remote plugins support
2025-09-24 08:17:12 -07:00
Paweł Gronowski
3aa032e1e8 Merge pull request #51034 from vvoland/50910-28.x
[28.x backport] api/docs: remove temporary "full" example for image config
2025-09-24 17:04:15 +02:00
Tonis Tiigi
80ac399595 hack: use custom ref for buildkit tests
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
(cherry picked from commit e8d3609031)
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-09-24 16:26:15 +02:00
Paweł Gronowski
22e0cb2d64 vendor: github.com/moby/buildkit v0.25.0-rc1
full diff: https://github.com/moby/buildkit/compare/v0.24.0...v0.25.0-rc1

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-09-24 16:26:13 +02:00
Olli Janatuinen
1b0ba3b217 ipams: Re-enable legacy remote plugins support
Signed-off-by: Olli Janatuinen <olli.janatuinen@gmail.com>
(cherry picked from commit aa492314a1)
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-09-24 13:27:16 +02:00
Sebastiaan van Stijn
6d311b44e4 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>
(cherry picked from commit 0fe1af95f3)
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-09-24 13:24:23 +02:00
Sebastiaan van Stijn
608fdeb216 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>
(cherry picked from commit 7bfbb6e8ca)
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-09-24 13:24:14 +02:00
Austin Vazquez
46dcd7f33e Merge pull request #50938 from vvoland/50936-28.x
[28.x backport] Dockerfile.windows: remove deprecated 7Zip4Powershell
2025-09-09 09:48:30 -07:00
Paweł Gronowski
81da1cfdb2 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>
(cherry picked from commit 8c8324b37f)
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-09-09 17:35:25 +02:00
Paweł Gronowski
249d679a6b Merge pull request #50890 from vvoland/50889-28.x
[28.x backport] update to go1.24.7
2025-09-03 22:28:49 +02:00
Paweł Gronowski
d664cfe139 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>
(cherry picked from commit 30406d42e3)
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-09-03 20:34:21 +02:00
Paweł Gronowski
b384cd2a45 Merge pull request #50888 from vvoland/50885-28.x
[28.x backport] vendor: update buildkit to v0.24.0
2025-09-03 20:30:05 +02:00
Kevin Alvarez
c1ce88e7f8 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>
(cherry picked from commit d47b0db4f9)
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-09-03 18:43:00 +02:00
Austin Vazquez
4a34e8e9f6 Merge pull request #50875 from vvoland/50867-28.x
[28.x backport] c8d/history: Fix non-native platforms
2025-09-02 07:16:20 -07:00
Paweł Gronowski
cfa70d073e 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>
(cherry picked from commit 8031b077bc)
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-09-02 15:05:26 +02:00
Paweł Gronowski
d70382e442 integration/internal: Print Buildkit logs
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
(cherry picked from commit ce338dec81)
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-09-02 15:05:26 +02:00
Paweł Gronowski
687b206c6b 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>
(cherry picked from commit 27fca93b65)
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-09-02 15:05:26 +02:00
Paweł Gronowski
e4224f86c0 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>
(cherry picked from commit ad830a47af)
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-09-02 14:47:09 +02:00
Albin Kerouanton
5d5332b00c Merge pull request #50871 from vvoland/50870-28.x
[28.x backport] graphdriver/windows: Potential fix for access denied
2025-09-02 11:56:42 +02:00
Paweł Gronowski
87622a0ee5 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>
(cherry picked from commit f66f555ad4)
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-09-02 10:32:09 +02:00
Sebastiaan van Stijn
ffb621aade Merge pull request #50868 from vvoland/50390-28.x
[28.x backport] migrate test api images history integration cli test to integration test
2025-09-01 18:53:09 +02:00
Sebastiaan van Stijn
ac93e0ffb9 Merge pull request #50865 from crazy-max/28.x_pick_buildkit-0.24.0-rc2
[28.x backport] vendor: github.com/moby/buildkit v0.24.0-rc2
2025-09-01 18:16:33 +02:00
Abubacarr Ceesay
1c7c645702 implement test api images history integration test on dedicated file
Signed-off-by: Abubacarr Ceesay <abubacarr671@gmail.com>
(cherry picked from commit f6b3b257c8)
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-09-01 16:11:59 +02:00
Abubacarr Ceesay
43a614bec0 remove test api images history integration cli test suite
Signed-off-by: Abubacarr Ceesay <abubacarr671@gmail.com>
(cherry picked from commit 669163c416)
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-09-01 16:11:58 +02:00
Abubacarr Ceesay
a8914649d8 migrate test api images history integration cli test to integration test
Signed-off-by: Abubacarr Ceesay <abubacarr671@gmail.com>
(cherry picked from commit 04dbcddd6a)
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-09-01 16:11:57 +02:00
CrazyMax
18e4a056bb hack: temporarily use custom buildkit ref for testing
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2025-09-01 14:55:33 +02:00
Tonis Tiigi
b6427d938e vendor: update buildkit to v0.24.0-rc2
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2025-09-01 14:55:33 +02:00
Paweł Gronowski
ee159311c4 Merge pull request #50839 from akerouanton/28.x-deprecate-NetworkSettingsBase
[28.x] deprecate NetworkSettingsBase, DefaultNetworkSettings
2025-08-29 19:38:32 +02:00
Albin Kerouanton
660b67be5e api/types: update deprecation notice on NetworkSettingsBase
container.NetworkSettingsBase is deprecated in v28.4, and scheduled for
removal in v29. However, it contains three fields that aren't deprecated
and that will be moved to NetworkSettings.

Update the deprecation notice on NetworkSettingsBase to advise users
to access NetworkSettingsBase's fields through NetworkSettings.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-08-29 18:31:27 +02:00
Albin Kerouanton
eb7be20774 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>
(cherry picked from commit b7c597ec35)
Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-08-29 18:31:05 +02:00
Albin Kerouanton
01b27f6056 testutil/daemon: remove unused FindContainerIP
Signed-off-by: Albin Kerouanton <albinker@gmail.com>
(cherry picked from commit d0de293513)
Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-08-29 18:30:57 +02:00
Albin Kerouanton
65a1687e3d 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>
(cherry picked from commit 80bb864fd6)
Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-08-29 18:30:56 +02:00
Albin Kerouanton
0e5ff488de 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>
(cherry picked from commit 16dc39136c)
Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-08-29 17:19:36 +02:00
Sebastiaan van Stijn
02b4a1a3de Merge pull request #50837 from thaJeztah/28.x_backport_fix-containerd-prune-events
[28.x backport] Fix image prune events for containerd backend
2025-08-28 15:48:22 +02:00
Derek McGowan
a36d9d6276 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>
(cherry picked from commit da2b1a2930)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-28 14:37:22 +02:00
Austin Vazquez
8fd7525658 Merge pull request #50781 from thaJeztah/28.x_backport_bump_buildkit_v0.24
[28.x backport] vendor: github.com/moby/buildkit v0.24.0-rc1
2025-08-27 16:50:18 -07:00
Sebastiaan van Stijn
b13b91c54b 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>
(cherry picked from commit 229a29649f)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-28 00:19:21 +02:00
Sebastiaan van Stijn
314a8f8f0b Merge pull request #50829 from robmry/backport-28.x/unmap_endpoint_addresses
[28.x backport] Unmap IPv4 addresses loaded from store
2025-08-27 22:01:22 +02:00
Rob Murray
31f405932a 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>
(cherry picked from commit 071e6472db)
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-08-27 19:48:31 +01:00
Sebastiaan van Stijn
4c8a437c78 Merge pull request #50802 from thaJeztah/28.x_backport_move_logdriver_interfaces
[28.x backport] Move swarm runtime plugin spec to swarm types
2025-08-27 13:40:47 +02:00
Sebastiaan van Stijn
1ab19b12f5 Merge pull request #50822 from thaJeztah/28.x_backport_client_winio_dialpipe
[28.x backport] client: use go-winio.DialPipe directly
2025-08-27 12:56:25 +02:00
Sebastiaan van Stijn
5d385475ee Merge pull request #50821 from thaJeztah/28.x_backport_inspect_no_shadow
[28.x backport] daemon: Daemon.getInspectData: inline struct-literals
2025-08-27 12:55:41 +02:00
Sebastiaan van Stijn
74e4ea4ccc Merge pull request #50820 from thaJeztah/28.x_fix_plugin_fixture
[28.x] testutil/fixtures/plugin: makePluginBundle: fix invalid spec
2025-08-27 12:20:49 +02:00
Sebastiaan van Stijn
ffe9175177 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>
(cherry picked from commit accbfde61e)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-27 11:03:10 +02:00
Sebastiaan van Stijn
7ea634f7e0 daemon: Daemon.getInspectData: inline struct-literals
Also rename the "container" argument, which shadowed an import.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 44972d7427)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-27 10:50:58 +02:00
Sebastiaan van Stijn
c2dca55d7d testutil/fixtures/plugin: makePluginBundle: fix invalid spec
The fixture was using an invalid formatted Capability, which wasn't
detected in the old API code, but fails with the API module, for example:

    === RUN   TestPluginsWithRuntimes
        plugin_test.go:269: assertion failed: error is not nil: json: error calling MarshalText for type plugin.CapabilityID: capability "docker.dummy/1.0" cannot contain a dot
    --- FAIL: TestPluginsWithRuntimes (0.63s)
    === RUN   TestPluginBackCompatMediaTypes
        plugin_test.go:331: assertion failed: error is not nil: json: error calling MarshalText for type plugin.CapabilityID: capability "docker.dummy/1.0" cannot contain a dot
    --- FAIL: TestPluginBackCompatMediaTypes (0.11s)
    FAIL

This patch applies the same changes as ee560a3b23
in the master branch.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-27 10:32:59 +02:00
Sebastiaan van Stijn
ebbaaf1a17 [28.x] api: swarm: move RuntimeSpec, RuntimePrivilege back
Move these types back to their old location, but alias in the
new location so that any user of the old types would not require
to update.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-27 09:09:31 +02:00
Derek McGowan
ad4646255d Move swarm runtime plugin spec to swarm types
- Move swarm runtime plugin spec to swarm types
- Move swarm runtime plugin storage type to internal

Signed-off-by: Derek McGowan <derek@mcg.dev>
(cherry picked from commit 86190e7366)
(cherry picked from commit ee24dcec3d)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-25 17:23:30 +02:00
Paweł Gronowski
2fa44c2485 Merge pull request #50797 from thaJeztah/28.x_backport_fix_email_deprecation
[28.x backport] api/types/registry: update deprecation comment for AuthConfig.Email
2025-08-25 13:27:59 +02:00
Sebastiaan van Stijn
fdf63a4471 api/docs: update description for AuthConfig.Email field
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit d867f9f0f1)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-23 00:23:20 +02:00
Sebastiaan van Stijn
2ca61b29d8 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>
(cherry picked from commit 6cfff7e880)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-23 00:22:48 +02:00
Austin Vazquez
78470bcd4d Merge pull request #50793 from thaJeztah/28.x_backport_bump_deps
[28.x backport] vendor: golang.org/x/sync v0.16.0, go.etcd.io/bbolt v1.4.3
2025-08-22 13:26:13 -07:00
Sebastiaan van Stijn
8ae706833d 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>
(cherry picked from commit 15f92925f0)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-22 14:20:42 +02:00
Sebastiaan van Stijn
cc6af47b61 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>
(cherry picked from commit e8d0aba254)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-22 14:20:18 +02:00
Sebastiaan van Stijn
80947b5724 Merge pull request #50777 from thaJeztah/28.x_backport_remove_TestEventsBackwardsCompatible
[28.x backport] integration/system: remove TestEventsBackwardsCompatible, add TestEventsNonBlocking
2025-08-21 16:43:30 +02:00
Austin Vazquez
13f2be7b1a Merge pull request #50780 from thaJeztah/28.x_backport_bump_deps
[28.x backport] update dependencies for buildkit
2025-08-20 15:33:09 -07:00
Sebastiaan van Stijn
553c3b8c9f 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>
(cherry picked from commit a2aa7be724)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-20 22:15:23 +02:00
Sebastiaan van Stijn
7d7edf46a6 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>
(cherry picked from commit 3b14c5488f)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-20 22:14:47 +02:00
Sebastiaan van Stijn
993eae423e 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>
(cherry picked from commit 259eb259bc)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-20 22:14:47 +02:00
Sebastiaan van Stijn
2c93d2f909 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>
(cherry picked from commit d8b622b315)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-20 22:14:47 +02:00
Sebastiaan van Stijn
6305a44e58 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>
(cherry picked from commit 8e63b55146)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-20 22:14:46 +02:00
Paweł Gronowski
03a4cd8d9a 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>
(cherry picked from commit 03a662b80e)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-20 22:14:15 +02:00
Sebastiaan van Stijn
687cd8ebae 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>
(cherry picked from commit eac4c43aaa)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-20 18:37:18 +02:00
Sebastiaan van Stijn
95c3340e75 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>
(cherry picked from commit b0d9a90f45)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-20 18:35:47 +02:00
Austin Vazquez
436c33fcf3 Merge pull request #50768 from austinvazquez/deprecate-disk-usage-structs-in-api
[28.x] api/types: deprecate disk usage types for build cache, container, ima…
2025-08-19 09:42:45 -07:00
Austin Vazquez
e364b6c466 ci: add golangci-lint configuration to ignore deprecated api type usage in daemon
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-08-19 09:31:48 -05:00
Austin Vazquez
9396c31e13 api/types: deprecate disk usage types for build cache, container, images, and volumes
These types are only used internal to the daemon and will be removed from the api in the next release.

Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-08-19 07:37:55 -05:00
Sebastiaan van Stijn
caed16fa09 Merge pull request #50762 from thaJeztah/28.x_deprecate_jsonmessage_fields
[28.x] pkg/jsonmessage: JSONMessage: deprecate From, Time, and TimeNano fields
2025-08-19 14:31:03 +02:00
Sebastiaan van Stijn
bcbccc6eec pkg/jsonmessage: JSONMessage: deprecate From, Time, and TimeNano fields
On API version v1.22 and older, the `JSONMessage` was used to produce the
`/events` response. However, commit 72f1881df1
introduced an `events.Message` type that replaced the use of `JSONMessage`
for that purpose.

The `JSONMessage` is no longer used to unmarshal these messages, and users
of this package should not depend on these fields, and use the `events.Message`
type instead for unmarshaling the `/events` response.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-18 20:06:06 +02:00
Sebastiaan van Stijn
a8682c5d39 Merge pull request #50742 from thaJeztah/28.x_backport_api_network_errors
[28.x backport] Add multierror function to api network
2025-08-15 00:56:37 +02:00
Austin Vazquez
fc31d47bee Merge pull request #50737 from thaJeztah/28.x_backport_client_remove_getDockerOS
[28.x backport] client: remove getDockerOS utility in favor of "Ostype" header
2025-08-14 13:34:52 -07:00
Derek McGowan
5a0d62cab0 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>
(cherry picked from commit 374fa24a53)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-14 22:00:03 +02:00
Austin Vazquez
30efb73008 Merge pull request #50738 from thaJeztah/28.x_backport_fix-push-wo-auth
[28.x backport] daemon/router/image: initialize default authConfig
2025-08-14 12:58:43 -07:00
Tiago Teixeira
8a89fe5c19 daemon/router/image: initialize default authConfig
Signed-off-by: Tiago Teixeira <tiago.teixeira@ecorobotix.com>
(cherry picked from commit 033ec8be44)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-14 18:53:27 +02:00
Sebastiaan van Stijn
e53cd07fcc 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>
(cherry picked from commit fcf3ff1b2f)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-14 18:49:40 +02:00
Austin Vazquez
1404cd6aa1 Merge pull request #50714 from vvoland/50679-28.x
[28.x backport] api: swagger: Tweak type of ForceUpdate to uint64
2025-08-13 08:30:45 -07:00
Hannes Ortmeier
cf0958f89b docs: api: Tweak type of ForceUpdate to uin64
Signed-off-by: Hannes Ortmeier <ortmeier.hannes@gmail.com>
(cherry picked from commit 185ae7ec2c)
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-08-13 14:56:01 +02:00
Hannes Ortmeier
fd89baef7e 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>
(cherry picked from commit c8173c5c1f)
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-08-13 14:55:37 +02:00
Austin Vazquez
b3af0c840b Merge pull request #50707 from austinvazquez/cherry-pick-b25b421f97c1e04651210ced4e774268226d159a-to-28.x
[28.x] update to go1.24.6
2025-08-12 09:01:54 -07:00
Austin Vazquez
3fc876cd7b update to go1.24.6
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
(cherry picked from commit b25b421f97)
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-08-12 07:15:15 -05:00
Austin Vazquez
b61a1f7b30 Merge pull request #50696 from vvoland/50387-28.x
[28.x backport] integration/container: fix flaky TestRemoveContainerWithVolume
2025-08-12 05:09:17 -07:00
Austin Vazquez
3e7b60c12d Merge pull request #50695 from vvoland/50315-28.x
[28.x backport] Dockerfile: bump gotest.tools/gotestsum v1.12.3 (for go1.25)
2025-08-12 05:06:09 -07:00
Austin Vazquez
51d00bc794 Merge pull request #50698 from vvoland/50403-28.x
[28.x backport] integration/container: XFAIL flaky TestExecResize on Windows
2025-08-11 15:54:29 -07:00
Austin Vazquez
f8f6a7e108 Merge pull request #50700 from vvoland/50645-28.x
[28.x backport] Dockerfile: update containerd binary to v1.7.28
2025-08-11 15:42:58 -07:00
Austin Vazquez
96fb6e6a66 Merge pull request #50699 from vvoland/50644-28.x
[28.x backport] Dockerfile: update runc binary to v1.3.0
2025-08-11 15:09:30 -07:00
Austin Vazquez
cc86659203 Merge pull request #50697 from vvoland/50396-28.x
[28.x backport] integration-cli: fix flaky TestRestartStoppedContainer
2025-08-11 13:48:26 -07:00
Sebastiaan van Stijn
85aaa37c08 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>
(cherry picked from commit 8be1b2372a)
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-08-11 22:06:58 +02:00
Sebastiaan van Stijn
16c7a35584 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>
(cherry picked from commit f5f984eec6)
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-08-11 22:06:29 +02:00
Sebastiaan van Stijn
61443a72c2 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>
(cherry picked from commit fd8fec18cd)
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-08-11 21:58:38 +02:00
Sebastiaan van Stijn
492b3c94cb 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>
(cherry picked from commit a327a9f341)
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-08-11 21:58:01 +02:00
Sebastiaan van Stijn
d5b47b8fdf 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>
(cherry picked from commit d6c90dcb87)
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-08-11 21:57:18 +02:00
Sebastiaan van Stijn
30663d3e86 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>
(cherry picked from commit 4754c15e2b)
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-08-11 21:39:16 +02:00
Sebastiaan van Stijn
40ba2f33d1 Merge pull request #50664 from vvoland/50662-28.x
[28.x backport] Fix download-frozen-image-v2
2025-08-08 01:29:38 +02:00
Paweł Gronowski
3a15e3ed23 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>
(cherry picked from commit b9b52d59b8)
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-08-07 22:06:13 +02:00
Paweł Gronowski
ad243becbe 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>
(cherry picked from commit 359a881cea)
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-08-07 22:06:10 +02:00
Paweł Gronowski
501f2eab7a Merge pull request #50581 from thaJeztah/28.x_backport_daemon_no_jsonstream
[28.x backport] Add separate const for daemon httputils to avoid jsonmessage import
2025-07-31 08:12:25 +00:00
Derek McGowan
648c74d243 Add separate const for daemon httputils to avoid jsonmessage import
Signed-off-by: Derek McGowan <derek@mcg.dev>
(cherry picked from commit 02fcde0c18)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-31 03:09:32 +02:00
Sebastiaan van Stijn
f4595bc7b7 Merge pull request #50562 from thaJeztah/28.x_rewrite_ToParamWithVersion
[28.x] api/types/filters: reimplement ToParamWithVersion
2025-07-29 14:51:16 +02:00
Sebastiaan van Stijn
eadee3e5b9 [28.x] api/types/filters: reimplement ToParamWithVersion
This function depended on the non-exported `Args.values` field.
With the migration of the API to a separate module, we will
alias that type, and remove the deprecated `ToParamWithVersion`
function.

This means that we cannot alias the function, and aliasing the
`Args` type means we can't access the non-exported field.

This patch reimplements `ToParamWithVersion` by unmarshaling
the JSON output of the current format, and re-marshaling it
to the legacy format.

This is not optimal, but this code-path would only be used
for API versions that are deprecated, and is not to be used
for any new code.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-29 12:59:57 +02:00
Sebastiaan van Stijn
c9c7964b7e Merge pull request #50545 from thaJeztah/28.x_fix_backend_types
[28.x backport] api/types/system: move DiskUsage, DiskUsageOptions to api/types/backend
2025-07-28 17:39:07 +02:00
Sebastiaan van Stijn
60e84e7350 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>
(cherry picked from commit 82c069c857)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-28 16:26:02 +02:00
Paweł Gronowski
fd06f0f345 Merge pull request #50513 from thaJeztah/28.x_backport_migrate_profiles
[28.x backport] profiles/apparmor, seccomp: migrate to separate module
2025-07-25 16:03:49 +02:00
Sebastiaan van Stijn
643fcf4465 Merge pull request #50514 from thaJeztah/28.x_test_updates
[28.x backport] remove, update obsolete tests
2025-07-25 15:42:57 +02:00
Sebastiaan van Stijn
7d6a75b342 runconfig: update fixtures for TestDecodeContainerConfig
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit a401c0c046)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-25 13:57:16 +02:00
Sebastiaan van Stijn
596404f3aa 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>
(cherry picked from commit 1378604cc3)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-25 13:57:07 +02:00
Rob Murray
9fd8eaa95d 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>
(cherry picked from commit 3003c56c57)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-25 13:56:42 +02:00
Rob Murray
bea959c7b7 Merge pull request #50506 from robmry/backport-28.x/fix_firewalld_reload
[28.x backport] Fix firewalld reload for per-endpoint rules
2025-07-25 09:13:16 +01:00
Sebastiaan van Stijn
b2f03f45ea profiles/apparmor, seccomp: migrate to separate module
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit a600da91f4)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-25 10:09:00 +02:00
Andrey Epifanov
3e9ff78b94 bridge: Reapply endpoint iptables rules on firewalld reload
Signed-off-by: Andrey Epifanov <aepifanov@mirantis.com>
(cherry picked from commit 07393071ad)
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-07-24 17:30:46 +01:00
Rob Murray
29ed80aa86 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>
(cherry picked from commit 6d457d9695)
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-07-24 17:30:46 +01:00
Austin Vazquez
da489a11d4 Merge pull request #50478 from thaJeztah/28.x_backport_gha_bump_bk
[28.x backport] hack/buildkit-ref: temporarily bump BuildKit to head of v0.23 branch
2025-07-22 13:59:47 -07:00
Sebastiaan van Stijn
f173e45ae9 Merge pull request #50480 from austinvazquez/cherry-pick-ea29dffaa541289591aa44fa85d2a596ce860e16-to-28.x
[28.x backport] daemon/server: remove compatibility with API v1.4 auth-config on push
2025-07-22 20:02:48 +02:00
Sebastiaan van Stijn
e4b1f89996 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>
(cherry picked from commit ea29dffaa5)
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-07-22 08:31:32 -07:00
Sebastiaan van Stijn
0c9e14dcce 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>
(cherry picked from commit 1cc42643ae)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-22 15:55:58 +02:00
Sebastiaan van Stijn
bf6d688157 Merge pull request #50471 from austinvazquez/cherry-pick-b1ce0c89f0214cc6711c5c34e714d8bda737c65a-to-28.x
[28.x backport] client: always send (empty) body on push
2025-07-22 14:20:35 +02:00
Sebastiaan van Stijn
4205776b85 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>
(cherry picked from commit b1ce0c89f0)
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-07-21 15:59:17 -07:00
Paweł Gronowski
e77ff99ede Merge pull request #50354 from vvoland/50353-28.x
[28.x backport] Update to go1.24.5
2025-07-09 12:33:03 +02:00
Paweł Gronowski
6e3cf7f12b Merge pull request #50351 from vvoland/50179-28.x
[28.x backport] gha: update to windows 2022 / 2025
2025-07-09 10:14:10 +02:00
Paweł Gronowski
38c0abffce 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>
(cherry picked from commit 0a047e825c)
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-07-09 10:11:05 +02:00
Paweł Gronowski
3b7d703484 Merge pull request #50352 from vvoland/50347-28.x
[28.x backport] integration/networking: increase context timeout for attach
2025-07-08 19:01:29 +02:00
Sebastiaan van Stijn
d14a60fe24 Merge pull request #50348 from vvoland/50314-28.x
[28.x backport] gha: remove GO_VERSION build-arg from builds
2025-07-08 18:25:27 +02:00
Paweł Gronowski
da65c869b5 Merge pull request #50350 from vvoland/50333-28.x
[28.x backport] api: swagger: Tweak type of GwPriority to integer
2025-07-08 18:06:38 +02:00
Paweł Gronowski
76fbfe9953 Merge pull request #50349 from vvoland/50255-28.x
[28.x backport] dockerfile: update govulncheck to v1.1.4
2025-07-08 17:48:43 +02:00
Sebastiaan van Stijn
bfade89ec2 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>
(cherry picked from commit 0ea28fede0)
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-07-08 17:19:06 +02:00
Sebastiaan van Stijn
a818cfd87b gha: run windows 2025 on PRs, 2022 scheduled
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 9316396db0)
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-07-08 15:31:35 +02:00
Sebastiaan van Stijn
653777a522 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>
(cherry picked from commit 6f484d0d4c)
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-07-08 15:31:28 +02:00
Niel Drummond
1ad3df4768 api: swagger: Tweak type of GwPriority to integer
Signed-off-by: Niel Drummond <niel@drummond.lu>
(cherry picked from commit 51d6687754)
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-07-08 15:27:00 +02:00
Niel Drummond
6323db8e78 docs: api: Tweak type of GwPriority to integer
Signed-off-by: Niel Drummond <niel@drummond.lu>
(cherry picked from commit bfc0c7cff5)
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-07-08 15:26:58 +02:00
CrazyMax
a3c8f7fa8c dockerfile: update govulncheck to v1.1.4
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
(cherry picked from commit fcf666f9b0)
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-07-08 15:26:11 +02:00
Sebastiaan van Stijn
dfbba63a34 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>
(cherry picked from commit fa4f3c979f)
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-07-08 15:24:52 +02:00
Sebastiaan van Stijn
5beb93de84 Merge pull request #50309 from crazy-max/28.x_pick_buildkit-0.23.2
[28.x backport] vendor: update buildkit to v0.23.2
2025-07-02 15:31:29 +02:00
Tonis Tiigi
e17e96e3c5 vendor: update buildkit to v0.23.2
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2025-07-02 11:48:40 +02:00
Sebastiaan van Stijn
e0183475e0 Merge pull request #50264 from vvoland/50263-28.x
[28.x backport] gha/bin-image: add major and minor version image tags
2025-06-25 14:47:55 +02:00
Paweł Gronowski
a2af8bdebd 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>
(cherry picked from commit 38b98bcf68)
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-06-24 23:32:35 +02:00
Paweł Gronowski
265f709647 Merge pull request #50247 from vvoland/50245-28.x
[28.x backport] docs: cut api docs for v1.51
2025-06-20 16:22:35 +00:00
Paweł Gronowski
b2a9318a1e docs: cut api docs for v1.51
Used by the upcoming 28.3.0 release

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
(cherry picked from commit ef50844a0b)
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-06-20 18:16:33 +02:00
Sebastiaan van Stijn
b3e2e22b2a Merge pull request #50244 from vvoland/50177-28.x
[28.x backport] gha: lower timeouts on "build" and "merge" steps
2025-06-20 17:37:41 +02:00
Sebastiaan van Stijn
c571cd8513 Merge pull request #50243 from vvoland/50238-28.x
[28.x backport] vendor: update buildkit to v0.23.1
2025-06-20 17:36:18 +02:00
Sebastiaan van Stijn
8c713c1af4 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>
(cherry picked from commit 0a30b98447)
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-06-20 16:29:08 +02:00
Paweł Gronowski
539c115023 Merge pull request #50240 from thaJeztah/28.x_backport_validate_mirrors
[28.x backport] daemon/config: Validate: add missing validation for registry mirrors and improve errors
2025-06-20 14:16:09 +00:00
CrazyMax
8e7ea470cf vendor: update buildkit to v0.23.1
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
(cherry picked from commit 5a02e7f4e3)
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-06-20 16:05:04 +02:00
Jonathan A. Sternberg
222baf4ccb vendor: github.com/moby/buildkit v0.23.0
Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com>
(cherry picked from commit e43968d7ed)
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-06-20 16:04:30 +02:00
Paweł Gronowski
1627e828d7 Merge pull request #50241 from thaJeztah/28.x_backport_update_cgroups
[28.x backport] vendor: github.com/opencontainers/cgroups v0.0.3
2025-06-20 14:00:46 +00:00
Paweł Gronowski
4070ebda88 Merge pull request #50242 from thaJeztah/28.x_backport_fix_event_ordering
[28.x backport] daemon: containerStop: fix ordering of "stop" and "die" events
2025-06-20 13:38:31 +00:00
Paweł Gronowski
b613ac489e Merge pull request #50239 from vvoland/50237-28.x
[28.x backport] Update containerd to v2.1.3
2025-06-20 11:36:57 +00:00
Sebastiaan van Stijn
0e0ca09ddc 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>
(cherry picked from commit 062082ec9b)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-20 13:29:19 +02:00
Sebastiaan van Stijn
e62b0e2234 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>
(cherry picked from commit a90da2edc3)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-20 13:26:46 +02:00
Sebastiaan van Stijn
06ab9cd1ed 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>
(cherry picked from commit 1d8545d60c)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-20 13:20:27 +02:00
Sebastiaan van Stijn
97aa4e8550 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>
(cherry picked from commit 307c18598d)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-20 13:20:26 +02:00
Derek McGowan
e18a9c95b8 Update containerd to v2.1.3
Fixes various issues with pulling from registries

Signed-off-by: Derek McGowan <derek@mcg.dev>
(cherry picked from commit b466c35da1)
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-06-20 11:28:31 +02:00
Sebastiaan van Stijn
b959bebdfc Merge pull request #50219 from thaJeztah/28.x_backport_deprecate_execconfig_detach
[28.x backport] api/types/container: deprecate ExecOptions.Detach
2025-06-18 23:03:00 +02:00
Sebastiaan van Stijn
02ade1a34c Merge pull request #50210 from thaJeztah/28.x_backport_pkg_idtools_deprecate
[28.x backport] pkg/idtools: deprecate IdentityMapping, Identity.Chown
2025-06-18 23:02:12 +02:00
Paweł Gronowski
106c4b0af6 Merge pull request #50211 from thaJeztah/28.x_backport_bump_swarmkit
[28.x backport] vendor: github.com/moby/swarmkit/v2 v2.0.0
2025-06-17 16:18:54 +00:00
Sebastiaan van Stijn
54d2eee6d6 Merge pull request #50217 from thaJeztah/28.x_backport_update-buildkit-v0.23.0-rc2
[28.x backport] vendor: update buildkit to v0.13.0-rc2
2025-06-17 15:10:47 +02:00
Sebastiaan van Stijn
09fef2b26e 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>
(cherry picked from commit 0c182d4d57)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-17 13:10:50 +02:00
Tonis Tiigi
44c8cd2e8f vendor: update buildkit to v0.13.0-rc2
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
(cherry picked from commit 1289519b03)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-17 11:36:27 +02:00
Cory Snider
78b6204f9e 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>
(cherry picked from commit c3ac979ecf)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-17 11:23:57 +02:00
Cory Snider
cf98237186 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>
(cherry picked from commit 2d60b8eacd)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-16 17:53:26 +02:00
Sebastiaan van Stijn
fd96b01b0e 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>
(cherry picked from commit b7ef527bdc)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-16 17:40:11 +02:00
Paweł Gronowski
6a1fb46d48 Merge pull request #50169 from robmry/revert_overlay_refactoring
[28.x]: Revert overlay bug fixes / refactoring
2025-06-13 15:49:07 +00:00
Rob Murray
7acb079403 Revert "libn/networkdb: don't exceed broadcast size limit"
This reverts commit dacf445614.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-06-11 12:05:49 +01:00
Rob Murray
0df31cf585 Revert "libn/networkdb: fix data race in GetTableByNetwork"
This reverts commit ec65f2d21b.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-06-11 12:05:48 +01:00
Rob Murray
83b2fc245d Revert "Fix possible overlapping IPs when ingressNA == nil"
This reverts commit 56ad941564.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-06-11 12:05:46 +01:00
Rob Murray
e079583ab4 Revert "libnetwork/networkdb: use correct index in GetTableByNetwork"
This reverts commit d5c370dee6.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-06-11 12:05:45 +01:00
Rob Murray
cfd5e5e4d4 Revert "libn/networkdb: b'cast watch events from local POV"
This reverts commit c68671d908.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-06-11 12:05:44 +01:00
Rob Murray
576cf73add Revert "libn/networkdb: record tombstones for all deletes"
This reverts commit ada8bc3695.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-06-11 12:05:43 +01:00
Rob Murray
2297ae3e64 Revert "libn/networkdb: Watch() without race conditions"
This reverts commit a3aea15257.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-06-11 12:05:41 +01:00
Rob Murray
cc60ec8d3c Revert "libn/networkdb: stop table events from racing network leaves"
This reverts commit 270a4d41dc.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-06-11 12:05:40 +01:00
Rob Murray
b5b349dbd6 Revert "libn/osl: drop unused AddNeighbor force parameter"
This reverts commit 3bdf99d127.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-06-11 12:05:39 +01:00
Rob Murray
35916f0869 Revert "libn/osl: refactor func (*Namespace) AddNeighbor"
This reverts commit b6d76eb572.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-06-11 12:05:38 +01:00
Rob Murray
3eb59ba5a2 Revert "libnetwork/osl: remove superfluous locks in Namespace"
This reverts commit 9866738736.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-06-11 12:05:37 +01:00
Rob Murray
5d6ae34753 Revert "libnetwork/osl: stop tracking neighbor entries"
This reverts commit 0d6e7cd983.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-06-11 12:05:36 +01:00
Rob Murray
ea818a7f6f Revert "libnetwork/internal/setmatrix: make keys generic"
This reverts commit 0317f773a6.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-06-11 12:05:33 +01:00
Rob Murray
78ccc20545 Revert "libn/d/overlay: use netip types more"
This reverts commit d188df0039.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-06-11 12:05:26 +01:00
3267 changed files with 37719 additions and 105837 deletions

View File

@@ -2,5 +2,5 @@
# build artifacts
/bundles/
/cmd/dockerd/winresources/winres.json
/cmd/dockerd/*.syso
/cli/winresources/dockerd/winres.json
/cli/winresources/dockerd/*.syso

2
.gitattributes vendored
View File

@@ -1 +1,3 @@
Dockerfile* linguist-language=Dockerfile
vendor.mod linguist-language=Go-Module
vendor.sum linguist-language=Go-Checksums

View File

@@ -1,224 +0,0 @@
# Moby Project Development Guide
Always reference these instructions first and fallback to search or bash commands only when you encounter unexpected information that does not match the info here.
## Critical Build and Test Environment Constraints
**IMPORTANT LIMITATIONS**: The development environment has significant constraints that prevent full Docker-based development container usage:
- Docker container builds fail due to SSL certificate verification issues when downloading external dependencies
- Integration tests require Docker daemon access which may not be available
- Some validation tools (shfmt, gotestsum, golangci-lint) are not installed in the base environment
- Privileged operations (chown, mount, network namespaces) are restricted
**DO NOT attempt the following**:
- `make build` or `make shell` (Docker container build will fail)
- Full integration test suites without Docker daemon access
- Commands requiring privileged operations or Docker-in-Docker
## Working Effectively
### Bootstrap and Basic Build (WORKING METHODS)
```bash
# Navigate to repository
cd /path/to/moby
# Download Go dependencies - takes 5-10 seconds
go mod download
# Build main binaries directly with Go (RECOMMENDED)
time go build ./cmd/dockerd # ~6-7 seconds, produces dockerd binary
time go build ./cmd/docker-proxy # ~0.3 seconds, produces docker-proxy binary
# Verify binaries work
./dockerd --version # Should show version info
```
### Unit Testing
```bash
# Run unit tests for specific packages (FASTEST - ~1 second)
time go test -short ./pkg/...
# Run with specific test directory
TESTDIRS='./pkg/...' go test -short $TESTDIRS
# Run specific tests with timeout
go test -short -timeout=5m ./pkg/authorization
# NEVER CANCEL: Full unit test suite can take 4+ minutes
# Note: Many tests fail due to environment constraints (expected)
time go test -short ./... # Takes ~4 minutes, set timeout to 10+ minutes
```
### Validation and Linting
```bash
# Format checking (takes ~2 seconds, mostly clean except vendor/)
gofmt -l .
# Go vet validation (takes ~1 second per package)
go vet ./cmd/dockerd
go vet ./pkg/...
# YAML linting (works but shows many style violations - takes ~40 seconds)
yamllint . # NEVER CANCEL: Set timeout to 60+ minutes
# Check imports and basic structure
go list -f '{{ join .Deps "\n" }}' ./cmd/dockerd | head -10
```
## Manual Validation Scenarios
**ALWAYS test these scenarios after making changes**:
1. **Binary Build Validation**:
```bash
# Clean previous builds
rm -f dockerd docker-proxy
# Build and verify
go build ./cmd/dockerd && ./dockerd --version
go build ./cmd/docker-proxy
```
2. **Unit Test Validation** (for code in pkg/):
```bash
# Test specific package you modified
go test -v ./pkg/[modified-package]
# Test all pkg packages (limited but fast)
go test -short ./pkg/...
```
3. **Code Quality Validation**:
```bash
# Check formatting
gofmt -l . | grep -v vendor | head -5
# Verify imports work
go list ./cmd/dockerd
go list ./pkg/...
```
## Repository Structure and Navigation
### Key Directories
- `cmd/dockerd/` - Main Docker daemon binary
- `cmd/docker-proxy/` - Docker proxy binary
- `daemon/` - Core daemon implementation
- `api/` - API definitions and client code
- `client/` - Docker client library
- `pkg/` - Shared packages (safest for testing)
- `integration/` - Integration tests (require Docker daemon)
- `hack/` - Build scripts and validation tools
- `.github/workflows/` - CI/CD pipeline definitions
### Build System
- `Makefile` - Main build interface (Docker-based, mostly non-functional in this environment)
- `hack/make.sh` - Build script (requires Docker container)
- `hack/test/unit` - Unit test script (requires gotestsum)
- `hack/validate/` - Validation scripts (many require special tools)
### Go Modules
```bash
# Main module
cat go.mod # Shows github.com/moby/moby/v2
# Submodules
ls */go.mod # api/go.mod, client/go.mod, man/go.mod
```
## Common Validation Tasks
### Pre-commit Validation (USE THESE)
```bash
# Quick validation workflow (~10 seconds total)
gofmt -l . | grep -v vendor | head -5 # Check formatting
go vet ./cmd/dockerd # Vet main package
go build ./cmd/dockerd # Ensure it builds
go test -short ./pkg/... # Test shared packages
# Extended validation (~4 minutes total)
go test -short ./... # NEVER CANCEL: Set timeout to 10+ minutes
```
### Code Changes Validation
```bash
# After modifying daemon code
go build ./cmd/dockerd && ./dockerd --version
# After modifying pkg code
go test -v ./pkg/[modified-package]
# After modifying client code
cd client && go test ./...
cd ..
# After modifying API definitions
cd api && go test ./...
cd ..
```
## Timing Expectations and Timeouts
**CRITICAL**: Always set appropriate timeouts and NEVER CANCEL these operations:
- `go mod download`: 5-10 seconds (rarely needed, cached)
- `go build ./cmd/dockerd`: 6-7 seconds (NEVER CANCEL - set 2+ minute timeout)
- `go build ./cmd/docker-proxy`: 0.3 seconds
- `go test -short ./pkg/...`: 1 second (cached), 5-10 seconds (first run)
- `go test -short ./...`: 4+ minutes (NEVER CANCEL - set 10+ minute timeout)
- `gofmt -l .`: 2 seconds
- `yamllint .`: 40+ seconds (NEVER CANCEL - set 60+ minute timeout)
**WARNING**: Do not attempt these operations (they will fail):
- `make build`: Fails due to Docker build issues (~15+ minutes timeout, will fail)
- `make test`: Requires Docker container
- Integration tests: Require Docker daemon access
## Architectural Overview
Moby is a container platform written in Go with these key components:
- **dockerd**: Main daemon process managing containers, images, networks
- **docker-proxy**: Network proxy for container port mapping
- **containerd**: Container runtime (external dependency)
- **runc**: Low-level container runtime (external dependency)
### API Structure
- REST API defined in `api/` directory
- Client library in `client/` directory
- Daemon implementation in `daemon/` directory
- Shared utilities in `pkg/` directory
### Testing Strategy
- Unit tests: Test individual packages and functions
- Integration tests: Test API interactions (require Docker daemon)
- End-to-end tests: Test complete workflows (require full environment)
## Environment Setup Notes
This repository uses:
- **Go 1.24.6** (verified working)
- **Docker 28.0.4** (CLI available, daemon access limited)
- **Module system**: Multiple Go modules (main, api, client, man)
- **Build tags**: Uses netgo, osusergo, static_build tags
- **Cross-compilation**: Supports multiple platforms
## Troubleshooting
### Build Issues
- If `go build` fails: Check Go version, run `go mod download`
- If tests fail with permission errors: Expected in restricted environment
- If Docker commands fail: Use Go build commands instead
### Test Issues
- Network-related test failures: Expected (namespace restrictions)
- Permission errors: Expected (privilege restrictions)
- Docker API errors: Expected (daemon not accessible)
### Working Around Limitations
- Use `go test -short` to skip long-running tests
- Focus on `./pkg/...` tests which have fewer dependencies
- Use `go build` directly instead of Make targets
- Validate formatting with `gofmt` instead of full validation suite
Always validate your changes work with the core Go commands before submitting.

View File

@@ -16,7 +16,7 @@ on:
workflow_call:
env:
ALPINE_VERSION: "3.22"
ALPINE_VERSION: "3.21"
jobs:
run:

45
.github/workflows/.test-prepare.yml vendored Normal file
View File

@@ -0,0 +1,45 @@
# reusable workflow
name: .test-prepare
# TODO: hide reusable workflow from the UI. Tracked in https://github.com/community/community/discussions/12025
# Default to 'contents: read', which grants actions to read commits.
#
# If any permission is set, any permission not included in the list is
# implicitly set to "none".
#
# see https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions
permissions:
contents: read
on:
workflow_call:
outputs:
matrix:
description: Test matrix
value: ${{ jobs.run.outputs.matrix }}
jobs:
run:
runs-on: ubuntu-24.04
timeout-minutes: 120 # guardrails timeout for the whole job
outputs:
matrix: ${{ steps.set.outputs.matrix }}
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Create matrix
id: set
uses: actions/github-script@v7
with:
script: |
let matrix = ['graphdriver'];
if ("${{ contains(github.event.pull_request.labels.*.name, 'containerd-integration') || github.event_name != 'pull_request' }}" == "true") {
matrix.push('snapshotter');
}
await core.group(`Set matrix`, async () => {
core.info(`matrix: ${JSON.stringify(matrix)}`);
core.setOutput('matrix', JSON.stringify(matrix));
});

View File

@@ -16,7 +16,7 @@ on:
workflow_call:
env:
GO_VERSION: "1.24.6"
GO_VERSION: "1.24.9"
GOTESTLIST_VERSION: v0.3.1
TESTSTAT_VERSION: v0.1.25
SETUP_BUILDX_VERSION: edge
@@ -106,7 +106,7 @@ jobs:
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache-dependency-path: vendor.sum
cache: false
-
name: Download reports
uses: actions/download-artifact@v4

View File

@@ -21,13 +21,13 @@ on:
default: "graphdriver"
env:
GO_VERSION: "1.24.6"
GO_VERSION: "1.24.9"
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_GRAPHDRIVER: ${{ inputs.storage == 'graphdriver' && '1' || '' }}
TEST_INTEGRATION_USE_SNAPSHOTTER: ${{ inputs.storage == 'snapshotter' && '1' || '' }}
SETUP_BUILDX_VERSION: edge
SETUP_BUILDKIT_IMAGE: moby/buildkit:latest
@@ -144,9 +144,7 @@ jobs:
// { os: 'ubuntu-24.04', mode: 'rootless-systemd' }, // FIXME: https://github.com/moby/moby/issues/44084
];
if ("${{ inputs.storage }}" == "snapshotter") {
includes.push({ os: 'ubuntu-24.04', mode: 'iptables+firewalld' });
includes.push({ os: 'ubuntu-24.04', mode: 'nftables' });
includes.push({ os: 'ubuntu-24.04', mode: 'nftables+firewalld' });
includes.push({ os: 'ubuntu-24.04', mode: 'firewalld' });
}
await core.group(`Set matrix`, async () => {
core.info(`matrix: ${JSON.stringify(includes)}`);
@@ -192,9 +190,6 @@ jobs:
echo "FIREWALLD=true" >> $GITHUB_ENV
CACHE_DEV_SCOPE="${CACHE_DEV_SCOPE}firewalld"
fi
if [[ "${{ matrix.mode }}" == *"nftables"* ]]; then
echo "DOCKER_FIREWALL_BACKEND=nftables" >> $GITHUB_ENV
fi
echo "CACHE_DEV_SCOPE=${CACHE_DEV_SCOPE}" >> $GITHUB_ENV
-
name: Set up Docker Buildx
@@ -270,7 +265,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
@@ -302,7 +297,7 @@ jobs:
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache-dependency-path: vendor.sum
cache: false
-
name: Install gotestlist
run:
@@ -333,43 +328,19 @@ 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/nftables enabled to minimize the number of CI jobs, we
// firewalld 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': 'iptables+firewalld',
'mode': 'firewalld',
'test': 'DockerCLINetworkSuite|DockerCLIPortSuite|DockerDaemonSuite'
});
matrix.include.push({
'mode': 'iptables+firewalld',
'mode': 'firewalld',
'test': 'DockerSwarmSuite'
});
matrix.include.push({
'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',
'mode': 'firewalld',
'test': 'DockerNetworkSuite'
});
}
@@ -409,9 +380,6 @@ jobs:
echo "FIREWALLD=true" >> $GITHUB_ENV
CACHE_DEV_SCOPE="${CACHE_DEV_SCOPE}firewalld"
fi
if [[ "${{ matrix.mode }}" == *"nftables"* ]]; then
echo "DOCKER_FIREWALL_BACKEND=nftables" >> $GITHUB_ENV
fi
echo "CACHE_DEV_SCOPE=${CACHE_DEV_SCOPE}" >> $GITHUB_ENV
-
name: Set up Docker Buildx
@@ -469,7 +437,7 @@ jobs:
if: always()
uses: actions/upload-artifact@v4
with:
name: test-reports-integration-cli-${{ inputs.storage }}-${{ matrix.mode }}-${{ env.TESTREPORTS_NAME }}
name: test-reports-integration-cli-${{ inputs.storage }}-${{ env.TESTREPORTS_NAME }}
path: /tmp/reports/*
retention-days: 1
@@ -486,13 +454,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 }}-${{ matrix.mode }}-*
pattern: test-reports-integration-cli-${{ inputs.storage }}-*
merge-multiple: true
-
name: Install teststat

View File

@@ -28,7 +28,7 @@ on:
default: false
env:
GO_VERSION: "1.24.6"
GO_VERSION: "1.24.9"
GOTESTLIST_VERSION: v0.3.1
TESTSTAT_VERSION: v0.1.25
WINDOWS_BASE_IMAGE: mcr.microsoft.com/windows/servercore
@@ -70,18 +70,6 @@ jobs:
} 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: |
@@ -98,8 +86,6 @@ jobs:
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
@@ -149,18 +135,6 @@ jobs:
} 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: |
@@ -177,8 +151,6 @@ jobs:
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
-
@@ -212,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
@@ -242,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:
@@ -295,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: |
@@ -364,10 +342,10 @@ jobs:
"--exec-root=$env:TEMP\moby-exec", `
"--pidfile=$env:TEMP\docker.pid", `
"--register-service"
If ("${{ inputs.storage }}" -eq "graphdriver") {
If ("${{ inputs.storage }}" -eq "snapshotter") {
# 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_GRAPHDRIVER=1
echo "TEST_INTEGRATION_USE_GRAPHDRIVER=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_SNAPSHOTTER=1
echo "TEST_INTEGRATION_USE_SNAPSHOTTER=1" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
}
Write-Host "Starting service"
Start-Service -Name docker
@@ -426,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 == './...'
@@ -439,6 +411,7 @@ 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
@@ -447,6 +420,7 @@ 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 }}
-
@@ -523,7 +497,7 @@ jobs:
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache-dependency-path: vendor.sum
cache: false
-
name: Download reports
uses: actions/download-artifact@v4

View File

@@ -23,7 +23,7 @@ on:
pull_request:
env:
GO_VERSION: "1.24.6"
GO_VERSION: "1.24.9"
TESTSTAT_VERSION: v0.1.25
DESTDIR: ./build
SETUP_BUILDX_VERSION: edge
@@ -37,6 +37,7 @@ jobs:
build:
runs-on: ubuntu-24.04-arm
timeout-minutes: 20 # guardrails timeout for the whole job
if: ${{ github.event_name != 'pull_request' || !contains(github.event.pull_request.labels.*.name, 'ci/validate-only') }}
needs:
- validate-dco
strategy:
@@ -70,6 +71,7 @@ jobs:
build-dev:
runs-on: ubuntu-24.04-arm
timeout-minutes: 120 # guardrails timeout for the whole job
if: ${{ github.event_name != 'pull_request' || !contains(github.event.pull_request.labels.*.name, 'ci/validate-only') }}
needs:
- validate-dco
steps:
@@ -87,12 +89,13 @@ jobs:
targets: dev
set: |
*.cache-from=type=gha,scope=dev-arm64
*.cache-to=type=gha,scope=dev-arm64,mode=max
*.cache-to=type=gha,scope=dev-arm64
*.output=type=cacheonly
test-unit:
runs-on: ubuntu-24.04-arm
timeout-minutes: 120 # guardrails timeout for the whole job
if: ${{ github.event_name != 'pull_request' || !contains(github.event.pull_request.labels.*.name, 'ci/validate-only') }}
needs:
- build-dev
steps:
@@ -109,6 +112,9 @@ jobs:
version: ${{ env.SETUP_BUILDX_VERSION }}
driver-opts: image=${{ env.SETUP_BUILDKIT_IMAGE }}
buildkitd-flags: --debug
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Build dev image
uses: docker/bake-action@v6
@@ -150,7 +156,7 @@ jobs:
runs-on: ubuntu-24.04
timeout-minutes: 10
continue-on-error: ${{ github.event_name != 'pull_request' }}
if: always()
if: always() && (github.event_name != 'pull_request' || !contains(github.event.pull_request.labels.*.name, 'ci/validate-only'))
needs:
- test-unit
steps:
@@ -159,7 +165,7 @@ jobs:
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache-dependency-path: vendor.sum
cache: false
-
name: Download reports
uses: actions/download-artifact@v4
@@ -179,6 +185,7 @@ jobs:
runs-on: ubuntu-24.04-arm
timeout-minutes: 120 # guardrails timeout for the whole job
continue-on-error: ${{ github.event_name != 'pull_request' }}
if: ${{ github.event_name != 'pull_request' || !contains(github.event.pull_request.labels.*.name, 'ci/validate-only') }}
needs:
- build-dev
steps:
@@ -198,6 +205,9 @@ jobs:
version: ${{ env.SETUP_BUILDX_VERSION }}
driver-opts: image=${{ env.SETUP_BUILDKIT_IMAGE }}
buildkitd-flags: --debug
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Build dev image
uses: docker/bake-action@v6
@@ -249,7 +259,7 @@ jobs:
runs-on: ubuntu-24.04
timeout-minutes: 10
continue-on-error: ${{ github.event_name != 'pull_request' }}
if: always()
if: always() && (github.event_name != 'pull_request' || !contains(github.event.pull_request.labels.*.name, 'ci/validate-only'))
needs:
- test-integration
steps:
@@ -258,7 +268,7 @@ jobs:
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache-dependency-path: vendor.sum
cache: false
-
name: Download reports
uses: actions/download-artifact@v4

View File

@@ -42,6 +42,7 @@ jobs:
prepare:
runs-on: ubuntu-24.04
timeout-minutes: 20 # guardrails timeout for the whole job
if: ${{ github.event_name != 'pull_request' || !contains(github.event.pull_request.labels.*.name, 'ci/validate-only') }}
outputs:
platforms: ${{ steps.platforms.outputs.matrix }}
steps:
@@ -58,15 +59,13 @@ 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 28.x branch
# moby/moby-bin:28.x
## push on 23.0 branch
# moby/moby-bin:23.0
tags: |
type=semver,pattern={{version}}
type=ref,event=branch
@@ -96,10 +95,10 @@ jobs:
build:
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:
@@ -172,9 +171,9 @@ jobs:
merge:
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.24.6"
GO_VERSION: "1.24.9"
DESTDIR: ./build
SETUP_BUILDX_VERSION: edge
SETUP_BUILDKIT_IMAGE: moby/buildkit:latest
@@ -35,6 +35,7 @@ jobs:
build-linux:
runs-on: ubuntu-24.04
timeout-minutes: 120 # guardrails timeout for the whole job
if: ${{ github.event_name != 'pull_request' || !contains(github.event.pull_request.labels.*.name, 'ci/validate-only') }}
needs:
- validate-dco
steps:
@@ -62,6 +63,7 @@ jobs:
test-linux:
runs-on: ubuntu-24.04
timeout-minutes: 120 # guardrails timeout for the whole job
if: ${{ github.event_name != 'pull_request' || !contains(github.event.pull_request.labels.*.name, 'ci/validate-only') }}
needs:
- build-linux
env:
@@ -106,7 +108,7 @@ jobs:
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache-dependency-path: vendor.sum
cache: false
-
name: BuildKit ref
run: |
@@ -166,6 +168,7 @@ jobs:
build-windows:
runs-on: windows-2022
timeout-minutes: 120
if: ${{ github.event_name != 'pull_request' || !contains(github.event.pull_request.labels.*.name, 'ci/validate-only') }}
needs:
- validate-dco
env:
@@ -188,6 +191,7 @@ jobs:
- name: Env
run: |
Get-ChildItem Env: | Out-String
- name: Moby - Init
run: |
New-Item -ItemType "directory" -Path "${{ github.workspace }}\go-build"
@@ -198,18 +202,7 @@ jobs:
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache-dependency-path: vendor.sum
- name: Cache
uses: actions/cache@v4
with:
path: |
~\AppData\Local\go-build
~\go\pkg\mod
${{ github.workspace }}\go-build
${{ env.GOPATH }}\pkg\mod
key: ${{ inputs.os }}-${{ github.job }}-${{ hashFiles('**/vendor.sum') }}
restore-keys: |
${{ inputs.os }}-${{ github.job }}-
cache: false
- name: Docker info
run: |
@@ -265,6 +258,7 @@ jobs:
test-windows:
runs-on: windows-2022
timeout-minutes: 120 # guardrails timeout for the whole job
if: ${{ github.event_name != 'pull_request' || !contains(github.event.pull_request.labels.*.name, 'ci/validate-only') }}
needs:
- build-windows
env:
@@ -308,22 +302,27 @@ jobs:
disabledFeatures="${disabledFeatures},merge_diff"
fi
echo "BUILDKIT_TEST_DISABLE_FEATURES=${disabledFeatures}" >> $GITHUB_ENV
- name: Expose GitHub Runtime
uses: crazy-max/ghaction-github-runtime@v3
- name: Checkout
uses: actions/checkout@v4
with:
path: moby
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache-dependency-path: vendor.sum
cache: false
- name: BuildKit ref
shell: bash
run: |
echo "$(./hack/buildkit-ref)" >> $GITHUB_ENV
working-directory: moby
- name: Checkout BuildKit ${{ env.BUILDKIT_REF }}
uses: actions/checkout@v4
with:
@@ -358,6 +357,7 @@ jobs:
testFlags="${testFlags} --run=TestIntegration/$testSliceOffset.*/worker=${{ matrix.worker }}"
fi
echo "TESTFLAGS=${testFlags}" >> $GITHUB_ENV
- name: Test
shell: bash
run: |

View File

@@ -67,6 +67,7 @@ jobs:
prepare-cross:
runs-on: ubuntu-24.04
timeout-minutes: 20 # guardrails timeout for the whole job
if: ${{ github.event_name != 'pull_request' || !contains(github.event.pull_request.labels.*.name, 'ci/validate-only') }}
needs:
- validate-dco
outputs:
@@ -89,6 +90,7 @@ jobs:
cross:
runs-on: ubuntu-24.04
timeout-minutes: 20 # guardrails timeout for the whole job
if: ${{ github.event_name != 'pull_request' || !contains(github.event.pull_request.labels.*.name, 'ci/validate-only') }}
needs:
- validate-dco
- prepare-cross
@@ -128,6 +130,7 @@ jobs:
govulncheck:
runs-on: ubuntu-24.04
timeout-minutes: 120 # guardrails timeout for the whole job
# Always run security checks, even with 'ci/validate-only' label
permissions:
# required to write sarif report
security-events: write
@@ -157,6 +160,7 @@ jobs:
build-dind:
runs-on: ubuntu-24.04
if: ${{ github.event_name != 'pull_request' || !contains(github.event.pull_request.labels.*.name, 'ci/validate-only') }}
needs:
- validate-dco
steps:

View File

@@ -32,6 +32,9 @@ on:
# * * * * *
- cron: '0 9 * * 4'
env:
GO_VERSION: "1.24.9"
jobs:
codeql:
runs-on: ubuntu-24.04
@@ -46,10 +49,20 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Update Go
# 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: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.24.6"
go-version: ${{ env.GO_VERSION }}
cache: false
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:

View File

@@ -23,7 +23,7 @@ on:
pull_request:
env:
GO_VERSION: "1.24.6"
GO_VERSION: "1.24.9"
GIT_PAGER: "cat"
PAGER: "cat"
SETUP_BUILDX_VERSION: edge
@@ -44,6 +44,7 @@ jobs:
mode:
- ""
- systemd
- firewalld
steps:
-
name: Prepare
@@ -65,10 +66,11 @@ jobs:
targets: dev
set: |
*.cache-from=type=gha,scope=dev${{ matrix.mode }}
*.cache-to=type=gha,scope=dev${{ matrix.mode }},mode=max
*.cache-to=type=gha,scope=dev${{ matrix.mode }}
*.output=type=cacheonly
test:
if: ${{ github.event_name != 'pull_request' || !contains(github.event.pull_request.labels.*.name, 'ci/validate-only') }}
needs:
- build-dev
- validate-dco
@@ -84,6 +86,7 @@ jobs:
storage: ${{ matrix.storage }}
test-unit:
if: ${{ github.event_name != 'pull_request' || !contains(github.event.pull_request.labels.*.name, 'ci/validate-only') }}
needs:
- build-dev
- validate-dco
@@ -153,6 +156,7 @@ jobs:
smoke-prepare:
runs-on: ubuntu-24.04
timeout-minutes: 10 # guardrails timeout for the whole job
if: ${{ github.event_name != 'pull_request' || !contains(github.event.pull_request.labels.*.name, 'ci/validate-only') }}
needs:
- validate-dco
outputs:
@@ -175,6 +179,7 @@ jobs:
smoke:
runs-on: ubuntu-24.04
timeout-minutes: 20 # guardrails timeout for the whole job
if: ${{ github.event_name != 'pull_request' || !contains(github.event.pull_request.labels.*.name, 'ci/validate-only') }}
needs:
- smoke-prepare
strategy:

View File

@@ -14,20 +14,15 @@ on:
types: [opened, edited, labeled, unlabeled, synchronize]
jobs:
check-labels:
check-area-label:
runs-on: ubuntu-24.04
timeout-minutes: 120 # guardrails timeout for the whole job
steps:
- name: Missing `area/` label
if: always() && contains(join(github.event.pull_request.labels.*.name, ','), 'impact/') && !contains(join(github.event.pull_request.labels.*.name, ','), 'area/')
if: 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

View File

@@ -22,15 +22,21 @@ jobs:
validate-dco:
uses: ./.github/workflows/.dco.yml
test-prepare:
uses: ./.github/workflows/.test-prepare.yml
needs:
- validate-dco
run:
if: ${{ github.event_name != 'pull_request' || !contains(github.event.pull_request.labels.*.name, 'ci/validate-only') }}
needs:
- test-prepare
uses: ./.github/workflows/.windows.yml
secrets: inherit
strategy:
fail-fast: false
matrix:
storage:
- graphdriver
- snapshotter
storage: ${{ fromJson(needs.test-prepare.outputs.matrix) }}
with:
os: windows-2022
storage: ${{ matrix.storage }}

View File

@@ -26,15 +26,21 @@ jobs:
validate-dco:
uses: ./.github/workflows/.dco.yml
test-prepare:
uses: ./.github/workflows/.test-prepare.yml
needs:
- validate-dco
run:
if: ${{ github.event_name != 'pull_request' || !contains(github.event.pull_request.labels.*.name, 'ci/validate-only') }}
needs:
- test-prepare
uses: ./.github/workflows/.windows.yml
secrets: inherit
strategy:
fail-fast: false
matrix:
storage:
- graphdriver
- snapshotter
storage: ${{ fromJson(needs.test-prepare.outputs.matrix) }}
with:
os: windows-2025
storage: ${{ matrix.storage }}

4
.gitignore vendored
View File

@@ -15,8 +15,8 @@ thumbs.db
# build artifacts
/bundles/
/cmd/dockerd/winresources/winres.json
/cmd/dockerd/*.syso
/cli/winresources/dockerd/*.syso
/cli/winresources/dockerd/winres.json
# ci artifacts
*.exe

View File

@@ -3,7 +3,7 @@ version: "2"
run:
# prevent golangci-lint from deducting the go version to lint for through go.mod,
# which causes it to fallback to go1.17 semantics.
go: "1.24.6"
go: "1.24.9"
concurrency: 2
# Only supported with go modules enabled (build flag -mod=vendor only valid when using modules)
# modules-download-mode: vendor
@@ -69,8 +69,6 @@ linters:
desc: Use github.com/moby/sys/userns instead.
- pkg: "github.com/tonistiigi/fsutil"
desc: The fsutil module does not have a stable API, so we should not have a direct dependency unless necessary.
- pkg: "github.com/hashicorp/go-multierror"
desc: "Use errors.Join instead"
dupword:
ignore:
@@ -105,11 +103,11 @@ linters:
msg: Go 1.19 atomic types should be used instead.
- pkg: ^regexp$
pattern: ^regexp\.MustCompile
msg: Use daemon/internal/lazyregexp.New instead.
msg: Use 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$
- pkg: github.com/docker/docker/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
@@ -206,20 +204,10 @@ linters:
max-func-lines: 0
revive:
# Only listed rules are applied
# https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md
rules:
- name: increment-decrement
# FIXME make sure all packages have a description. Currently, there's many packages without.
- name: package-comments
disabled: true
- name: redefines-builtin-id
- name: superfluous-else
arguments:
- preserve-scope
- name: use-any
- name: use-errors-new
- name: var-declaration
staticcheck:
checks:
@@ -267,6 +255,9 @@ linters:
http-status-code: true
exclusions:
paths:
- volume/drivers/proxy.go # TODO: this is a generated file but with an invalid header, see https://github.com/moby/moby/pull/46274
rules:
# We prefer to use an "linters.exclusions.rules" so that new "default" exclusions are not
# automatically inherited. We can decide whether or not to follow upstream
@@ -312,6 +303,11 @@ linters:
linters:
- staticcheck
# FIXME(thaJeztah): ignoring these transitional utilities until BuildKit is vendored with https://github.com/moby/moby/pull/49743
- text: "SA1019: idtools\\.(ToUserIdentityMapping|FromUserIdentityMapping|IdentityMapping) is deprecated"
linters:
- staticcheck
# Ignore "nested context in function literal (fatcontext)" as we intentionally set up tracing on a base-context for tests.
# FIXME(thaJeztah): see if there's a more iodiomatic way to do this.
- text: 'nested context in function literal'
@@ -331,21 +327,18 @@ linters:
linters:
- forbidigo
- text: 'use of `regexp.MustCompile` forbidden'
path: "daemon/internal/lazyregexp"
linters:
- forbidigo
- text: 'use of `regexp.MustCompile` forbidden'
path: "internal/testutils"
path: "internal/lazyregexp"
linters:
- forbidigo
- text: 'use of `regexp.MustCompile` forbidden'
path: "libnetwork/cmd/networkdb-test/dbclient"
linters:
- forbidigo
- text: 'use of `regexp.MustCompile` forbidden'
path: "registry/"
# Ignore deprecated disk usage type warnings which will be moved internal to the daemon backend in the next major release.
- text: "SA1019: ((buildtypes|build).CacheDiskUsage|(container|containertypes|image|volume|volumetypes).DiskUsage) is deprecated"
linters:
- forbidigo
- staticcheck
# Log a warning if an exclusion rule is unused.
# Default: false

View File

@@ -1,6 +1,6 @@
# syntax=docker/dockerfile:1
ARG GO_VERSION=1.24.6
ARG GO_VERSION=1.24.9
ARG BASE_DEBIAN_DISTRO="bookworm"
ARG GOLANG_IMAGE="golang:${GO_VERSION}-${BASE_DEBIAN_DISTRO}"
ARG XX_VERSION=1.6.1
@@ -10,7 +10,7 @@ ARG XX_VERSION=1.6.1
ARG VPNKIT_VERSION=0.6.0
# DOCKERCLI_VERSION is the version of the CLI to install in the dev-container.
ARG DOCKERCLI_VERSION=v28.3.2
ARG DOCKERCLI_VERSION=v28.2.2
ARG DOCKERCLI_REPOSITORY="https://github.com/docker/cli.git"
# cli version used for integration-cli tests
@@ -18,10 +18,10 @@ ARG DOCKERCLI_INTEGRATION_REPOSITORY="https://github.com/docker/cli.git"
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.25.0
ARG BUILDX_VERSION=0.24.0
# COMPOSE_VERSION is the version of compose to install in the dev container.
ARG COMPOSE_VERSION=v2.38.2
ARG COMPOSE_VERSION=v2.36.2
ARG SYSTEMD="false"
ARG FIREWALLD="false"
@@ -34,8 +34,8 @@ ARG DOCKER_STATIC=1
ARG REGISTRY_VERSION=3.0.0
# delve is currently only supported on linux/amd64 and linux/arm64;
# https://github.com/go-delve/delve/blob/v1.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
# https://github.com/go-delve/delve/blob/v1.24.1/pkg/proc/native/support_sentinel.go#L1
# https://github.com/go-delve/delve/blob/v1.24.1/pkg/proc/native/support_sentinel_linux.go#L1
#
# ppc64le support was added in v1.21.1, but is still experimental, and requires
# the "-tags exp.linuxppc64le" build-tag to be set:
@@ -64,6 +64,7 @@ COPY --from=xx / /
RUN go telemetry off && [ "$(go telemetry)" = "off" ] || { echo "Failed to disable Go telemetry"; exit 1; }
RUN echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache
RUN apt-get update && apt-get install --no-install-recommends -y file
ENV GO111MODULE=off
ENV GOTOOLCHAIN=local
FROM base AS criu
@@ -81,18 +82,25 @@ 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
# 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.32.3
RUN --mount=type=cache,target=/root/.cache/go-build,id=swagger-build-$TARGETPLATFORM \
RUN --mount=from=swagger-src,src=/usr/src/swagger,rw \
--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
GOBIN=/build xx-go install "github.com/go-swagger/go-swagger/cmd/swagger@${GO_SWAGGER_VERSION}"
xx-go build -o /build/swagger ./cmd/swagger
xx-verify /build/swagger
EOT
@@ -127,7 +135,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.25.0
ARG DELVE_VERSION=v1.24.1
RUN git fetch -q --depth 1 origin "${DELVE_VERSION}" +refs/tags/*:refs/tags/* && git checkout -q FETCH_HEAD
FROM base AS delve-supported
@@ -137,7 +145,7 @@ RUN --mount=from=delve-src,src=/usr/src/delve,rw \
--mount=type=cache,target=/root/.cache/go-build,id=delve-build-$TARGETPLATFORM \
--mount=type=cache,target=/go/pkg/mod <<EOT
set -e
xx-go build -o /build/dlv ./cmd/dlv
GO111MODULE=on xx-go build -o /build/dlv ./cmd/dlv
xx-verify /build/dlv
EOT
@@ -149,7 +157,7 @@ FROM base AS gowinres
ARG GOWINRES_VERSION=v0.3.1
RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg/mod \
GOBIN=/build/ go install "github.com/tc-hib/go-winres@${GOWINRES_VERSION}" \
GOBIN=/build/ GO111MODULE=on go install "github.com/tc-hib/go-winres@${GOWINRES_VERSION}" \
&& /build/go-winres --help
# containerd
@@ -159,8 +167,11 @@ 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.
ARG CONTAINERD_VERSION=v1.7.28
# 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.29
RUN git fetch -q --depth 1 origin "${CONTAINERD_VERSION}" +refs/tags/*:refs/tags/* && git checkout -q FETCH_HEAD
FROM base AS containerd-build
@@ -194,7 +205,7 @@ FROM base AS golangci_lint
ARG GOLANGCI_LINT_VERSION=v2.1.5
RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg/mod \
GOBIN=/build/ go install "github.com/golangci/golangci-lint/v2/cmd/golangci-lint@${GOLANGCI_LINT_VERSION}" \
GOBIN=/build/ GO111MODULE=on go install "github.com/golangci/golangci-lint/v2/cmd/golangci-lint@${GOLANGCI_LINT_VERSION}" \
&& /build/golangci-lint --version
FROM base AS gotestsum
@@ -202,20 +213,20 @@ FROM base AS gotestsum
ARG GOTESTSUM_VERSION=v1.12.3
RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg/mod \
GOBIN=/build/ go install "gotest.tools/gotestsum@${GOTESTSUM_VERSION}" \
GOBIN=/build/ GO111MODULE=on 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/ go install "mvdan.cc/sh/v3/cmd/shfmt@${SHFMT_VERSION}" \
GOBIN=/build/ GO111MODULE=on 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/ go install "golang.org/x/tools/gopls@latest" \
GOBIN=/build/ GO111MODULE=on go install "golang.org/x/tools/gopls@latest" \
&& /build/gopls version
FROM base AS dockercli
@@ -250,7 +261,7 @@ RUN git init . && git remote add origin "https://github.com/opencontainers/runc.
# 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.
ARG RUNC_VERSION=v1.3.0
ARG RUNC_VERSION=v1.3.3
RUN git fetch -q --depth 1 origin "${RUNC_VERSION}" +refs/tags/*:refs/tags/* && git checkout -q FETCH_HEAD
FROM base AS runc-build
@@ -317,7 +328,7 @@ 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 go.mod and hack/dockerfile/install/rootlesskit.installer accordingly.
# When updating, also update vendor.mod and hack/dockerfile/install/rootlesskit.installer accordingly.
ARG ROOTLESSKIT_VERSION=v2.3.4
RUN git fetch -q --depth 1 origin "${ROOTLESSKIT_VERSION}" +refs/tags/*:refs/tags/* && git checkout -q FETCH_HEAD
@@ -330,6 +341,7 @@ 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 \
@@ -530,14 +542,14 @@ 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 \
icoutils
llvm
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 \
@@ -567,6 +579,7 @@ RUN <<EOT
fi
EOT
RUN --mount=type=bind,target=.,rw \
--mount=type=tmpfs,target=cli/winresources/dockerd \
--mount=type=cache,target=/root/.cache/go-build,id=moby-build-$TARGETPLATFORM <<EOT
set -e
target=$([ "$DOCKER_STATIC" = "1" ] && echo "binary" || echo "dynbinary")

View File

@@ -5,17 +5,18 @@
# This represents the bare minimum required to build and test Docker.
ARG GO_VERSION=1.24.6
ARG GO_VERSION=1.24.9
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/moby/moby/blob/master/project/PACKAGERS.md#build-dependencies
# https://github.com/moby/moby/blob/master/project/PACKAGERS.md#runtime-dependencies
# https://github.com/docker/docker/blob/master/project/PACKAGERS.md#build-dependencies
# https://github.com/docker/docker/blob/master/project/PACKAGERS.md#runtime-dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
curl \

View File

@@ -161,14 +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.24.6
ARG GO_VERSION=1.24.9
# GOTESTSUM_VERSION is the version of gotest.tools/gotestsum to install.
ARG GOTESTSUM_VERSION=v1.12.3
# GOWINRES_VERSION is the version of go-winres to install.
ARG GOWINRES_VERSION=v0.3.3
ARG CONTAINERD_VERSION=v1.7.28
ARG CONTAINERD_VERSION=v1.7.29
# Environment variable notes:
# - GO_VERSION must be consistent with 'Dockerfile' used by Linux.
@@ -178,6 +178,7 @@ 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} `
@@ -258,14 +259,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"""; `
@@ -277,11 +275,13 @@ 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..."'; `
} `
@@ -291,11 +291,13 @@ RUN `
RUN `
Function Install-GoWinres() { `
$Env:GO111MODULE = 'on'; `
$tmpGobin = "${Env:GOBIN_TMP}"; `
$Env:GOBIN = """${Env:GOPATH}`\bin"""; `
Write-Host "INFO: Installing go-winres version $Env:GOWINRES_VERSION in $Env:GOBIN"; `
&go install "github.com/tc-hib/go-winres@${Env:GOWINRES_VERSION}"; `
$Env:GOBIN = "${tmpGobin}"; `
$Env:GO111MODULE = 'off'; `
if ($LASTEXITCODE -ne 0) { `
Throw '"go-winres install failed..."'; `
} `

View File

@@ -6,7 +6,7 @@
# GitHub ID, Name, Email address, GPG fingerprint
"akerouanton","Albin Kerouanton","albinker@gmail.com"
"AkihiroSuda","Akihiro Suda","akihiro.suda.cz@hco.ntt.co.jp"
"austinvazquez","Austin Vazquez","austin.vazquez.dev@gmail.com"
"austinvazquez","Austin Vazquez","macedonv@amazon.com"
"corhere","Cory Snider","csnider@mirantis.com"
"cpuguy83","Brian Goff","cpuguy83@gmail.com"
"robmry","Rob Murray","rob.murray@docker.com"

View File

@@ -38,7 +38,6 @@ DOCKER_ENVS := \
-e DOCKERCLI_INTEGRATION_REPOSITORY \
-e DOCKER_DEBUG \
-e DOCKER_EXPERIMENTAL \
-e DOCKER_FIREWALL_BACKEND \
-e DOCKER_GITCOMMIT \
-e DOCKER_GRAPHDRIVER \
-e DOCKER_LDFLAGS \
@@ -54,7 +53,7 @@ DOCKER_ENVS := \
-e GITHUB_ACTIONS \
-e TEST_FORCE_VALIDATE \
-e TEST_INTEGRATION_DIR \
-e TEST_INTEGRATION_USE_GRAPHDRIVER \
-e TEST_INTEGRATION_USE_SNAPSHOTTER \
-e TEST_INTEGRATION_FAIL_FAST \
-e TEST_SKIP_INTEGRATION \
-e TEST_SKIP_INTEGRATION_CLI \

View File

@@ -1,11 +1,9 @@
The Moby Project
================
[![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)
[![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)
[![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://pkg.go.dev/github.com/moby/moby/v2/daemon#Daemon) object,
["Daemon"](https://godoc.org/github.com/docker/docker/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/v3/assert](https://pkg.go.dev/gotest.tools/v3/assert) assertions. They are located in
[gotest.tools/assert](https://godoc.org/gotest.tools/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/v3/assert](https://pkg.go.dev/gotest.tools/v3/assert) assertions. They are located in
[gotest.tools/assert](https://godoc.org/gotest.tools/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,28 +57,17 @@ 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`](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
environment should be properly considered. `skip.If` from
[gotest.tools/skip](https://godoc.org/gotest.tools/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/311b2c87e125c6d4198014369e313135cf928a8a/testutil/environment/environment.go)
[environment.go](https://github.com/moby/moby/blob/6b6eeed03b963a27085ea670f40cd5ff8a61f32e/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
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
}
skip.If(t, testEnv.IsRemoteDaemon())
// your integration test code
```
If a remote daemon is detected, the test will be skipped.
@@ -89,11 +78,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 `make shell` container or properly
or `hack/test/unit` from inside a `BINDDIR=. make shell` container or properly
configured environment.
The following environment variables may be used to run a subset of tests:
@@ -106,7 +95,7 @@ The following environment variables may be used to run a subset of tests:
To run the integration test suite:
```bash
```
make test-integration
```
@@ -133,5 +122,5 @@ You can change a version of golang used for building stuff that is being tested
by setting `GO_VERSION` variable, for example:
```bash
make GO_VERSION=1.24.6 test
make GO_VERSION=1.24.8 test
```

46
VENDORING.md Normal file
View File

@@ -0,0 +1,46 @@
# 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,18 +1,12 @@
# 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)
# Working on the Engine API
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/moby/moby/issues/27919) for progress on this.
- `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.
- `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.
@@ -27,7 +21,6 @@ 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:
@@ -36,7 +29,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/moby/moby/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/docker/docker/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.
@@ -46,4 +39,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/docs](https://github.com/docker/docs).
The production documentation is generated by vendoring `swagger.yaml` into [docker/docker.github.io](https://github.com/docker/docker.github.io).

View File

@@ -3,14 +3,18 @@ package api
// Common constants for daemon and client.
const (
// DefaultVersion of the current REST API.
DefaultVersion = "1.52"
DefaultVersion = "1.51"
// MinSupportedAPIVersion is the minimum API version that can be supported
// by the API server, specified as "major.minor". Note that the daemon
// may be configured with a different minimum API version, as returned
// in [github.com/moby/moby/api/types.Version.MinAPIVersion].
// 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"
)

View File

@@ -1,26 +0,0 @@
# 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).

File diff suppressed because it is too large Load Diff

View File

@@ -1,15 +0,0 @@
module github.com/moby/moby/api
go 1.23.0
require (
github.com/docker/go-connections v0.6.0
github.com/docker/go-units v0.5.0
github.com/google/go-cmp v0.5.9
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
)

View File

@@ -1,18 +0,0 @@
github.com/docker/go-connections v0.6.0 h1:LlMG9azAe1TqfR7sO+NJttz1gy6KO7VJBh+pMmjSD94=
github.com/docker/go-connections v0.6.0/go.mod h1:AahvXYshr6JgfUJGdDCs2b5EZG/vmaMAntpSFH5BFKE=
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.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
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

@@ -1,213 +0,0 @@
package stdcopy
import (
"bytes"
"encoding/binary"
"errors"
"fmt"
"io"
"sync"
)
// 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
)
var bufPool = &sync.Pool{New: func() any { return bytes.NewBuffer(nil) }}
// stdWriter is wrapper of io.Writer with extra customized info.
type stdWriter struct {
io.Writer
prefix byte
}
// Write sends the buffer to the underlying writer.
// It inserts the prefix header before the buffer,
// so [StdCopy] knows where to multiplex the output.
//
// It implements [io.Writer].
func (w *stdWriter) Write(p []byte) (int, error) {
if w == nil || w.Writer == nil {
return 0, errors.New("writer not instantiated")
}
if p == nil {
return 0, nil
}
header := [stdWriterPrefixLen]byte{stdWriterFdIndex: w.prefix}
binary.BigEndian.PutUint32(header[stdWriterSizeIndex:], uint32(len(p)))
buf := bufPool.Get().(*bytes.Buffer)
buf.Write(header[:])
buf.Write(p)
n, err := w.Writer.Write(buf.Bytes())
n -= stdWriterPrefixLen
if n < 0 {
n = 0
}
buf.Reset()
bufPool.Put(buf)
return n, err
}
// NewStdWriter instantiates a new writer using a custom format to multiplex
// multiple streams to a single writer. All messages written using this writer
// are encapsulated using a custom format, and written to the underlying
// stream "w".
//
// Writers created through NewStdWriter allow for multiple write streams
// (e.g., stdout ([Stdout]) and stderr ([Stderr]) to be multiplexed into a
// single connection. "streamType" indicates the type of stream to encapsulate,
// commonly, [Stdout] or [Stderr]. The [Systemerr] stream can be used to
// include server-side errors in the stream. Information on this stream
// is returned as an error by [StdCopy] and terminates processing the
// stream.
//
// The [Stdin] stream is present for completeness and should generally
// NOT be used. It is output on [Stdout] when reading the stream with
// [StdCopy].
//
// All streams must share the same underlying [io.Writer] to ensure proper
// multiplexing. Each call to NewStdWriter wraps that shared writer with
// a header indicating the target stream.
func NewStdWriter(w io.Writer, streamType StdType) io.Writer {
return &stdWriter{
Writer: w,
prefix: byte(streamType),
}
}
// 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

@@ -1,66 +0,0 @@
package stdcopy_test
import (
"errors"
"fmt"
"io"
"os"
"time"
"github.com/moby/moby/api/pkg/stdcopy"
)
func ExampleNewStdWriter() {
muxReader, muxStream := io.Pipe()
defer func() { _ = muxStream.Close() }()
// Start demuxing before the daemon starts writing.
done := make(chan error, 1)
go func() {
// using os.Stdout for both, otherwise output doesn't show up in the example.
osStdout := os.Stdout
osStderr := os.Stdout
_, err := stdcopy.StdCopy(osStdout, osStderr, muxReader)
done <- err
}()
// daemon writing to stdout, stderr, and systemErr.
stdout := stdcopy.NewStdWriter(muxStream, stdcopy.Stdout)
stderr := stdcopy.NewStdWriter(muxStream, stdcopy.Stderr)
systemErr := stdcopy.NewStdWriter(muxStream, stdcopy.Systemerr)
for range 10 {
_, _ = fmt.Fprintln(stdout, "hello from stdout")
_, _ = fmt.Fprintln(stderr, "hello from stderr")
time.Sleep(50 * time.Millisecond)
}
_, _ = fmt.Fprintln(systemErr, errors.New("something went wrong"))
// Wait for the demuxer to finish.
if err := <-done; err != nil {
fmt.Println(err)
}
// Output:
// hello from stdout
// hello from stderr
// hello from stdout
// hello from stderr
// hello from stdout
// hello from stderr
// hello from stdout
// hello from stderr
// hello from stdout
// hello from stderr
// hello from stdout
// hello from stderr
// hello from stdout
// hello from stderr
// hello from stdout
// hello from stderr
// hello from stdout
// hello from stderr
// hello from stdout
// hello from stderr
// error from daemon in stream: something went wrong
}

View File

@@ -1,247 +0,0 @@
// 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,17 +0,0 @@
# 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

@@ -6,14 +6,14 @@ import (
"strconv"
"github.com/distribution/reference"
"github.com/moby/moby/api/types/build"
"github.com/moby/moby/api/types/events"
"github.com/moby/moby/v2/daemon/builder"
daemonevents "github.com/moby/moby/v2/daemon/events"
buildkit "github.com/moby/moby/v2/daemon/internal/builder-next"
"github.com/moby/moby/v2/daemon/internal/image"
"github.com/moby/moby/v2/daemon/internal/stringid"
"github.com/moby/moby/v2/daemon/server/backend"
"github.com/docker/docker/api/types/backend"
"github.com/docker/docker/api/types/build"
"github.com/docker/docker/api/types/events"
"github.com/docker/docker/builder"
buildkit "github.com/docker/docker/builder/builder-next"
daemonevents "github.com/docker/docker/daemon/events"
"github.com/docker/docker/image"
"github.com/docker/docker/pkg/stringid"
"github.com/pkg/errors"
"google.golang.org/grpc"
)

View File

@@ -6,7 +6,7 @@ import (
"io"
"github.com/distribution/reference"
"github.com/moby/moby/v2/daemon/internal/image"
"github.com/docker/docker/image"
"github.com/pkg/errors"
)

View File

@@ -0,0 +1,15 @@
package httputils
import (
"io"
"github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/network"
)
// ContainerDecoder specifies how
// to translate an io.Reader into
// container configuration.
type ContainerDecoder interface {
DecodeConfig(src io.Reader) (*container.Config, *container.HostConfig, *network.NetworkingConfig, error)
}

View File

@@ -8,7 +8,7 @@ import (
"strings"
"github.com/distribution/reference"
"github.com/moby/moby/v2/errdefs"
"github.com/docker/docker/errdefs"
"github.com/pkg/errors"
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
@@ -91,7 +91,7 @@ func RepoTagReference(repo, tag string) (reference.NamedTagged, error) {
}
if _, isDigested := ref.(reference.Digested); isDigested {
return nil, errors.New("cannot import digest reference")
return nil, fmt.Errorf("cannot import digest reference")
}
if tag != "" {

View File

@@ -8,7 +8,7 @@ import (
"net/http"
"strings"
"github.com/moby/moby/v2/errdefs"
"github.com/docker/docker/errdefs"
"github.com/pkg/errors"
)
@@ -32,7 +32,7 @@ func HijackConnection(w http.ResponseWriter) (io.ReadCloser, io.Writer, error) {
}
// CloseStreams ensures that a list for http streams are properly closed.
func CloseStreams(streams ...any) {
func CloseStreams(streams ...interface{}) {
for _, stream := range streams {
if tcpc, ok := stream.(interface {
CloseWrite() error
@@ -59,7 +59,7 @@ func CheckForJSON(r *http.Request) error {
// ReadJSON validates the request to have the correct content-type, and decodes
// the request's Body into out.
func ReadJSON(r *http.Request, out any) error {
func ReadJSON(r *http.Request, out interface{}) error {
err := CheckForJSON(r)
if err != nil {
return err
@@ -87,7 +87,7 @@ func ReadJSON(r *http.Request, out any) error {
}
// WriteJSON writes the value v to the http response stream as json with standard json encoding.
func WriteJSON(w http.ResponseWriter, code int, v any) error {
func WriteJSON(w http.ResponseWriter, code int, v interface{}) error {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(code)
enc := json.NewEncoder(w)

View File

@@ -8,10 +8,10 @@ import (
"net/url"
"sort"
"github.com/moby/moby/api/pkg/stdcopy"
"github.com/moby/moby/api/types/container"
"github.com/moby/moby/v2/daemon/server/backend"
"github.com/moby/moby/v2/pkg/ioutils"
"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/stdcopy"
)
// rfc3339NanoFixed is time.RFC3339Nano with nanoseconds padded using zeros to

View File

@@ -2,8 +2,8 @@ package server
import (
"github.com/containerd/log"
"github.com/moby/moby/v2/daemon/server/httputils"
"github.com/moby/moby/v2/daemon/server/middleware"
"github.com/docker/docker/api/server/httputils"
"github.com/docker/docker/api/server/middleware"
)
// handlerWithGlobalMiddlewares wraps the handler function for a request with

View File

@@ -9,9 +9,9 @@ import (
"strings"
"github.com/containerd/log"
"github.com/moby/moby/v2/daemon/server/httpstatus"
"github.com/moby/moby/v2/daemon/server/httputils"
"github.com/moby/moby/v2/pkg/ioutils"
"github.com/docker/docker/api/server/httpstatus"
"github.com/docker/docker/api/server/httputils"
"github.com/docker/docker/pkg/ioutils"
"github.com/sirupsen/logrus"
)
@@ -61,7 +61,7 @@ func DebugRequestMiddleware(handler func(ctx context.Context, w http.ResponseWri
return handleWithLogs(ctx, w, r, vars)
}
var postForm map[string]any
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?
@@ -80,15 +80,15 @@ func DebugRequestMiddleware(handler func(ctx context.Context, w http.ResponseWri
}
}
func maskSecretKeys(inp any) {
if arr, ok := inp.([]any); ok {
func maskSecretKeys(inp interface{}) {
if arr, ok := inp.([]interface{}); ok {
for _, f := range arr {
maskSecretKeys(f)
}
return
}
if form, ok := inp.(map[string]any); ok {
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

View File

@@ -10,23 +10,23 @@ import (
func TestMaskSecretKeys(t *testing.T) {
tests := []struct {
doc string
input map[string]any
expected map[string]any
input map[string]interface{}
expected map[string]interface{}
}{
{
doc: "secret/config create and update requests",
input: map[string]any{"Data": "foo", "Name": "name", "Labels": map[string]any{}},
expected: map[string]any{"Data": "*****", "Name": "name", "Labels": map[string]any{}},
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]any{
input: map[string]interface{}{
"password": "pass",
"secret": "secret",
"jointoken": "jointoken",
"unlockkey": "unlockkey",
"signingcakey": "signingcakey",
"other": map[string]any{
"other": map[string]interface{}{
"password": "pass",
"secret": "secret",
"jointoken": "jointoken",
@@ -34,13 +34,13 @@ func TestMaskSecretKeys(t *testing.T) {
"signingcakey": "signingcakey",
},
},
expected: map[string]any{
expected: map[string]interface{}{
"password": "*****",
"secret": "*****",
"jointoken": "*****",
"unlockkey": "*****",
"signingcakey": "*****",
"other": map[string]any{
"other": map[string]interface{}{
"password": "*****",
"secret": "*****",
"jointoken": "*****",
@@ -51,15 +51,15 @@ func TestMaskSecretKeys(t *testing.T) {
},
{
doc: "case insensitive field matching",
input: map[string]any{
input: map[string]interface{}{
"PASSWORD": "pass",
"other": map[string]any{
"other": map[string]interface{}{
"PASSWORD": "pass",
},
},
expected: map[string]any{
expected: map[string]interface{}{
"PASSWORD": "*****",
"other": map[string]any{
"other": map[string]interface{}{
"PASSWORD": "*****",
},
},

View File

@@ -6,10 +6,9 @@ import (
"net/http"
"runtime"
"github.com/moby/moby/api"
"github.com/moby/moby/api/types/versions"
"github.com/moby/moby/v2/daemon/config"
"github.com/moby/moby/v2/daemon/server/httputils"
"github.com/docker/docker/api"
"github.com/docker/docker/api/server/httputils"
"github.com/docker/docker/api/types/versions"
)
// VersionMiddleware is a middleware that
@@ -19,7 +18,7 @@ type VersionMiddleware struct {
// defaultAPIVersion is the default API version provided by the API server,
// specified as "major.minor". It is usually configured to the latest API
// version [config.DefaultAPIVersion] supported by the daemon.
// 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].
@@ -35,11 +34,11 @@ type VersionMiddleware struct {
// 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, config.DefaultAPIVersion) {
return nil, fmt.Errorf("invalid default API version (%s): must be between %s and %s", defaultAPIVersion, api.MinSupportedAPIVersion, config.DefaultAPIVersion)
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, config.DefaultAPIVersion) {
return nil, fmt.Errorf("invalid minimum API version (%s): must be between %s and %s", minAPIVersion, api.MinSupportedAPIVersion, config.DefaultAPIVersion)
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)

View File

@@ -8,9 +8,8 @@ import (
"runtime"
"testing"
"github.com/moby/moby/api"
"github.com/moby/moby/v2/daemon/config"
"github.com/moby/moby/v2/daemon/server/httputils"
"github.com/docker/docker/api"
"github.com/docker/docker/api/server/httputils"
"gotest.tools/v3/assert"
is "gotest.tools/v3/assert/cmp"
)
@@ -21,38 +20,38 @@ func TestNewVersionMiddlewareValidation(t *testing.T) {
}{
{
doc: "defaults",
defaultVersion: config.DefaultAPIVersion,
defaultVersion: api.DefaultVersion,
minVersion: api.MinSupportedAPIVersion,
},
{
doc: "invalid default lower than min",
defaultVersion: api.MinSupportedAPIVersion,
minVersion: config.DefaultAPIVersion,
expectedErr: fmt.Sprintf("invalid API version: the minimum API version (%s) is higher than the default version (%s)", config.DefaultAPIVersion, 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, config.DefaultAPIVersion),
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: config.DefaultAPIVersion,
expectedErr: fmt.Sprintf("invalid default API version (9999.9999): must be between %s and %s", api.MinSupportedAPIVersion, config.DefaultAPIVersion),
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, config.DefaultAPIVersion),
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: config.DefaultAPIVersion,
defaultVersion: api.DefaultVersion,
minVersion: "9999.9999",
expectedErr: fmt.Sprintf("invalid minimum API version (9999.9999): must be between %s and %s", api.MinSupportedAPIVersion, config.DefaultAPIVersion),
expectedErr: fmt.Sprintf("invalid minimum API version (9999.9999): must be between %s and %s", api.MinSupportedAPIVersion, api.DefaultVersion),
},
}
@@ -76,7 +75,7 @@ func TestVersionMiddlewareVersion(t *testing.T) {
return nil
}
m, err := NewVersionMiddleware("1.2.3", config.DefaultAPIVersion, api.MinSupportedAPIVersion)
m, err := NewVersionMiddleware("1.2.3", api.DefaultVersion, api.MinSupportedAPIVersion)
assert.NilError(t, err)
h := m.WrapHandler(handler)
@@ -90,7 +89,7 @@ func TestVersionMiddlewareVersion(t *testing.T) {
errString string
}{
{
expectedVersion: config.DefaultAPIVersion,
expectedVersion: api.DefaultVersion,
},
{
reqVersion: api.MinSupportedAPIVersion,
@@ -102,7 +101,7 @@ func TestVersionMiddlewareVersion(t *testing.T) {
},
{
reqVersion: "9999.9999",
errString: fmt.Sprintf("client version 9999.9999 is too new. Maximum supported API version is %s", config.DefaultAPIVersion),
errString: fmt.Sprintf("client version 9999.9999 is too new. Maximum supported API version is %s", api.DefaultVersion),
},
}
@@ -126,7 +125,7 @@ func TestVersionMiddlewareWithErrorsReturnsHeaders(t *testing.T) {
return nil
}
m, err := NewVersionMiddleware("1.2.3", config.DefaultAPIVersion, api.MinSupportedAPIVersion)
m, err := NewVersionMiddleware("1.2.3", api.DefaultVersion, api.MinSupportedAPIVersion)
assert.NilError(t, err)
h := m.WrapHandler(handler)
@@ -141,6 +140,6 @@ func TestVersionMiddlewareWithErrorsReturnsHeaders(t *testing.T) {
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"), config.DefaultAPIVersion))
assert.Check(t, is.Equal(hdr.Get("Api-Version"), api.DefaultVersion))
assert.Check(t, is.Equal(hdr.Get("Ostype"), runtime.GOOS))
}

View File

@@ -3,8 +3,8 @@ package build
import (
"context"
"github.com/moby/moby/api/types/build"
"github.com/moby/moby/v2/daemon/server/backend"
"github.com/docker/docker/api/types/backend"
"github.com/docker/docker/api/types/build"
)
// Backend abstracts an image builder whose only purpose is to build an image referenced by an imageID.

View File

@@ -3,8 +3,8 @@ package build
import (
"runtime"
"github.com/moby/moby/api/types/build"
"github.com/moby/moby/v2/daemon/server/router"
"github.com/docker/docker/api/server/router"
"github.com/docker/docker/api/types/build"
)
// buildRouter is a router to talk with the build controller

View File

@@ -16,16 +16,16 @@ import (
"syscall"
"github.com/containerd/log"
"github.com/moby/moby/api/pkg/progress"
"github.com/moby/moby/api/pkg/streamformatter"
"github.com/moby/moby/api/types/build"
"github.com/moby/moby/api/types/container"
"github.com/moby/moby/api/types/filters"
"github.com/moby/moby/api/types/registry"
"github.com/moby/moby/api/types/versions"
"github.com/moby/moby/v2/daemon/server/backend"
"github.com/moby/moby/v2/daemon/server/httputils"
"github.com/moby/moby/v2/pkg/ioutils"
"github.com/docker/docker/api/server/httputils"
"github.com/docker/docker/api/types/backend"
"github.com/docker/docker/api/types/build"
"github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/filters"
"github.com/docker/docker/api/types/registry"
"github.com/docker/docker/api/types/versions"
"github.com/docker/docker/pkg/ioutils"
"github.com/docker/docker/pkg/progress"
"github.com/docker/docker/pkg/streamformatter"
"github.com/pkg/errors"
)

View File

@@ -1,6 +1,6 @@
package checkpoint
import "github.com/moby/moby/api/types/checkpoint"
import "github.com/docker/docker/api/types/checkpoint"
// Backend for Checkpoint
type Backend interface {

View File

@@ -1,19 +1,22 @@
package checkpoint
import (
"github.com/moby/moby/v2/daemon/server/router"
"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) router.Router {
func NewRouter(b Backend, decoder httputils.ContainerDecoder) router.Router {
r := &checkpointRouter{
backend: b,
decoder: decoder,
}
r.initRoutes()
return r

View File

@@ -4,8 +4,8 @@ import (
"context"
"net/http"
"github.com/moby/moby/api/types/checkpoint"
"github.com/moby/moby/v2/daemon/server/httputils"
"github.com/docker/docker/api/server/httputils"
"github.com/docker/docker/api/types/checkpoint"
)
func (cr *checkpointRouter) postContainerCheckpoint(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
@@ -38,6 +38,9 @@ func (cr *checkpointRouter) getContainerCheckpoints(ctx context.Context, w http.
if err != nil {
return err
}
if checkpoints == nil {
checkpoints = []checkpoint.Summary{}
}
return httputils.WriteJSON(w, http.StatusOK, checkpoints)
}

View File

@@ -4,12 +4,10 @@ import (
"context"
"io"
"github.com/docker/docker/api/types/backend"
"github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/filters"
"github.com/moby/go-archive"
"github.com/moby/moby/api/types/container"
"github.com/moby/moby/api/types/filters"
containerpkg "github.com/moby/moby/v2/daemon/container"
"github.com/moby/moby/v2/daemon/server/backend"
"github.com/moby/moby/v2/pkg/sysinfo"
)
// execBackend includes functions to implement to provide exec functionality.
@@ -25,7 +23,7 @@ type execBackend interface {
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, allowOverwriteDirWithFile bool, content io.Reader) error
ContainerExtractToDir(name, path string, copyUIDGID, noOverwriteDirNonDir bool, content io.Reader) error
ContainerStatPath(name string, path string) (stat *container.PathStat, err error)
}
@@ -42,7 +40,7 @@ type stateBackend interface {
ContainerStop(ctx context.Context, name string, options container.StopOptions) error
ContainerUnpause(name string) error
ContainerUpdate(name string, hostConfig *container.HostConfig) (container.UpdateResponse, error)
ContainerWait(ctx context.Context, name string, condition container.WaitCondition) (<-chan containerpkg.StateStatus, error)
ContainerWait(ctx context.Context, name string, condition container.WaitCondition) (<-chan container.StateStatus, error)
}
// monitorBackend includes functions to implement to provide containers monitoring functionality.
@@ -69,10 +67,6 @@ type commitBackend interface {
CreateImageFromContainer(ctx context.Context, name string, config *backend.CreateImageConfig) (imageID string, err error)
}
type sysInfoProvider interface {
RawSysInfo() *sysinfo.SysInfo
}
// Backend is all the methods that need to be implemented to provide container specific functionality.
type Backend interface {
commitBackend
@@ -82,5 +76,4 @@ type Backend interface {
monitorBackend
attachBackend
systemBackend
sysInfoProvider
}

View File

@@ -1,17 +1,24 @@
package container
import "github.com/moby/moby/v2/daemon/server/router"
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) router.Router {
func NewRouter(b Backend, decoder httputils.ContainerDecoder, cgroup2 bool) router.Router {
r := &containerRouter{
backend: b,
decoder: decoder,
cgroup2: cgroup2,
}
r.initRoutes()
return r

View File

@@ -12,56 +12,44 @@ import (
"github.com/containerd/log"
"github.com/containerd/platforms"
"github.com/moby/moby/api/types"
"github.com/moby/moby/api/types/container"
"github.com/moby/moby/api/types/filters"
"github.com/moby/moby/api/types/mount"
"github.com/moby/moby/api/types/network"
"github.com/moby/moby/api/types/versions"
"github.com/moby/moby/v2/daemon/internal/runconfig"
"github.com/moby/moby/v2/daemon/libnetwork/netlabel"
networkSettings "github.com/moby/moby/v2/daemon/network"
"github.com/moby/moby/v2/daemon/server/backend"
"github.com/moby/moby/v2/daemon/server/httpstatus"
"github.com/moby/moby/v2/daemon/server/httputils"
"github.com/moby/moby/v2/errdefs"
"github.com/moby/moby/v2/pkg/ioutils"
"github.com/docker/docker/api/server/httpstatus"
"github.com/docker/docker/api/server/httputils"
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/backend"
"github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/filters"
"github.com/docker/docker/api/types/mount"
"github.com/docker/docker/api/types/network"
"github.com/docker/docker/api/types/versions"
networkSettings "github.com/docker/docker/daemon/network"
"github.com/docker/docker/errdefs"
"github.com/docker/docker/libnetwork/netlabel"
"github.com/docker/docker/pkg/ioutils"
"github.com/docker/docker/runconfig"
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/pkg/errors"
"go.opentelemetry.io/otel"
"golang.org/x/net/websocket"
)
// commitRequest may contain an optional [container.Config].
type commitRequest struct {
*container.Config
}
// decodeCommitRequest decodes the request body and returns a [container.Config]
// if present, or nil otherwise. It returns an error when failing to decode
// due to invalid JSON, or if the request contains multiple JSON documents.
//
// The client posts a bare [*container.Config] (see [Client.ContainerCommit]
// and [container.CommitOptions]), but it may be empty / nil, in which case
// it must be ignored, and no overrides to be applied.
//
// [Client.ContainerCommit]: https://github.com/moby/moby/blob/c4afa7715715a1020e50b19ad60728c4479fb0a5/client/container_commit.go#L52
// [container.CommitOptions]: https://github.com/moby/moby/blob/c4afa7715715a1020e50b19ad60728c4479fb0a5/api/types/container/options.go#L30
func decodeCommitRequest(r *http.Request) (*container.Config, error) {
var w commitRequest
if err := httputils.ReadJSON(r, &w); err != nil {
return nil, err
}
return w.Config, nil
}
func (c *containerRouter) postCommit(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
if err := httputils.ParseForm(r); err != nil {
return err
}
config, err := decodeCommitRequest(r)
if err != nil {
if err := httputils.CheckForJSON(r); err != nil {
return err
}
// FIXME(thaJeztah): change this to unmarshal just [container.Config]:
// The commit endpoint accepts a [container.Config], but the decoder uses a
// [container.CreateRequest], which is a superset, and also contains
// [container.HostConfig] and [network.NetworkConfig]. Those structs
// are discarded here, but decoder.DecodeConfig also performs validation,
// so a request containing those additional fields would result in a
// validation error.
config, _, _, err := c.decoder.DecodeConfig(r.Body)
if err != nil && !errors.Is(err, io.EOF) { // Do not fail if body is empty.
return err
}
@@ -131,12 +119,6 @@ func (c *containerRouter) getContainersJSON(ctx context.Context, w http.Response
}
}
if versions.LessThan(version, "1.52") {
for _, c := range containers {
c.Health = nil
}
}
return httputils.WriteJSON(w, http.StatusOK, containers)
}
@@ -497,14 +479,26 @@ func (c *containerRouter) postContainersCreate(ctx context.Context, w http.Respo
name := r.Form.Get("name")
// TODO(thaJeztah): do we prefer [backend.ContainerCreateConfig] here?
req, err := runconfig.DecodeCreateRequest(r.Body, c.backend.RawSysInfo())
config, hostConfig, networkingConfig, err := c.decoder.DecodeConfig(r.Body)
if err != nil {
if errors.Is(err, io.EOF) {
return errdefs.InvalidParameter(errors.New("invalid JSON: got EOF while reading request body"))
}
return err
}
// TODO(thaJeztah): update code below to take [container.CreateRequest] or [backend.ContainerCreateConfig] directly.
config, hostConfig, networkingConfig := req.Config, req.HostConfig, req.NetworkingConfig
if config == nil {
return errdefs.InvalidParameter(runconfig.ErrEmptyConfig)
}
if hostConfig == nil {
hostConfig = &container.HostConfig{}
}
if networkingConfig == nil {
networkingConfig = &network.NetworkingConfig{}
}
if networkingConfig.EndpointsConfig == nil {
networkingConfig.EndpointsConfig = make(map[string]*network.EndpointSettings)
}
// The NetworkMode "default" is used as a way to express a container should
// be attached to the OS-dependant default network, in an OS-independent
// way. Doing this conversion as soon as possible ensures we have less
@@ -537,7 +531,7 @@ func (c *containerRouter) postContainersCreate(ctx context.Context, w http.Respo
}
// Ignore KernelMemoryTCP because it was added in API 1.40.
hostConfig.KernelMemoryTCP = 0
hostConfig.KernelMemoryTCP = 0 //nolint:staticcheck // ignore SA1019 This field is still used for legacy support.
// Older clients (API < 1.40) expects the default to be shareable, make them happy
if hostConfig.IpcMode.IsEmpty() {
@@ -547,7 +541,7 @@ func (c *containerRouter) postContainersCreate(ctx context.Context, w http.Respo
if versions.LessThan(version, "1.41") {
// Older clients expect the default to be "host" on cgroup v1 hosts
if hostConfig.CgroupnsMode.IsEmpty() && !c.backend.RawSysInfo().CgroupUnified {
if !c.cgroup2 && hostConfig.CgroupnsMode.IsEmpty() {
hostConfig.CgroupnsMode = container.CgroupnsModeHost
}
}
@@ -751,7 +745,7 @@ func handleMACAddressBC(config *container.Config, hostConfig *container.HostConf
return "", nil
}
if !hostConfig.NetworkMode.IsBridge() && !hostConfig.NetworkMode.IsUserDefined() {
return "", errdefs.InvalidParameter(errors.New("conflicting options: mac-address and the network mode"))
return "", runconfig.ErrConflictContainerNetworkAndMac
}
epConfig, err := epConfigForNetMode(version, hostConfig.NetworkMode, networkingConfig)

View File

@@ -4,9 +4,9 @@ import (
"strings"
"testing"
"github.com/moby/moby/api/types/container"
"github.com/moby/moby/api/types/network"
"github.com/moby/moby/v2/daemon/libnetwork/netlabel"
"github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/network"
"github.com/docker/docker/libnetwork/netlabel"
"gotest.tools/v3/assert"
is "gotest.tools/v3/assert/cmp"
)

View File

@@ -9,9 +9,9 @@ import (
"io"
"net/http"
"github.com/docker/docker/api/server/httputils"
"github.com/docker/docker/api/types/container"
gddohttputil "github.com/golang/gddo/httputil"
"github.com/moby/moby/api/types/container"
"github.com/moby/moby/v2/daemon/server/httputils"
)
// setContainerPathStatHeader encodes the stat to JSON, base64 encode, and place in a header.
@@ -92,10 +92,8 @@ func (c *containerRouter) putContainersArchive(ctx context.Context, w http.Respo
return err
}
// TODO(thaJeztah): reverse the default: deprecate noOverwriteDirNonDir and add "allowOverwriteDirWithFile" (or similar) argument to opt-in.
allowOverwriteDirWithFile := !r.Form.Has("noOverwriteDirNonDir") || !httputils.BoolValue(r, "noOverwriteDirNonDir")
noOverwriteDirNonDir := httputils.BoolValue(r, "noOverwriteDirNonDir")
copyUIDGID := httputils.BoolValue(r, "copyUIDGID")
return c.backend.ContainerExtractToDir(v.Name, v.Path, copyUIDGID, allowOverwriteDirWithFile, r.Body)
return c.backend.ContainerExtractToDir(v.Name, v.Path, copyUIDGID, noOverwriteDirNonDir, r.Body)
}

View File

@@ -7,13 +7,13 @@ import (
"net/http"
"github.com/containerd/log"
"github.com/moby/moby/api/pkg/stdcopy"
"github.com/moby/moby/api/types"
"github.com/moby/moby/api/types/container"
"github.com/moby/moby/api/types/versions"
"github.com/moby/moby/v2/daemon/server/backend"
"github.com/moby/moby/v2/daemon/server/httputils"
"github.com/moby/moby/v2/errdefs"
"github.com/docker/docker/api/server/httputils"
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/backend"
"github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/versions"
"github.com/docker/docker/errdefs"
"github.com/docker/docker/pkg/stdcopy"
"github.com/pkg/errors"
)

View File

@@ -1,15 +1,18 @@
// FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16:
//go:build go1.23
package container
import (
"context"
"net/http"
"github.com/moby/moby/api/types/container"
"github.com/moby/moby/api/types/versions"
"github.com/moby/moby/v2/daemon/internal/sliceutil"
"github.com/moby/moby/v2/daemon/internal/stringid"
"github.com/moby/moby/v2/daemon/server/backend"
"github.com/moby/moby/v2/daemon/server/httputils"
"github.com/docker/docker/api/server/httputils"
"github.com/docker/docker/api/types/backend"
"github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/versions"
"github.com/docker/docker/internal/sliceutil"
"github.com/docker/docker/pkg/stringid"
)
// getContainersByName inspects container's configuration and serializes it as json.

View File

@@ -6,7 +6,7 @@ import (
"syscall"
"github.com/containerd/log"
"github.com/moby/moby/v2/daemon/internal/unix_noeintr"
"github.com/docker/docker/internal/unix_noeintr"
"golang.org/x/sys/unix"
)

View File

@@ -6,8 +6,8 @@ import (
"net/http"
"net/http/pprof"
"github.com/moby/moby/v2/daemon/server/httputils"
"github.com/moby/moby/v2/daemon/server/router"
"github.com/docker/docker/api/server/httputils"
"github.com/docker/docker/api/server/router"
)
// NewRouter creates a new debug router

View File

@@ -5,7 +5,7 @@ import (
"github.com/distribution/reference"
"github.com/docker/distribution"
"github.com/moby/moby/api/types/registry"
"github.com/docker/docker/api/types/registry"
)
// Backend is all the methods that need to be implemented

View File

@@ -1,6 +1,6 @@
package distribution
import "github.com/moby/moby/v2/daemon/server/router"
import "github.com/docker/docker/api/server/router"
// distributionRouter is a router to talk with the registry
type distributionRouter struct {

View File

@@ -8,11 +8,12 @@ import (
"github.com/distribution/reference"
"github.com/docker/distribution"
"github.com/docker/distribution/manifest/manifestlist"
"github.com/docker/distribution/manifest/schema1"
"github.com/docker/distribution/manifest/schema2"
"github.com/moby/moby/api/types/registry"
distributionpkg "github.com/moby/moby/v2/daemon/internal/distribution"
"github.com/moby/moby/v2/daemon/server/httputils"
"github.com/moby/moby/v2/errdefs"
"github.com/docker/docker/api/server/httputils"
"github.com/docker/docker/api/types/registry"
distributionpkg "github.com/docker/docker/distribution"
"github.com/docker/docker/errdefs"
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/pkg/errors"
)
@@ -64,7 +65,7 @@ func (dr *distributionRouter) getDistributionInfo(ctx context.Context, w http.Re
// - https://github.com/moby/moby/blob/12c7411b6b7314bef130cd59f1c7384a7db06d0b/distribution/pull.go#L76-L152
var lastErr error
for _, repo := range repos {
distributionInspect, err := fetchManifest(ctx, repo, namedRef)
distributionInspect, err := dr.fetchManifest(ctx, repo, namedRef)
if err != nil {
lastErr = err
continue
@@ -74,7 +75,7 @@ func (dr *distributionRouter) getDistributionInfo(ctx context.Context, w http.Re
return lastErr
}
func fetchManifest(ctx context.Context, distrepo distribution.Repository, namedRef reference.Named) (registry.DistributionInspect, error) {
func (dr *distributionRouter) fetchManifest(ctx context.Context, distrepo distribution.Repository, namedRef reference.Named) (registry.DistributionInspect, error) {
var distributionInspect registry.DistributionInspect
if canonicalRef, ok := namedRef.(reference.Canonical); !ok {
namedRef = reference.TagNameOnly(namedRef)
@@ -124,11 +125,6 @@ func fetchManifest(ctx context.Context, distrepo distribution.Repository, namedR
if err != nil {
return registry.DistributionInspect{}, err
}
switch mediaType {
case distributionpkg.MediaTypeDockerSchema1Manifest, distributionpkg.MediaTypeDockerSchema1SignedManifest:
return registry.DistributionInspect{}, distributionpkg.DeprecatedSchema1ImageError(namedRef)
}
// update MediaType because registry might return something incorrect
distributionInspect.Descriptor.MediaType = mediaType
if distributionInspect.Descriptor.Size == 0 {
@@ -157,6 +153,10 @@ func fetchManifest(ctx context.Context, distrepo distribution.Repository, namedR
distributionInspect.Platforms = append(distributionInspect.Platforms, platform)
}
}
// TODO(thaJeztah); we only use this to produce a nice error, but as a result, we can't remove libtrust as dependency - see if we can reduce the dependencies, but still able to detect it's a deprecated manifest
case *schema1.SignedManifest:
return registry.DistributionInspect{}, distributionpkg.DeprecatedSchema1ImageError(namedRef)
}
return distributionInspect, nil
}

View File

@@ -4,7 +4,7 @@ import (
"context"
"net/http"
"github.com/moby/moby/v2/daemon/server/httputils"
"github.com/docker/docker/api/server/httputils"
)
// ExperimentalRoute defines an experimental API route that can be enabled or disabled.

View File

@@ -1,3 +1,6 @@
// FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16:
//go:build go1.23
package grpc
import (
@@ -8,11 +11,11 @@ import (
"github.com/containerd/containerd/v2/defaults"
"github.com/containerd/log"
"github.com/docker/docker/api/server/router"
"github.com/docker/docker/internal/otelutil"
"github.com/moby/buildkit/util/grpcerrors"
"github.com/moby/buildkit/util/stack"
"github.com/moby/buildkit/util/tracing"
"github.com/moby/moby/v2/daemon/internal/otelutil"
"github.com/moby/moby/v2/daemon/server/router"
"go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc"
"golang.org/x/net/http2"
"google.golang.org/grpc"

View File

@@ -5,11 +5,11 @@ import (
"io"
"github.com/distribution/reference"
"github.com/moby/moby/api/types/filters"
"github.com/moby/moby/api/types/image"
"github.com/moby/moby/api/types/registry"
dockerimage "github.com/moby/moby/v2/daemon/internal/image"
"github.com/moby/moby/v2/daemon/server/backend"
"github.com/docker/docker/api/types/backend"
"github.com/docker/docker/api/types/filters"
"github.com/docker/docker/api/types/image"
"github.com/docker/docker/api/types/registry"
dockerimage "github.com/docker/docker/image"
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
)
@@ -32,9 +32,9 @@ type imageBackend interface {
}
type importExportBackend interface {
LoadImage(ctx context.Context, inTar io.ReadCloser, platformList []ocispec.Platform, outStream io.Writer, quiet bool) error
LoadImage(ctx context.Context, inTar io.ReadCloser, platform *ocispec.Platform, outStream io.Writer, quiet bool) error
ImportImage(ctx context.Context, ref reference.Named, platform *ocispec.Platform, msg string, layerReader io.Reader, changes []string) (dockerimage.ID, error)
ExportImage(ctx context.Context, names []string, platformList []ocispec.Platform, outStream io.Writer) error
ExportImage(ctx context.Context, names []string, platform *ocispec.Platform, outStream io.Writer) error
}
type registryBackend interface {

View File

@@ -1,7 +1,7 @@
package image
import (
"github.com/moby/moby/v2/daemon/server/router"
"github.com/docker/docker/api/server/router"
)
// imageRouter is a router to talk with the image controller

View File

@@ -12,19 +12,20 @@ import (
"github.com/containerd/platforms"
"github.com/distribution/reference"
"github.com/moby/moby/api/pkg/progress"
"github.com/moby/moby/api/pkg/streamformatter"
"github.com/moby/moby/api/types/filters"
imagetypes "github.com/moby/moby/api/types/image"
"github.com/moby/moby/api/types/registry"
"github.com/moby/moby/api/types/versions"
"github.com/moby/moby/v2/daemon/builder/remotecontext"
"github.com/moby/moby/v2/daemon/internal/image"
"github.com/moby/moby/v2/daemon/server/backend"
"github.com/moby/moby/v2/daemon/server/httputils"
"github.com/moby/moby/v2/dockerversion"
"github.com/moby/moby/v2/errdefs"
"github.com/moby/moby/v2/pkg/ioutils"
"github.com/docker/docker/api"
"github.com/docker/docker/api/server/httputils"
"github.com/docker/docker/api/types/backend"
"github.com/docker/docker/api/types/filters"
imagetypes "github.com/docker/docker/api/types/image"
"github.com/docker/docker/api/types/registry"
"github.com/docker/docker/api/types/versions"
"github.com/docker/docker/builder/remotecontext"
"github.com/docker/docker/dockerversion"
"github.com/docker/docker/errdefs"
"github.com/docker/docker/image"
"github.com/docker/docker/pkg/ioutils"
"github.com/docker/docker/pkg/progress"
"github.com/docker/docker/pkg/streamformatter"
"github.com/opencontainers/go-digest"
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/pkg/errors"
@@ -166,14 +167,11 @@ func (ir *imageRouter) postImagesPush(ctx context.Context, w http.ResponseWriter
return err
}
var authConfig *registry.AuthConfig
if authEncoded := r.Header.Get(registry.AuthHeader); authEncoded != "" {
// Handle the authConfig as a header, but ignore invalid AuthConfig
// to increase compatibility with the existing API.
//
// TODO(thaJeztah): accept empty values but return an error when failing to decode.
authConfig, _ = registry.DecodeAuthConfig(authEncoded)
}
// Handle the authConfig as a header, but ignore invalid AuthConfig
// to increase compatibility with the existing API.
//
// TODO(thaJeztah): accept empty values but return an error when failing to decode.
authConfig, _ := registry.DecodeAuthConfig(r.Header.Get(registry.AuthHeader))
output := ioutils.NewWriteFlusher(w)
defer output.Close()
@@ -235,7 +233,6 @@ func (ir *imageRouter) getImagesGet(ctx context.Context, w http.ResponseWriter,
output := ioutils.NewWriteFlusher(w)
defer output.Close()
var names []string
if name, ok := vars["name"]; ok {
names = []string{name}
@@ -243,28 +240,27 @@ func (ir *imageRouter) getImagesGet(ctx context.Context, w http.ResponseWriter,
names = r.Form["names"]
}
var platformList []ocispec.Platform
// platform param was introduced in API version 1.48
var platform *ocispec.Platform
if versions.GreaterThanOrEqualTo(httputils.VersionFromContext(ctx), "1.48") {
var err error
formPlatforms := r.Form["platform"]
// multi-platform params were introduced in API version 1.52
if versions.LessThan(httputils.VersionFromContext(ctx), "1.52") && len(formPlatforms) > 1 {
return errdefs.InvalidParameter(errors.New("multiple platform parameters are not supported in this API version; use API version 1.52 or later"))
if formPlatforms := r.Form["platform"]; len(formPlatforms) > 1 {
// TODO(thaJeztah): remove once we support multiple platforms: see https://github.com/moby/moby/issues/48759
return errdefs.InvalidParameter(errors.New("multiple platform parameters not supported"))
}
platformList, err = httputils.DecodePlatforms(formPlatforms)
if err != nil {
return err
if formPlatform := r.Form.Get("platform"); formPlatform != "" {
p, err := httputils.DecodePlatform(formPlatform)
if err != nil {
return err
}
platform = p
}
}
if err := ir.backend.ExportImage(ctx, names, platformList, output); err != nil {
if err := ir.backend.ExportImage(ctx, names, platform, output); err != nil {
if !output.Flushed() {
return err
}
_, _ = output.Write(streamformatter.FormatError(err))
}
return nil
}
@@ -273,18 +269,18 @@ func (ir *imageRouter) postImagesLoad(ctx context.Context, w http.ResponseWriter
return err
}
var platformList []ocispec.Platform
// platform param was introduced in API version 1.48
var platform *ocispec.Platform
if versions.GreaterThanOrEqualTo(httputils.VersionFromContext(ctx), "1.48") {
var err error
formPlatforms := r.Form["platform"]
// multi-platform params were introduced in API version 1.52
if versions.LessThan(httputils.VersionFromContext(ctx), "1.52") && len(formPlatforms) > 1 {
return errdefs.InvalidParameter(errors.New("multiple platform parameters are not supported in this API version; use API version 1.52 or later"))
if formPlatforms := r.Form["platform"]; len(formPlatforms) > 1 {
// TODO(thaJeztah): remove once we support multiple platforms: see https://github.com/moby/moby/issues/48759
return errdefs.InvalidParameter(errors.New("multiple platform parameters not supported"))
}
platformList, err = httputils.DecodePlatforms(formPlatforms)
if err != nil {
return err
if formPlatform := r.Form.Get("platform"); formPlatform != "" {
p, err := httputils.DecodePlatform(formPlatform)
if err != nil {
return err
}
platform = p
}
}
quiet := httputils.BoolValueOrDefault(r, "quiet", true)
@@ -293,8 +289,7 @@ func (ir *imageRouter) postImagesLoad(ctx context.Context, w http.ResponseWriter
output := ioutils.NewWriteFlusher(w)
defer output.Close()
if err := ir.backend.LoadImage(ctx, r.Body, platformList, output, quiet); err != nil {
if err := ir.backend.LoadImage(ctx, r.Body, platform, output, quiet); err != nil {
_, _ = output.Write(streamformatter.FormatError(err))
}
return nil
@@ -322,19 +317,19 @@ func (ir *imageRouter) deleteImages(ctx context.Context, w http.ResponseWriter,
force := httputils.BoolValue(r, "force")
prune := !httputils.BoolValue(r, "noprune")
var p []ocispec.Platform
var platforms []ocispec.Platform
if versions.GreaterThanOrEqualTo(httputils.VersionFromContext(ctx), "1.50") {
val, err := httputils.DecodePlatforms(r.Form["platforms"])
p, err := httputils.DecodePlatforms(r.Form["platforms"])
if err != nil {
return err
}
p = val
platforms = p
}
list, err := ir.backend.ImageDelete(ctx, name, imagetypes.RemoveOptions{
Force: force,
PruneChildren: prune,
Platforms: p,
Platforms: platforms,
})
if err != nil {
return err
@@ -591,14 +586,10 @@ func (ir *imageRouter) postImagesPrune(ctx context.Context, w http.ResponseWrite
return httputils.WriteJSON(w, http.StatusOK, pruneReport)
}
// noBaseImageSpecifier is the symbol used by the FROM
// command to specify that no base image is to be used.
const noBaseImageSpecifier = "scratch"
// validateRepoName validates the name of a repository.
func validateRepoName(name reference.Named) error {
familiarName := reference.FamiliarName(name)
if familiarName == noBaseImageSpecifier {
if familiarName == api.NoBaseImageSpecifier {
return fmt.Errorf("'%s' is a reserved name", familiarName)
}
return nil

View File

@@ -1,10 +1,13 @@
// FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16:
//go:build go1.23
package image
import (
"encoding/json"
"maps"
"github.com/moby/moby/api/types/image"
"github.com/docker/docker/api/types/image"
)
// legacyConfigFields defines legacy image-config fields to include in

View File

@@ -4,8 +4,8 @@ import (
"encoding/json"
"testing"
"github.com/docker/docker/api/types/image"
dockerspec "github.com/moby/docker-image-spec/specs-go/v1"
"github.com/moby/moby/api/types/image"
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
"gotest.tools/v3/assert"
is "gotest.tools/v3/assert/cmp"

View File

@@ -3,7 +3,7 @@ package router
import (
"net/http"
"github.com/moby/moby/v2/daemon/server/httputils"
"github.com/docker/docker/api/server/httputils"
)
// RouteWrapper wraps a route with extra functionality.

View File

@@ -3,9 +3,9 @@ package network
import (
"context"
"github.com/moby/moby/api/types/filters"
"github.com/moby/moby/api/types/network"
"github.com/moby/moby/v2/daemon/server/backend"
"github.com/docker/docker/api/types/backend"
"github.com/docker/docker/api/types/filters"
"github.com/docker/docker/api/types/network"
)
// Backend is all the methods that need to be implemented

View File

@@ -1,7 +1,7 @@
package network
import (
"github.com/moby/moby/v2/daemon/server/router"
"github.com/docker/docker/api/server/router"
)
// networkRouter is a router to talk with the network controller

View File

@@ -6,14 +6,14 @@ import (
"strconv"
"strings"
"github.com/moby/moby/api/types/filters"
"github.com/moby/moby/api/types/network"
"github.com/moby/moby/api/types/versions"
"github.com/moby/moby/v2/daemon/libnetwork"
"github.com/moby/moby/v2/daemon/libnetwork/scope"
"github.com/moby/moby/v2/daemon/server/backend"
"github.com/moby/moby/v2/daemon/server/httputils"
"github.com/moby/moby/v2/errdefs"
"github.com/docker/docker/api/server/httputils"
"github.com/docker/docker/api/types/backend"
"github.com/docker/docker/api/types/filters"
"github.com/docker/docker/api/types/network"
"github.com/docker/docker/api/types/versions"
"github.com/docker/docker/errdefs"
"github.com/docker/docker/libnetwork"
"github.com/docker/docker/libnetwork/scope"
"github.com/pkg/errors"
)

View File

@@ -6,24 +6,24 @@ import (
"net/http"
"github.com/distribution/reference"
"github.com/moby/moby/api/types/filters"
plugintypes "github.com/moby/moby/api/types/plugin"
"github.com/moby/moby/api/types/registry"
"github.com/moby/moby/v2/daemon/pkg/plugin"
"github.com/moby/moby/v2/daemon/server/backend"
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/backend"
"github.com/docker/docker/api/types/filters"
"github.com/docker/docker/api/types/registry"
"github.com/docker/docker/plugin"
)
// Backend for Plugin
type Backend interface {
Disable(name string, config *backend.PluginDisableConfig) error
Enable(name string, config *backend.PluginEnableConfig) error
List(filters.Args) ([]plugintypes.Plugin, error)
Inspect(name string) (*plugintypes.Plugin, error)
List(filters.Args) ([]types.Plugin, error)
Inspect(name string) (*types.Plugin, error)
Remove(name string, config *backend.PluginRmConfig) error
Set(name string, args []string) error
Privileges(ctx context.Context, ref reference.Named, metaHeaders http.Header, authConfig *registry.AuthConfig) (plugintypes.Privileges, error)
Pull(ctx context.Context, ref reference.Named, name string, metaHeaders http.Header, authConfig *registry.AuthConfig, privileges plugintypes.Privileges, outStream io.Writer, opts ...plugin.CreateOpt) error
Privileges(ctx context.Context, ref reference.Named, metaHeaders http.Header, authConfig *registry.AuthConfig) (types.PluginPrivileges, error)
Pull(ctx context.Context, ref reference.Named, name string, metaHeaders http.Header, authConfig *registry.AuthConfig, privileges types.PluginPrivileges, outStream io.Writer, opts ...plugin.CreateOpt) error
Push(ctx context.Context, name string, metaHeaders http.Header, authConfig *registry.AuthConfig, outStream io.Writer) error
Upgrade(ctx context.Context, ref reference.Named, name string, metaHeaders http.Header, authConfig *registry.AuthConfig, privileges plugintypes.Privileges, outStream io.Writer) error
CreateFromContext(ctx context.Context, tarCtx io.ReadCloser, options *backend.PluginCreateConfig) error
Upgrade(ctx context.Context, ref reference.Named, name string, metaHeaders http.Header, authConfig *registry.AuthConfig, privileges types.PluginPrivileges, outStream io.Writer) error
CreateFromContext(ctx context.Context, tarCtx io.ReadCloser, options *types.PluginCreateOptions) error
}

View File

@@ -1,6 +1,6 @@
package plugin
import "github.com/moby/moby/v2/daemon/server/router"
import "github.com/docker/docker/api/server/router"
// pluginRouter is a router to talk with the plugin controller
type pluginRouter struct {

View File

@@ -7,13 +7,13 @@ import (
"strings"
"github.com/distribution/reference"
"github.com/moby/moby/api/pkg/streamformatter"
"github.com/moby/moby/api/types/filters"
"github.com/moby/moby/api/types/plugin"
"github.com/moby/moby/api/types/registry"
"github.com/moby/moby/v2/daemon/server/backend"
"github.com/moby/moby/v2/daemon/server/httputils"
"github.com/moby/moby/v2/pkg/ioutils"
"github.com/docker/docker/api/server/httputils"
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/backend"
"github.com/docker/docker/api/types/filters"
"github.com/docker/docker/api/types/registry"
"github.com/docker/docker/pkg/ioutils"
"github.com/docker/docker/pkg/streamformatter"
"github.com/pkg/errors"
)
@@ -84,7 +84,7 @@ func (pr *pluginRouter) upgradePlugin(ctx context.Context, w http.ResponseWriter
return errors.Wrap(err, "failed to parse form")
}
var privileges plugin.Privileges
var privileges types.PluginPrivileges
if err := httputils.ReadJSON(r, &privileges); err != nil {
return err
}
@@ -119,7 +119,7 @@ func (pr *pluginRouter) pullPlugin(ctx context.Context, w http.ResponseWriter, r
return errors.Wrap(err, "failed to parse form")
}
var privileges plugin.Privileges
var privileges types.PluginPrivileges
if err := httputils.ReadJSON(r, &privileges); err != nil {
return err
}
@@ -186,10 +186,11 @@ func (pr *pluginRouter) createPlugin(ctx context.Context, w http.ResponseWriter,
return err
}
err := pr.backend.CreateFromContext(ctx, r.Body, &backend.PluginCreateConfig{
options := &types.PluginCreateOptions{
RepoName: r.FormValue("name"),
})
if err != nil {
}
if err := pr.backend.CreateFromContext(ctx, r.Body, options); err != nil {
return err
}
// TODO: send progress bar
@@ -202,13 +203,14 @@ func (pr *pluginRouter) enablePlugin(ctx context.Context, w http.ResponseWriter,
return err
}
name := vars["name"]
timeout, err := strconv.Atoi(r.Form.Get("timeout"))
if err != nil {
return err
}
config := &backend.PluginEnableConfig{Timeout: timeout}
name := vars["name"]
return pr.backend.Enable(name, &backend.PluginEnableConfig{Timeout: timeout})
return pr.backend.Enable(name, config)
}
func (pr *pluginRouter) disablePlugin(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
@@ -216,9 +218,12 @@ func (pr *pluginRouter) disablePlugin(ctx context.Context, w http.ResponseWriter
return err
}
return pr.backend.Disable(vars["name"], &backend.PluginDisableConfig{
name := vars["name"]
config := &backend.PluginDisableConfig{
ForceDisable: httputils.BoolValue(r, "force"),
})
}
return pr.backend.Disable(name, config)
}
func (pr *pluginRouter) removePlugin(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
@@ -227,9 +232,10 @@ func (pr *pluginRouter) removePlugin(ctx context.Context, w http.ResponseWriter,
}
name := vars["name"]
return pr.backend.Remove(name, &backend.PluginRmConfig{
config := &backend.PluginRmConfig{
ForceRemove: httputils.BoolValue(r, "force"),
})
}
return pr.backend.Remove(name, config)
}
func (pr *pluginRouter) pushPlugin(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {

View File

@@ -1,6 +1,6 @@
package router
import "github.com/moby/moby/v2/daemon/server/httputils"
import "github.com/docker/docker/api/server/httputils"
// Router defines an interface to specify a group of routes to add to the docker server.
type Router interface {

View File

@@ -1,6 +1,6 @@
package session
import "github.com/moby/moby/v2/daemon/server/router"
import "github.com/docker/docker/api/server/router"
// sessionRouter is a router to talk with the session controller
type sessionRouter struct {

View File

@@ -4,7 +4,7 @@ import (
"context"
"net/http"
"github.com/moby/moby/v2/errdefs"
"github.com/docker/docker/errdefs"
)
func (sr *sessionRouter) startSession(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {

View File

@@ -3,9 +3,9 @@ package swarm
import (
"context"
"github.com/moby/moby/api/types/container"
"github.com/moby/moby/api/types/swarm"
"github.com/moby/moby/v2/daemon/server/backend"
"github.com/docker/docker/api/types/backend"
"github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/swarm"
)
// Backend abstracts a swarm manager.

View File

@@ -1,6 +1,6 @@
package swarm
import "github.com/moby/moby/v2/daemon/server/router"
import "github.com/docker/docker/api/server/router"
// swarmRouter is a router to talk with the build controller
type swarmRouter struct {

View File

@@ -7,13 +7,13 @@ import (
"strconv"
"github.com/containerd/log"
"github.com/moby/moby/api/types/filters"
"github.com/moby/moby/api/types/registry"
types "github.com/moby/moby/api/types/swarm"
"github.com/moby/moby/api/types/versions"
"github.com/moby/moby/v2/daemon/server/backend"
"github.com/moby/moby/v2/daemon/server/httputils"
"github.com/moby/moby/v2/errdefs"
"github.com/docker/docker/api/server/httputils"
"github.com/docker/docker/api/types/backend"
"github.com/docker/docker/api/types/filters"
"github.com/docker/docker/api/types/registry"
types "github.com/docker/docker/api/types/swarm"
"github.com/docker/docker/api/types/versions"
"github.com/docker/docker/errdefs"
"github.com/pkg/errors"
)
@@ -470,7 +470,7 @@ func (sr *swarmRouter) updateSecret(ctx context.Context, w http.ResponseWriter,
rawVersion := r.URL.Query().Get("version")
version, err := strconv.ParseUint(rawVersion, 10, 64)
if err != nil {
return errdefs.InvalidParameter(errors.New("invalid secret version"))
return errdefs.InvalidParameter(fmt.Errorf("invalid secret version"))
}
id := vars["id"]
@@ -542,7 +542,7 @@ func (sr *swarmRouter) updateConfig(ctx context.Context, w http.ResponseWriter,
rawVersion := r.URL.Query().Get("version")
version, err := strconv.ParseUint(rawVersion, 10, 64)
if err != nil {
return errdefs.InvalidParameter(errors.New("invalid config version"))
return errdefs.InvalidParameter(fmt.Errorf("invalid config version"))
}
id := vars["id"]

View File

@@ -2,15 +2,15 @@ package swarm
import (
"context"
"errors"
"fmt"
"net/http"
basictypes "github.com/moby/moby/api/types"
"github.com/moby/moby/api/types/container"
"github.com/moby/moby/api/types/swarm"
"github.com/moby/moby/api/types/versions"
"github.com/moby/moby/v2/daemon/server/backend"
"github.com/moby/moby/v2/daemon/server/httputils"
"github.com/docker/docker/api/server/httputils"
basictypes "github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/backend"
"github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/swarm"
"github.com/docker/docker/api/types/versions"
)
// swarmLogs takes an http response, request, and selector, and writes the logs
@@ -23,7 +23,7 @@ func (sr *swarmRouter) swarmLogs(ctx context.Context, w http.ResponseWriter, r *
// with the appropriate status code.
stdout, stderr := httputils.BoolValue(r, "stdout"), httputils.BoolValue(r, "stderr")
if !stdout && !stderr {
return errors.New("Bad parameters: you must choose at least one stream")
return fmt.Errorf("Bad parameters: you must choose at least one stream")
}
// there is probably a neater way to manufacture the LogsOptions

View File

@@ -4,9 +4,9 @@ import (
"reflect"
"testing"
"github.com/moby/moby/api/types/container"
"github.com/moby/moby/api/types/mount"
"github.com/moby/moby/api/types/swarm"
"github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/mount"
"github.com/docker/docker/api/types/swarm"
)
func TestAdjustForAPIVersion(t *testing.T) {

View File

@@ -4,14 +4,14 @@ import (
"context"
"time"
"github.com/moby/moby/api/types"
"github.com/moby/moby/api/types/build"
"github.com/moby/moby/api/types/events"
"github.com/moby/moby/api/types/filters"
"github.com/moby/moby/api/types/registry"
"github.com/moby/moby/api/types/swarm"
"github.com/moby/moby/api/types/system"
"github.com/moby/moby/v2/daemon/server/backend"
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/backend"
"github.com/docker/docker/api/types/build"
"github.com/docker/docker/api/types/events"
"github.com/docker/docker/api/types/filters"
"github.com/docker/docker/api/types/registry"
"github.com/docker/docker/api/types/swarm"
"github.com/docker/docker/api/types/system"
)
// Backend is the methods that need to be implemented to provide
@@ -20,9 +20,9 @@ type Backend interface {
SystemInfo(context.Context) (*system.Info, error)
SystemVersion(context.Context) (types.Version, error)
SystemDiskUsage(ctx context.Context, opts backend.DiskUsageOptions) (*backend.DiskUsage, error)
SubscribeToEvents(since, until time.Time, ef filters.Args) ([]events.Message, chan any)
UnsubscribeFromEvents(chan any)
AuthenticateToRegistry(ctx context.Context, authConfig *registry.AuthConfig) (string, error)
SubscribeToEvents(since, until time.Time, ef filters.Args) ([]events.Message, chan interface{})
UnsubscribeFromEvents(chan interface{})
AuthenticateToRegistry(ctx context.Context, authConfig *registry.AuthConfig) (string, string, error)
}
// ClusterBackend is all the methods that need to be implemented

Some files were not shown because too many files have changed in this diff Show More