浏览代码

Merge pull request #46939 from vvoland/api-deprecate-image-container

api: Deprecate `Container` and `ContainerConfig` for `/images/{id}/json`
Sebastiaan van Stijn 1 年之前
父节点
当前提交
bd70d66a62
共有 4 个文件被更改,包括 14 次插入3 次删除
  1. 2 2
      api/server/router/image/image_routes.go
  2. 6 1
      api/swagger.yaml
  3. 4 0
      api/types/types.go
  4. 2 0
      docs/api/version-history.md

+ 2 - 2
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(),
 		Parent:          img.Parent.String(),
 		Comment:         comment,
 		Comment:         comment,
 		Created:         created,
 		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,
 		DockerVersion:   img.DockerVersion,
 		Author:          img.Author,
 		Author:          img.Author,
 		Config:          img.Config,
 		Config:          img.Config,

+ 6 - 1
api/swagger.yaml

@@ -1744,10 +1744,15 @@ definitions:
           The ID of the container that was used to create the image.
           The ID of the container that was used to create the image.
 
 
           Depending on how the image was created, this field may be empty.
           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"
         type: "string"
-        x-nullable: false
         example: "65974bc86f1770ae4bff79f651ebdbce166ae9aada632ee3fa9af3a264911735"
         example: "65974bc86f1770ae4bff79f651ebdbce166ae9aada632ee3fa9af3a264911735"
       ContainerConfig:
       ContainerConfig:
+        description: |
+          **Deprecated**: this field is kept for backward compatibility, but
+          will be removed in API v1.45.
         $ref: "#/definitions/ContainerConfig"
         $ref: "#/definitions/ContainerConfig"
       DockerVersion:
       DockerVersion:
         description: |
         description: |

+ 4 - 0
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.
 	// 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.
 	// 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
 	Container string
 
 
 	// ContainerConfig is an optional field containing the configuration of the
 	// 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,
 	// Previous versions of Docker builder used this field to store build cache,
 	// and it is not in active use anymore.
 	// 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
 	ContainerConfig *container.Config
 
 
 	// DockerVersion is the version of Docker that was used to build the image.
 	// DockerVersion is the version of Docker that was used to build the image.

+ 2 - 0
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 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`
 * 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`.
   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
 ## v1.43 API changes