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]: https://github.com/docker/cli/commit/4d8e45782b4749804c8d4cb5067a64dafccef15f
[cli@fd22746]: https://github.com/docker/cli/commit/fd2274692fd0cedf57973061cc0b74af37160a21
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
| ... | ... |
@@ -68,6 +68,12 @@ keywords: "API, Docker, rcli, REST, documentation" |
| 68 | 68 |
in the next API version. |
| 69 | 69 |
* Deprecated: The field `KernelMemoryTCP` as part of `GET /info` is deprecated |
| 70 | 70 |
and will be removed in the next API version. |
| 71 |
+* Deprecated: the `Parent` and `DockerVersion` fields returned by the |
|
| 72 |
+ `GET /images/{name}/json` endpoint are deprecated. These fields are set by
|
|
| 73 |
+ the legacy builder, and are no longer set when using BuildKit. The API |
|
| 74 |
+ continues returning these fields when set for informational purposes, but |
|
| 75 |
+ they should not be depended on as they will be omitted once the legacy builder |
|
| 76 |
+ is removed. |
|
| 71 | 77 |
|
| 72 | 78 |
## v1.50 API changes |
| 73 | 79 |
|
| ... | ... |
@@ -1938,6 +1938,11 @@ definitions: |
| 1938 | 1938 |
Depending on how the image was created, this field may be empty and |
| 1939 | 1939 |
is only set for images that were built/created locally. This field |
| 1940 | 1940 |
is empty if the image was pulled from an image registry. |
| 1941 |
+ |
|
| 1942 |
+ > **Deprecated**: This field is only set when using the deprecated |
|
| 1943 |
+ > legacy builder. It is included in API responses for informational |
|
| 1944 |
+ > purposes, but should not be depended on as it will be omitted |
|
| 1945 |
+ > once the legacy builder is removed. |
|
| 1941 | 1946 |
type: "string" |
| 1942 | 1947 |
x-nullable: false |
| 1943 | 1948 |
example: "" |
| ... | ... |
@@ -1963,6 +1968,11 @@ definitions: |
| 1963 | 1963 |
The version of Docker that was used to build the image. |
| 1964 | 1964 |
|
| 1965 | 1965 |
Depending on how the image was created, this field may be empty. |
| 1966 |
+ |
|
| 1967 |
+ > **Deprecated**: This field is only set when using the deprecated |
|
| 1968 |
+ > legacy builder. It is included in API responses for informational |
|
| 1969 |
+ > purposes, but should not be depended on as it will be omitted |
|
| 1970 |
+ > once the legacy builder is removed. |
|
| 1966 | 1971 |
type: "string" |
| 1967 | 1972 |
x-nullable: false |
| 1968 | 1973 |
example: "27.0.1" |
| ... | ... |
@@ -1838,6 +1838,11 @@ definitions: |
| 1838 | 1838 |
Depending on how the image was created, this field may be empty and |
| 1839 | 1839 |
is only set for images that were built/created locally. This field |
| 1840 | 1840 |
is empty if the image was pulled from an image registry. |
| 1841 |
+ |
|
| 1842 |
+ > **Deprecated**: This field is only set when using the deprecated |
|
| 1843 |
+ > legacy builder. It is included in API responses for informational |
|
| 1844 |
+ > purposes, but should not be depended on as it will be omitted |
|
| 1845 |
+ > once the legacy builder is removed. |
|
| 1841 | 1846 |
type: "string" |
| 1842 | 1847 |
x-nullable: true |
| 1843 | 1848 |
example: "" |
| ... | ... |
@@ -1863,6 +1868,11 @@ definitions: |
| 1863 | 1863 |
The version of Docker that was used to build the image. |
| 1864 | 1864 |
|
| 1865 | 1865 |
Depending on how the image was created, this field may be empty. |
| 1866 |
+ |
|
| 1867 |
+ > **Deprecated**: This field is only set when using the deprecated |
|
| 1868 |
+ > legacy builder. It is included in API responses for informational |
|
| 1869 |
+ > purposes, but should not be depended on as it will be omitted |
|
| 1870 |
+ > once the legacy builder is removed. |
|
| 1866 | 1871 |
type: "string" |
| 1867 | 1872 |
x-nullable: true |
| 1868 | 1873 |
example: "27.0.1" |
| ... | ... |
@@ -1838,6 +1838,11 @@ definitions: |
| 1838 | 1838 |
Depending on how the image was created, this field may be empty and |
| 1839 | 1839 |
is only set for images that were built/created locally. This field |
| 1840 | 1840 |
is empty if the image was pulled from an image registry. |
| 1841 |
+ |
|
| 1842 |
+ > **Deprecated**: This field is only set when using the deprecated |
|
| 1843 |
+ > legacy builder. It is included in API responses for informational |
|
| 1844 |
+ > purposes, but should not be depended on as it will be omitted |
|
| 1845 |
+ > once the legacy builder is removed. |
|
| 1841 | 1846 |
type: "string" |
| 1842 | 1847 |
x-nullable: true |
| 1843 | 1848 |
example: "" |
| ... | ... |
@@ -1863,6 +1868,11 @@ definitions: |
| 1863 | 1863 |
The version of Docker that was used to build the image. |
| 1864 | 1864 |
|
| 1865 | 1865 |
Depending on how the image was created, this field may be empty. |
| 1866 |
+ |
|
| 1867 |
+ > **Deprecated**: This field is only set when using the deprecated |
|
| 1868 |
+ > legacy builder. It is included in API responses for informational |
|
| 1869 |
+ > purposes, but should not be depended on as it will be omitted |
|
| 1870 |
+ > once the legacy builder is removed. |
|
| 1866 | 1871 |
type: "string" |
| 1867 | 1872 |
x-nullable: true |
| 1868 | 1873 |
example: "27.0.1" |
| ... | ... |
@@ -48,6 +48,8 @@ type InspectResponse struct {
|
| 48 | 48 |
// Depending on how the image was created, this field may be empty and |
| 49 | 49 |
// is only set for images that were built/created locally. This field |
| 50 | 50 |
// is omitted if the image was pulled from an image registry. |
| 51 |
+ // |
|
| 52 |
+ // Deprecated: this field is deprecated, and will be removed in the next release. |
|
| 51 | 53 |
Parent string `json:",omitempty"` |
| 52 | 54 |
|
| 53 | 55 |
// Comment is an optional message that can be set when committing or |
| ... | ... |
@@ -80,6 +82,8 @@ type InspectResponse struct {
|
| 80 | 80 |
// DockerVersion is the version of Docker that was used to build the image. |
| 81 | 81 |
// |
| 82 | 82 |
// Depending on how the image was created, this field may be omitted. |
| 83 |
+ // |
|
| 84 |
+ // Deprecated: this field is deprecated, and will be removed in the next release. |
|
| 83 | 85 |
DockerVersion string `json:",omitempty"` |
| 84 | 86 |
|
| 85 | 87 |
// Author is the name of the author that was specified when committing the |
| ... | ... |
@@ -86,14 +86,13 @@ func (i *ImageService) ImageInspect(ctx context.Context, refOrID string, opts ba |
| 86 | 86 |
} |
| 87 | 87 |
|
| 88 | 88 |
resp := &imagetypes.InspectResponse{
|
| 89 |
- ID: target.Digest.String(), |
|
| 90 |
- RepoTags: repoTags, |
|
| 91 |
- Descriptor: &target, |
|
| 92 |
- RepoDigests: repoDigests, |
|
| 93 |
- Parent: parent, |
|
| 94 |
- DockerVersion: "", |
|
| 95 |
- Size: size, |
|
| 96 |
- Manifests: manifests, |
|
| 89 |
+ ID: target.Digest.String(), |
|
| 90 |
+ RepoTags: repoTags, |
|
| 91 |
+ Descriptor: &target, |
|
| 92 |
+ RepoDigests: repoDigests, |
|
| 93 |
+ Parent: parent, //nolint:staticcheck // ignore SA1019: field is deprecated, but still included in response when present. |
|
| 94 |
+ Size: size, |
|
| 95 |
+ Manifests: manifests, |
|
| 97 | 96 |
Metadata: imagetypes.Metadata{
|
| 98 | 97 |
LastTagTime: lastUpdated, |
| 99 | 98 |
}, |
| ... | ... |
@@ -58,12 +58,12 @@ func (i *ImageService) ImageInspect(ctx context.Context, refOrID string, opts ba |
| 58 | 58 |
ID: img.ID().String(), |
| 59 | 59 |
RepoTags: repoTags, |
| 60 | 60 |
RepoDigests: repoDigests, |
| 61 |
- Parent: img.Parent.String(), |
|
| 61 |
+ Parent: img.Parent.String(), //nolint:staticcheck // ignore SA1019: field is deprecated, but still included in response when present (built with legacy builder). |
|
| 62 | 62 |
Comment: comment, |
| 63 | 63 |
Created: created, |
| 64 | 64 |
Container: img.Container, //nolint:staticcheck // ignore SA1019: field is deprecated, but still set on API < v1.45. |
| 65 | 65 |
ContainerConfig: &img.ContainerConfig, //nolint:staticcheck // ignore SA1019: field is deprecated, but still set on API < v1.45. |
| 66 |
- DockerVersion: img.DockerVersion, |
|
| 66 |
+ DockerVersion: img.DockerVersion, //nolint:staticcheck // ignore SA1019: field is deprecated, but still included in response when present. |
|
| 67 | 67 |
Author: img.Author, |
| 68 | 68 |
Config: &imgConfig, |
| 69 | 69 |
Architecture: img.Architecture, |
| ... | ... |
@@ -421,9 +421,9 @@ func (ir *imageRouter) getImagesByName(ctx context.Context, w http.ResponseWrite |
| 421 | 421 |
// These fields have "omitempty" on API v1.52 and higher, |
| 422 | 422 |
// but older API versions returned them unconditionally. |
| 423 | 423 |
legacyOptions = append(legacyOptions, compat.WithExtraFields(map[string]any{
|
| 424 |
- "Parent": imageInspect.Parent, |
|
| 424 |
+ "Parent": imageInspect.Parent, //nolint:staticcheck // ignore SA1019: field is deprecated, but still included in response when present (built with legacy builder). |
|
| 425 | 425 |
"Comment": imageInspect.Comment, |
| 426 |
- "DockerVersion": imageInspect.DockerVersion, |
|
| 426 |
+ "DockerVersion": imageInspect.DockerVersion, //nolint:staticcheck // ignore SA1019: field is deprecated, but still included in response when present. |
|
| 427 | 427 |
"Author": imageInspect.Author, |
| 428 | 428 |
})) |
| 429 | 429 |
if versions.LessThan(version, "1.50") {
|
| ... | ... |
@@ -313,16 +313,16 @@ func (s *DockerAPISuite) TestBuildOnBuildCache(c *testing.T) {
|
| 313 | 313 |
assert.Assert(c, is.Len(imageIDs, 2)) |
| 314 | 314 |
parentID, childID := imageIDs[0], imageIDs[1] |
| 315 | 315 |
|
| 316 |
- client := testEnv.APIClient() |
|
| 316 |
+ apiClient := testEnv.APIClient() |
|
| 317 | 317 |
ctx := testutil.GetContext(c) |
| 318 | 318 |
|
| 319 | 319 |
// check parentID is correct |
| 320 | 320 |
// Parent is graphdriver-only |
| 321 | 321 |
if !testEnv.UsingSnapshotter() {
|
| 322 |
- image, err := client.ImageInspect(ctx, childID) |
|
| 322 |
+ image, err := apiClient.ImageInspect(ctx, childID) |
|
| 323 | 323 |
assert.NilError(c, err) |
| 324 | 324 |
|
| 325 |
- assert.Check(c, is.Equal(parentID, image.Parent)) |
|
| 325 |
+ assert.Check(c, is.Equal(parentID, image.Parent)) //nolint:staticcheck // ignore SA1019: field is deprecated, but still included in response when present. |
|
| 326 | 326 |
} |
| 327 | 327 |
} |
| 328 | 328 |
|
| ... | ... |
@@ -48,6 +48,8 @@ type InspectResponse struct {
|
| 48 | 48 |
// Depending on how the image was created, this field may be empty and |
| 49 | 49 |
// is only set for images that were built/created locally. This field |
| 50 | 50 |
// is omitted if the image was pulled from an image registry. |
| 51 |
+ // |
|
| 52 |
+ // Deprecated: this field is deprecated, and will be removed in the next release. |
|
| 51 | 53 |
Parent string `json:",omitempty"` |
| 52 | 54 |
|
| 53 | 55 |
// Comment is an optional message that can be set when committing or |
| ... | ... |
@@ -80,6 +82,8 @@ type InspectResponse struct {
|
| 80 | 80 |
// DockerVersion is the version of Docker that was used to build the image. |
| 81 | 81 |
// |
| 82 | 82 |
// Depending on how the image was created, this field may be omitted. |
| 83 |
+ // |
|
| 84 |
+ // Deprecated: this field is deprecated, and will be removed in the next release. |
|
| 83 | 85 |
DockerVersion string `json:",omitempty"` |
| 84 | 86 |
|
| 85 | 87 |
// Author is the name of the author that was specified when committing the |