api/types/image: InspectResponse: remove deprecated fields by thaJeztah · Pull Request #51103 · moby/moby (original) (raw)
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.InspectDatatype 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
InspectResposnestruct; 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/moby@4352da7]), but was still returned with a copy of theSizefield. It was deprecated in API v1.43 ([moby/moby@1261fe6]), and removed in API v1.44 ([moby/moby@913b0f5]).ContainerandContainerConfig: both fields were deprecated in API v1.44 ([moby/moby@1602e2f]), and removed in API v1.45 ([moby/moby@03cddc6]).
remove deprecated Container, ContainerConfig, VirtualSize
[moby/moby@4352da7]: moby@4352da7
[moby/moby@1261fe6]: moby@1261fe6
[moby/moby@913b0f5]: moby@913b0f5
[moby/moby@1602e2f]: moby@1602e2f
[moby/moby@03cddc6]: moby@03cddc6
[client.ImageInspect]: https://github.com/moby/moby/blob/f739c61c69a7155362993c2a2a624e838b3893bc/client/image_inspect.go#L14-L64
[docker image inspect]: https://github.com/docker/cli/blob/74e3520724d77e63ef75987cbd0c0cde507ab971/cli/command/image/inspect.go#L59-L81
Signed-off-by: Sebastiaan van Stijn github@gone.nl
…sion
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
Parentfield 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
DockerVersionfield 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/moby@bd8a99b], which was backported to the 28.x release.
This patch:
- Removes the deprecated fields from the
InspectResposnestruct; 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/moby@bd8a99b]: moby@bd8a99b
[client.ImageInspect]: https://github.com/moby/moby/blob/f739c61c69a7155362993c2a2a624e838b3893bc/client/image_inspect.go#L14-L64
[docker image inspect]: https://github.com/docker/cli/blob/74e3520724d77e63ef75987cbd0c0cde507ab971/cli/command/image/inspect.go#L59-L81
Signed-off-by: Sebastiaan van Stijn github@gone.nl
thaJeztah deleted the image_inspect_rm_deprecated branch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
[ Show hidden characters]({{ revealButtonHref }})