10000 Deprecate non-standard (config) fields in image inspect output by thaJeztah · Pull Request #5142 · docker/cli · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Deprecate non-standard (config) fields in image inspect output #5142

10000
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 12, 2024

Conversation

thaJeztah
Copy link
Member
@thaJeztah thaJeztah commented Jun 11, 2024

The Config field returned by this endpoint (used for "image inspect") returns additional fields that are not part of the image's configuration and not part of the Docker Image Spec and the OCI Image Spec.

These additional fields are included in the response, due to an implementation detail, where the api/types.ImageInspec type used for the response is using the container.Config type.

The container.Config type is a superset of the image config, and while the image's Config is used as a template for containers created from the image, the additional fields are set at runtime (from options passed when creating the container) and not taken from the image Config.

These fields are never set (and always return the default value for the type), but are not omitted in the response when left empty. As these fields were not intended to be part of the image configuration response, they are deprecated, and will be removed from the API.

The following fields are currently included in the API response, but are not part of the underlying image's Config, and deprecated:

  • Hostname
  • Domainname
  • AttachStdin
  • AttachStdout
  • AttachStderr
  • Tty
  • OpenStdin
  • StdinOnce
  • Image
  • NetworkDisabled (already omitted unless set)
  • MacAddress (already omitted unless set)
  • StopTimeout (already omitted unless set)

- What I did

- How I did it

- How to verify it

- Description for the changelog

Deprecate non-standard (config) fields in image inspect output

The `Config` field returned by this endpoint (used for "image inspect") returns
additional fields that are not part of the image's configuration and not part of
the [Docker Image Spec] and the [OCI Image Spec].

These fields are never set (and always return the default value for the type),
but are not omitted in the response when left empty. As these fields were not
intended to be part of the image configuration response, they are deprecated,
and will be removed from the API.

The following fields are currently included in the API response, but
are not part of the underlying image's Config, and deprecated:

- `Hostname`
- `Domainname`
- `AttachStdin`
- `AttachStdout`
- `AttachStderr`
- `Tty`
- `OpenStdin`
- `StdinOnce`
- `Image`
- `NetworkDisabled` (already omitted unless set)
- `MacAddress` (already omitted unless set)
- `StopTimeout` (already omitted unless set)

[Docker image spec]: https://github.com/moby/docker-image-spec/blob/v1.3.1/specs-go/v1/image.go#L19-L32
[OCI Image Spec]: https://github.com/opencontainers/image-spec/blob/v1.1.0/specs-go/v1/config.go#L24-L62

- A picture of a cute animal (not mandatory but encouraged)

The `Config` field returned by this endpoint (used for "image inspect") returns
additional fields that are not part of the image's configuration and not part of
the [Docker Image Spec] and the [OCI Image Spec].

These additional fields are included in the response, due to an
implementation detail, where the [api/types.ImageInspec] type used
for the response is using the [container.Config] type.

The [container.Config] type is a superset of the image config, and while the
image's Config is used as a _template_ for containers created from the image,
the additional fields are set at runtime (from options passed when creating
the container) and not taken from the image Config.

These fields are never set (and always return the default value for the type),
but are not omitted in the response when left empty. As these fields were not
intended to be part of the image configuration response, they are deprecated,
and will be removed from the API.

The following fields are currently included in the API response, but
are not part of the underlying image's Config, and deprecated:

- `Hostname`
- `Domainname`
- `AttachStdin`
- `AttachStdout`
- `AttachStderr`
- `Tty`
- `OpenStdin`
- `StdinOnce`
- `Image`
- `NetworkDisabled` (already omitted unless set)
- `MacAddress` (already omitted unless set)
- `StopTimeout` (already omitted unless set)

[Docker image spec]: https://github.com/moby/docker-image-spec/blob/v1.3.1/specs-go/v1/image.go#L19-L32
[OCI Image Spec]: https://github.com/opencontainers/image-spec/blob/v1.1.0/specs-go/v1/config.go#L24-L62
[api/types.ImageInspec]: https://github.com/moby/moby/blob/v26.1.4/api/types/types.go#L87-L104
[container.Config]: https://github.com/moby/moby/blob/v26.1.4/api/types/container/config.go#L47-L82

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 61.79%. Comparing base (0022fe7) to head (b79d684).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5142      +/-   ##
==========================================
- Coverage   61.82%   61.79%   -0.03%     
==========================================
  Files         298      295       -3     
  Lines       20730    20725       -5     
==========================================
- Hits        12817    12808       -9     
- Misses       7000     7002       +2     
- Partials      913      915       +2     

@thaJeztah
Copy link
Member Author

@dvdksn this LGTY?

@thaJeztah
Copy link
Member Author

Let me bring this one in; but happy to make follow-up changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0