Skip to content

Commit 03cddc6

Browse files
committed
api/image-inspect: Remove Container and ContainerConfig
Don't include these fields starting from API v1.45. Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
1 parent 825635a commit 03cddc6

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

api/server/router/image/image_routes.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,10 @@ func (ir *imageRouter) getImagesByName(ctx context.Context, w http.ResponseWrite
306306
imageInspect.Created = time.Time{}.Format(time.RFC3339Nano)
307307
}
308308
}
309+
if versions.GreaterThanOrEqualTo(version, "1.45") {
310+
imageInspect.Container = "" //nolint:staticcheck // ignore SA1019: field is deprecated, but still set on API < v1.45.
311+
imageInspect.ContainerConfig = nil //nolint:staticcheck // ignore SA1019: field is deprecated, but still set on API < v1.45.
312+
}
309313
return httputils.WriteJSON(w, http.StatusOK, imageInspect)
310314
}
311315

api/types/types.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ type ImageInspect struct {
8282
// Depending on how the image was created, this field may be empty.
8383
//
8484
// Deprecated: this field is omitted in API v1.45, but kept for backward compatibility.
85-
Container string
85+
Container string `json:",omitempty"`
8686

8787
// ContainerConfig is an optional field containing the configuration of the
8888
// container that was last committed when creating the image.
@@ -91,7 +91,7 @@ type ImageInspect struct {
9191
// and it is not in active use anymore.
9292
//
9393
// Deprecated: this field is omitted in API v1.45, but kept for backward compatibility.
94-
ContainerConfig *container.Config
94+
ContainerConfig *container.Config `json:",omitempty"`
9595

9696
// DockerVersion is the version of Docker that was used to build the image.
9797
//

docs/api/version-history.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ keywords: "API, Docker, rcli, REST, documentation"
2222
* `POST /images/search` will always assume a `false` value for the `is-automated`
2323
field. Consequently, searching for `is-automated=true` will yield no results,
2424
while `is-automated=false` will be a no-op.
25+
* `GET /images/{name}/json` no longer includes the `Container` and
26+
`ContainerConfig` fields. To access image configuration, use `Config` field
27+
instead.
2528

2629
## v1.44 API changes
2730

0 commit comments

Comments
 (0)