Commit Graph

4492 Commits

Author SHA1 Message Date
Paweł Gronowski
ee49bbabb3 Merge pull request #51261 from thaJeztah/fix_api_godoc
api/types: fix godoc
2025-10-22 13:35:09 +02:00
Sebastiaan van Stijn
f09ca78b45 api/types: fix godoc
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-22 12:09:04 +02:00
Sebastiaan van Stijn
8dc5d1e64d api/types: move Ping and swarm.Status to client
The API does not produce these as a response; the fields in the Ping
struct, including the Swarm status are propagated from headers returned
by the /_ping endpoint.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-22 11:05:08 +02:00
Sebastiaan van Stijn
a8950e0192 api/types/container: remove deprecated Config.MacAddress
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-21 09:15:26 +02:00
Austin Vazquez
42ba5466c7 api: rename volumes.CreateOptions to volumes.CreateRequest
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-20 13:23:41 -05:00
Sebastiaan van Stijn
5061d0a74d api/types/swarm: remove deprecated ServiceSpec.Networks field
This field was deprecated in [engine-api@5c4b684], which got vendored into
Moby in [moby@8f7a8c7] (API v1.25), and wired up in [moby@99a98cc].

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

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-17 22:20:00 +02:00
Austin Vazquez
aa36c44ef9 api/types/volume: move UpdateOptions to client.VolumeUpdateOptions
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-16 16:07:28 -05:00
Sebastiaan van Stijn
44beb53e63 Merge pull request #51203 from thaJeztah/move_macaddress_operational
api/types/network: EndpointSettings: make MacAddress "operational data"
2025-10-16 23:01:46 +02:00
Sebastiaan van Stijn
9720ee037d Merge pull request #51190 from thaJeztah/remove_virtualsize
api/types/image: remove deprecated Summary.VirtualSize field
2025-10-16 21:43:19 +02:00
Sebastiaan van Stijn
9635f04e91 Merge pull request #51196 from austinvazquez/remove-image-inspect-parent-from-swagger
api: remove image inspect `Parent`, `DockerVersion` from swagger docs
2025-10-16 21:38:31 +02:00
Sebastiaan van Stijn
709336a2c3 api/types/network: EndpointSettings: make MacAddress "operational data"
The MacAddress field currently reflects _either_ the user-specified
(DesiredMacAddress) _or_ the actual / assigned MacAddress (when running).

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

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

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-16 20:43:39 +02:00
Sebastiaan van Stijn
40715adc99 Merge pull request #51189 from austinvazquez/stop-support-for-container-config-mac-address
api/types/container: remove support for config mac address
2025-10-15 20:53:26 +02:00
Austin Vazquez
3b075a79b9 api: remove image inspect Parent, DockerVersion from swagger docs
Follow-up to f8d3c4e4a7,
this change removes the `Parent` and `DockerVersion` fields from the swagger documentation.

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

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

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-15 01:49:57 +02:00
Austin Vazquez
2537eae6f3 api/types/container: remove support for config mac address
This change stops daemon support for the container config MacAddress field.

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

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

[moby@e0db820]: e0db8207f3

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-14 14:51:31 +02:00
Sebastiaan van Stijn
9c39c3e158 Merge pull request #51179 from thaJeztah/fix_buildcache_parent_docs
api/docs: remove BuildCache.Parent field for API v1.42 and up
2025-10-14 14:16:48 +02:00
Sebastiaan van Stijn
45caa74e3b api/types/sytem: remove deprecated DiskUsage.BuilderSize
The `DiskUsage.BuilderSize` field was added as part of the, then experimental,
BuildKit builder in [moby@5c3d2d5] (API v1.31). It was deprecated in API v1.32
(through [moby@b225258]) but that change still returned the field. Commit
[moby@31348af] removed it in API v1.42. This field was never documented,
and part of an experimental feature, so we can remove it altogether.

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

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

This patch corrects the swagger files to match this.

[moby@e0db820]: e0db8207f3

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-14 11:19:46 +02:00
Sebastiaan van Stijn
39cf847787 api: regenerate with go-swagger v0.33.1
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-11 19:59:25 +02:00
Sebastiaan van Stijn
bbdd24d145 api/templates: align with go-swagger v1.32.3
Align our custom templates with the one from upstream;
https://github.com/go-swagger/go-swagger/tree/v0.32.3/generator/templates

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

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-11 12:23:10 +02:00
Sebastiaan van Stijn
4d3da4f2ec Merge pull request #51154 from austinvazquez/add-omits-for-container-config-onbuild
api/types/container: omit `Config.OnBuild` when empty
2025-10-10 19:54:23 +02:00
Sebastiaan van Stijn
0769fe7087 Merge pull request #51157 from corhere/split-stdcopy
api/pkg/stdcopy: move stdWriter to daemon/internal
2025-10-10 17:33:43 +02:00
Austin Vazquez
ac3960a44c api/types/container: omit Config.OnBuild when empty
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-10 08:25:27 -05:00
Cory Snider
4c6e571d38 api/pkg/stdcopy: move stdWriter to daemon/internal
Clients have no need for muxing streams using our StdCopy wire format.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-10-09 20:13:26 -04:00
Austin Vazquez
8cf0529a8c api/types/swarm: add documentation to clarify virtual IP address type
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-09 18:02:43 -05:00
Austin Vazquez
c2812dc285 api: fix swarm network field from addr to prefix
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-09 12:02:57 -05:00
Cory Snider
7ea066c8d1 client: add Filters type
Add a new type to use for building filter predicates for API requests,
replacing "./api/types/filters".Args in the client. Remove the now
unused api/types/filters package.

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

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-10-08 12:06:26 -04:00
Sebastiaan van Stijn
77ca284d28 Merge pull request #51103 from thaJeztah/image_inspect_rm_deprecated
api/types/image: InspectResponse: remove deprecated fields
2025-10-08 13:06:09 +02:00
Sebastiaan van Stijn
b1e20b6a3a api/types/system: remove deprecated Commit.Expected field
This field was deprecated API v1.48 in [moby@ff191c5], and removed in
API v1.49 in [moby@564abf9].

This patch:

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

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

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

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

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

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

This patch:

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

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

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

This patch:

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

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

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

remove deprecated Container, ContainerConfig, VirtualSize

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

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-07 13:31:15 +02:00
Sebastiaan van Stijn
c4fda95bea api/types/plugin: deprecate Config.DockerVersion field
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-06 14:19:53 +02:00
Sebastiaan van Stijn
8ddcbbd612 Merge pull request #51094 from austinvazquez/consolidate-api-port-types
Consolidate api port types
2025-10-06 12:35:15 +02:00
Sebastiaan van Stijn
bd8a99b400 api/types/image: InspectResponse: deprecate Parent, DockerVersion
The image inspect response has various fields that were deprecated as
part of the legacy builder, or Dockerfile syntax;

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

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

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

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

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

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

With this patch:

On API v1.52

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

On API v1.51 or lower:

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

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-04 00:30:40 +02:00
Sebastiaan van Stijn
f289cb2d7c api: docs: sync v1.52 yaml
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-03 23:53:46 +02:00
Sebastiaan van Stijn
73bacc61b3 Merge pull request #50953 from ndeloof/ndjson
fix content-type declared by /events API
2025-10-03 23:50:58 +02:00
Cory Snider
d6899ca5a5 api/types/registry: use netip types as appropriate
Signed-off-by: Cory Snider <csnider@mirantis.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-03 21:41:21 +02:00
Cory Snider
fd4329a620 api/types/container: use netip types as appropriate
Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-10-03 21:39:14 +02:00
Cory Snider
a90adb6dc1 api/types/network: use netip types as appropriate
And generate the ServiceInfo struct from the Swagger spec.

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

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

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

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-10-03 21:39:13 +02:00