Commit Graph

922 Commits

Author SHA1 Message Date
Sebastiaan van Stijn
8991c4e382 Deprecate BridgeNfIptables and BridgeNfIp6tables fields
The netfilter module is now loaded on-demand, and no longer during daemon
startup, making these fields obsolete. These fields are now always `false`
and will be removed in the next relase.

This patch deprecates:

- the `BridgeNfIptables` field in `api/types/system.Info`
- the `BridgeNfIp6tables` field in `api/types/system.Info`
- the `BridgeNFCallIPTablesDisabled` field in `pkg/sysinfo.SysInfo`
- the `BridgeNFCallIP6TablesDisabled` field in `pkg/sysinfo.SysInfo`

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-12-16 22:10:05 +01:00
Sebastiaan van Stijn
1932091e21 remove support for non-distributable artifacts and deprecate API fields and config
Non-distributable artifacts (foreign layers) were introduced in commit
05bd04350b to accommodate Windows images,
for which the EULA did not allow layers to be distributed through registries
other than those hosted by Microsoft. The concept of foreign / non-distributable
layers was adopted by the OCI distribution spec in [oci#233].

These restrictions were relaxed later to allow distributing these images
through non-public registries, for which a configuration was added in the
daemon in 67fdf574d5. In 2022, Microsoft updated
the EULA and [removed these restrictions altogether][1], and the OCI distribution
spec deprecated the  functionality in [oci#965].

In 2023, Microsoft [removed the use of foreign data layers][2] for their images,
making this functionality obsolete.

This patch:

- Deprecates the `--allow-nondistributable-artifacts` daemon flag and corresponding
  `allow-nondistributable-artifacts` field in `daemon.json`. Setting either
  option will no longer take an effect, but a deprecation warning log is added
  to raise awareness about the deprecation. This warning is planned to become
  an error in the next release.
- Deprecates the `RegistryConfig.AllowNondistributableArtifactsCIDRs` and
  `RegistryConfig.AllowNondistributableArtifactsHostnames` fields in the
  `GET /info` API response. For API version v1.48 and lower, the fields are
  still included in the response, but always `null`. In API version v1.49 and
  higher, the field will be omitted entirely.
- Deprecates the `api/types/registry/ServiceConfig.AllowNondistributableArtifactsCIDRs`
  field.
- Deprecates the `api/types/registry/ServiceConfig.AllowNondistributableArtifactsHostnames`
  field.
- Deprecates the `registry.ServiceOptions.AllowNondistributableArtifacts` field.

[oci#233]: https://github.com/opencontainers/image-spec/pull/233
[oci#965]: https://github.com/opencontainers/image-spec/pull/965
[1]: https://techcommunity.microsoft.com/blog/containers/announcing-windows-container-base-image-redistribution-rights-change/3645201
[2]: https://techcommunity.microsoft.com/blog/containers/announcing-removal-of-foreign-layers-from-windows-container-images/3846833

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-12-11 20:29:46 +01:00
Sebastiaan van Stijn
fe2637a05b api/types/network: add godoc for EndpointSettings.GwPriority
This field was introduced in 5b752fab32,
which added documentation in the API documentation (swagger), but did
not document the field in the API go types.

This patch adds documentation, using a variant of the description used
in swagger.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-12-06 22:25:03 +01:00
Albin Kerouanton
5b752fab32 api: add Priority field to EndpointSettings
This new field is used by libnetwork to determine which endpoint
provides the default gateway for a container.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2024-11-28 17:06:26 +01:00
Sebastiaan van Stijn
46a91a947e api/types/filters: reduce uses of non-exported fields in tests
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-11-25 17:09:08 +01:00
Sebastiaan van Stijn
cffee85725 api/types/filters: also test generated JSON
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-11-25 17:07:41 +01:00
Sebastiaan van Stijn
848f11aa7c api/types/filters: rewrite tests with gotest.tools
Use assert.Check() for most cases, instead of failing early.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-11-25 17:07:36 +01:00
Aleksa Sarai
557e4ed83b tests: migrate simple cases to assert.ErrorIs
There were a handful of direct checks against errors.Is that can be
translated to assert.ErrorIs without too much thought. Unfortunately
there are a load of other examples where ErrorIs probably makes sense
but would require testing whether this subtly breaks the test.

These transformations were done by hand.

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
2024-11-22 23:59:21 +11:00
Sebastiaan van Stijn
968213c763 Merge pull request #48902 from thaJeztah/save_load_multiplat
client: support multiple platforms on save and load
2024-11-20 15:24:51 +01:00
Sebastiaan van Stijn
9c9eccfb23 client: support multiple platforms on save and load
We don't yet support this at the API level, so for now it returns
an error when trying to set multiple, but this makes sure that the
client types are already ready for this.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-11-19 15:56:28 +01:00
Paweł Gronowski
44ed3067ca c8d/container/inspect: Return ImageManifestDescriptor
`ImageManifestDescriptor` will contain an OCI descriptor of
platform-specific manifest of the image that was picked when creating
the container.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2024-11-19 13:55:56 +01:00
Paweł Gronowski
d88ab0f3a2 c8d/image/inspect: Return Descriptor
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2024-11-18 13:00:44 +01:00
Sebastiaan van Stijn
cd8d2c56c3 Merge pull request #48861 from vvoland/c8d-list-index
c8d/list: Return `Descriptor`
2024-11-14 21:27:45 +01:00
Paweł Gronowski
b15cd283d8 c8d/list: Return Descriptor
While the endpoint returns a detailed information about its children, it
doesn't actually expose the descriptor of the root OCI index/manifest
list.
This commits adds the target description to the returned JSON.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2024-11-13 15:02:18 +01:00
Sebastiaan van Stijn
f797d70649 api/types/container: remove redundant capturing of loop vars (copyloopvar)
api/types/container/hostconfig_test.go:94:3: The copy of the 'for' variable "tc" can be deleted (Go 1.22+) (copyloopvar)
            tc := tc
            ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-11-12 14:02:17 +01:00
Sebastiaan van Stijn
874ad2fcf0 api/types/filters: remove redundant capturing of loop vars (copyloopvar)
api/types/filters/parse_test.go:543:3: The copy of the 'for' variable "tc" can be deleted (Go 1.22+) (copyloopvar)
            tc := tc
            ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-11-12 14:02:14 +01:00
Sebastiaan van Stijn
b5b077f2ea api/types/network: remove redundant capturing of loop vars (copyloopvar)
api/types/network/endpoint_test.go:84:3: The copy of the 'for' variable "tc" can be deleted (Go 1.22+) (copyloopvar)
            tc := tc
            ^
    api/types/network/endpoint_test.go:166:3: The copy of the 'for' variable "tc" can be deleted (Go 1.22+) (copyloopvar)
            tc := tc
            ^
    api/types/network/ipam_test.go:127:3: The copy of the 'for' variable "tc" can be deleted (Go 1.22+) (copyloopvar)
            tc := tc
            ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-11-12 14:02:13 +01:00
Paweł Gronowski
c0045476b8 all: Remove redundant units alias for go-units
The alias is not needed as the package is already named `units`.
It was also not aliases consistently across the project.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2024-11-07 15:55:16 +01:00
Sebastiaan van Stijn
7d7089247c api/types/filters: GetBoolOrDefault: remove unreachableCode
We already check if

- the key is set (otherwise default)
- a value is set (otherwise default and error)

This check can be simplified to check if they're equal (boolean cannot be both
true and false), or both false (boolean must be either true or false), although
the latter could be considered for a tri-state boolean (but we already do this
through the "not set" case).

We may need some additional checks, for example, currently it ignores invalid
values if the filter contains at least one valid one (e.g. ["true", "bananas"]).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-10-24 23:00:14 +02:00
Sebastiaan van Stijn
3f2e9da010 api/server/router/container: move API adjustments to API
The daemon used to have various implementation to adjust the container-inspect
output for different API versions, which could return different go structs,
and because of that required a function with a `interface{}` output type.

Most of those adjustments have been removed, and we no longer need separate
types for backward compatibility with old API versions.

This patch;

- Removes the Daemon.ContainerInspectCurrent method
- Introduces a backend.ContainerInspectOptions struct
- Updates the Daemon.ContainerInspect method's signature to accept the above
- Moves API-version specific adjustments to api/server/router/container,
  similar to how such adjustments are made for other endpoints.

Note that we should probably change the backend's signature further,
and define separate types for the backend's inspect and the API's
inspect response. Considering that the Backend signatures should be
considered "internal", we can do that in a future change.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-10-15 17:03:03 +02:00
Sebastiaan van Stijn
7fe04c142d vendor: github.com/moby/buildkit v0.17.0-rc1
full diff:

- https://github.com/moby/buildkit/compare/v0.16.0...v0.17.0-rc1
- 91a3fc4684...3f140a1299
- 9b4947da39...701f63a606

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-10-11 18:37:23 +02:00
Sebastiaan van Stijn
ff191c58f7 api: info: deprecate "Commit.Expected" fields
The `Commit` type was introduced in 2790ac68b3,
to assist triaging issues that were reported with an incorrect version of
runc or containerd. At the time, both `runc` and `containerd` were not yet
stable, and had to be built from a specific commit to guarantee compatibility.

We encountered various situations where unexpected (and incompatible) versions
of those binaries were packaged, resulting in hard to trace bug-reports.
For those situations, a "expected" version was set at compile time, to
indicate if the version installed was different from the expected version;

    docker info
    ...
    runc version: a592beb5bc4c4092b1b1bac971afed27687340c5 (expected: 69663f0bd4b60df09991c08812a60108003fa340)

Both `runc` and `containerd` are stable now, and docker 19.03 and up set the
expected version to the actual version since c65f0bd13c
and 23.0 did the same for the `init` binary b585c64e2b,
to prevent the CLI from reporting "unexpected version".

In short; the `Expected` fields no longer serves a real purpose.

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

This patch starts with deprecating the `Expected` field.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-09-12 19:40:12 +02:00
Paweł Gronowski
f143f4ec51 image/save&load: Support Platform parameter
Add `Platform` parameter that allows to select a specific platform to
save/load.

This is a breaking change to the Go client as it changes the signatures
of `ImageLoad` and `ImageSave`.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2024-09-11 19:44:35 +02:00
Paweł Gronowski
ab075ecd10 image/history: Support Platform parameter
Add `Platform` parameter that allows to select a specific platform to
show the history for.

This is a breaking change to the Go client as it changes the signature
of `ImageHistory`.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2024-09-11 19:44:32 +02:00
Nathan Baulch
59eba0ae13 Fix typos
Signed-off-by: Nathan Baulch <nathan.baulch@gmail.com>
2024-09-06 21:53:09 +10:00
Sebastiaan van Stijn
bb899c654a api/types: move RequestPrivilegeFunc to api/types/registry
Move the definition, but mostly keep it for documentation purposes,
to prevent having to import the registry package in all places.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-08-30 14:13:09 +02:00
Sebastiaan van Stijn
005b488506 api/types: fix non-constant format string in call (govet)
api/types/container/hostconfig.go:328:43: printf: non-constant format string in call to fmt.Errorf (govet)
                return &errInvalidParameter{fmt.Errorf(msg)}
                                                       ^
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-08-27 10:41:58 +02:00
Sebastiaan van Stijn
e77e543b58 api/types/registry: fix godoc, and add some doc-links
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-08-13 14:36:55 +02:00
Paweł Gronowski
050afe1e1a api/list: Expose manifests
Add `Manifests` field to `ImageSummary` which exposes all image
manifests (which includes other blobs using the image media type, like
buildkit attestations).

There's also a new `manifests` query field that needs to be set in order
for the response to contain the new information.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2024-08-07 13:48:54 +02:00
Paweł Gronowski
efb3c50799 swagger: Disable ImageSummary model generation
Our version of go-swagger doesn't handle the `omitempty` correctly for
the new field.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2024-08-07 13:48:50 +02:00
Sebastiaan van Stijn
ac145a82fd api/types: NewHijackedResponse: fix typo in GoDoc
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-07-31 22:42:55 +02:00
Rob Murray
d4d8611164 Added API create/inspect option EnableIPv4
Signed-off-by: Rob Murray <rob.murray@docker.com>
2024-07-31 18:38:43 +01:00
Paweł Gronowski
cd11843df8 images: Extract ImageInspect from GetImage
Remove a special `Details` parameter from the `GetImage` options and
extract its behavior to a `ImageInspect` method as it was only used by
the `/images/{name}/json` endpoint (`docker image inspect`).

This makes it easier for the containerd image service to output an image
inspect output without having to use the same data structures as the
graphdrivers.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2024-07-25 20:13:41 +02:00
Sebastiaan van Stijn
fb18966aa5 api/types/container: InspectResponse: keep old name for embedded type
This is a follow-up to 1abc8f6158, which
moved the ContainerJSONBase to api/types/container, but also renamed it
to container.InspectBase. This field is embedded into the InspectResponse
type, which meant that renaming the type also implicitly renamed the
field when creating this type from a struct-literal.

While we're planning to merge these types (which would be a breaking
change for users constructing it through struct-literals), let's keep
it backward-compatible for now (other than deprecating the old names).

We can continue the other changes separately.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-07-03 17:14:03 +02:00
Sebastiaan van Stijn
ef356c53ba api/types: remove deprecated ContainerNode, ContainerJSONBase.Node
It was moved and deprecated in 1fc9236119
(4587688258 for v27.0). This patch removes the
temporary alias and removes the relocated  api/types/container.ContainerNode
as well as the Node field on the api/types/container.Base struct.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-07-02 14:20:38 +02:00
Sebastiaan van Stijn
5b9ed8081b api/types: remove deprecated ImageLoadResponse
It moved to api/types/image.LoadResponse in 6c2934f373.
This patch removes the temporary alias.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-07-02 14:19:56 +02:00
Sebastiaan van Stijn
d3defe9140 api/types: remove deprecated ImageImportSource
It moved to api/types/image.ImportSource in eb675cce71.
This patch removes the temporary alias.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-07-02 14:19:55 +02:00
Sebastiaan van Stijn
6cdb123b6f api/types: remove deprecated ImageSearchOptions
It moved to api/types/registry.SearchOptions in f6cc76ceb9.
This patch removes the temporary alias.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-07-02 14:19:55 +02:00
Sebastiaan van Stijn
67b7b15674 api/types: remove deprecated EventsOptions
It moved to api/types/events.ListOptions in b5f15bc0aa.
This patch removes the temporary alias.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-07-02 14:19:55 +02:00
Sebastiaan van Stijn
3cbc166d2e api/types: remove deprecated container stats types
These types were moved to api/types/container in 0a4277abf4.

This removes the temporary aliases for:

- ThrottlingData
- CPUUsage
- CPUStats
- MemoryStats
- BlkioStatEntry
- BlkioStats
- StorageStats
- NetworkStats
- PidsStats
- Stats
- StatsJSON (moved/renamed to api/types/container.StatsResponse)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-07-02 14:19:55 +02:00
Sebastiaan van Stijn
ec5cede0a2 api/types: remove deprecated ContainerStats
It moved to api/types/container.StatsResponseReader in 17c3269a37.
This patch removes the temporary alias.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-07-02 14:19:55 +02:00
Sebastiaan van Stijn
4ffe497ba4 api/types: remove deprecated CopyToContainerOptions
It moved to api/types/container.CopyToContainerOptions in fd1d8f323b.
This patch removes the temporary alias.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-07-02 14:19:54 +02:00
Sebastiaan van Stijn
345e31ab96 api/types: remove deprecated ContainerPathStat
It moved to api/types/container.PathStat in 47d7c9e31d.
This patch removes the temporary alias.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-07-02 14:19:54 +02:00
Sebastiaan van Stijn
2bceb34717 api/types: remove deprecated ContainersPruneReport
It moved to api/types/container.PruneReport in db2f1acd5d.
This patch removes the temporary alias.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-07-02 14:19:54 +02:00
Sebastiaan van Stijn
0e64c9e93b api/types: remove deprecated ContainerExecInspect
It moved to api/types/container.ExecInspect in 5b27e71521.
This patch removes the temporary alias.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-07-02 14:19:54 +02:00
Sebastiaan van Stijn
6f0caec226 api/types: remove deprecated ExecStartCheck
It's replaced by api/types/container.ExecStartOptions and ExecAttachOptions
in cd76e3e7f8. This patch removes the temporary
alias.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-07-02 14:19:54 +02:00
Sebastiaan van Stijn
13fbd394ee api/types: remove deprecated ExecConfig
It moved to api/types/container.ExecOptions in cd76e3e7f8.
This patch removes the temporary alias.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-07-02 14:19:53 +02:00
Sebastiaan van Stijn
665eef54db api/types: remove deprecated NetworksPruneReport
It moved to api/types/network.PruneReport in e5f9484ab6.
This patch removes the temporary alias.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-07-02 14:19:53 +02:00
Sebastiaan van Stijn
d2256faa0e api/types: remove deprecated NetworkResource
It's replaced by api/types/network.Inspect and api/types/network.Summary in
68bf0e7625. This patch removes the temporary alias.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-07-02 14:19:53 +02:00
Sebastiaan van Stijn
ffdd2de674 api/types: remove deprecated EndpointResource
It moved to api/types/network.EndpointResource in 68bf0e7625.
This patch removes the temporary alias.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-07-02 14:19:53 +02:00