From 1602e2f4f1abc662ac02648353b54f6a4cfe7a6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Gronowski?= Date: Thu, 14 Dec 2023 17:27:41 +0100 Subject: [PATCH] api: Deprecate `Container` and `ContainerConfig` for `/images/{id}/json` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These fields were an implementation detail of the classic image builder and are empty when using buildkit. Signed-off-by: Paweł Gronowski --- api/server/router/image/image_routes.go | 4 ++-- api/swagger.yaml | 7 ++++++- api/types/types.go | 4 ++++ docs/api/version-history.md | 2 ++ 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/api/server/router/image/image_routes.go b/api/server/router/image/image_routes.go index a8eb4a40caf55..7921d49575de4 100644 --- a/api/server/router/image/image_routes.go +++ b/api/server/router/image/image_routes.go @@ -338,8 +338,8 @@ func (ir *imageRouter) toImageInspect(img *image.Image) (*types.ImageInspect, er Parent: img.Parent.String(), Comment: comment, Created: created, - Container: img.Container, - ContainerConfig: &img.ContainerConfig, + Container: img.Container, //nolint:staticcheck // ignore SA1019: field is deprecated, but still set on API < v1.45. + ContainerConfig: &img.ContainerConfig, //nolint:staticcheck // ignore SA1019: field is deprecated, but still set on API < v1.45. DockerVersion: img.DockerVersion, Author: img.Author, Config: img.Config, diff --git a/api/swagger.yaml b/api/swagger.yaml index 2adcc437a09cc..f98143d9eca17 100644 --- a/api/swagger.yaml +++ b/api/swagger.yaml @@ -1744,10 +1744,15 @@ definitions: The ID of the container that was used to create the image. Depending on how the image was created, this field may be empty. + + **Deprecated**: this field is kept for backward compatibility, but + will be removed in API v1.45. type: "string" - x-nullable: false example: "65974bc86f1770ae4bff79f651ebdbce166ae9aada632ee3fa9af3a264911735" ContainerConfig: + description: | + **Deprecated**: this field is kept for backward compatibility, but + will be removed in API v1.45. $ref: "#/definitions/ContainerConfig" DockerVersion: description: | diff --git a/api/types/types.go b/api/types/types.go index a28224c191031..17514b7fa581c 100644 --- a/api/types/types.go +++ b/api/types/types.go @@ -77,6 +77,8 @@ type ImageInspect struct { // Container is the ID of the container that was used to create the image. // // Depending on how the image was created, this field may be empty. + // + // Deprecated: this field is omitted in API v1.45, but kept for backward compatibility. Container string // ContainerConfig is an optional field containing the configuration of the @@ -84,6 +86,8 @@ type ImageInspect struct { // // Previous versions of Docker builder used this field to store build cache, // and it is not in active use anymore. + // + // Deprecated: this field is omitted in API v1.45, but kept for backward compatibility. ContainerConfig *container.Config // DockerVersion is the version of Docker that was used to build the image. diff --git a/docs/api/version-history.md b/docs/api/version-history.md index 66edee1a91d9c..f1a0bc2a64e0c 100644 --- a/docs/api/version-history.md +++ b/docs/api/version-history.md @@ -65,6 +65,8 @@ keywords: "API, Docker, rcli, REST, documentation" The container-wide `MacAddress` field in `Config`, on `POST /containers/create`, is now deprecated. * The field `Networks` in the `POST /services/create` and `POST /services/{id}/update` requests is now deprecated. You should instead use the field `TaskTemplate.Networks`. +* The `Container` and `ContainerConfig` fields in the `GET /images/{name}/json` + response are deprecated and will no longer be included in API v1.45. ## v1.43 API changes