Skip to content

Conversation

thaJeztah
Copy link
Member

The Image.Config field currently reuses the ContainerConfig definition, matching the Go implementation, which also uses that type.

However, the ContainerConfig type contains various fields that are not part of the image config, and would never be set. The Image.Config is used as template / default values for containers started from the image, but will only use the fields that are part of the Docker image spec.

This patch updates the swagger files used in the documentation to use a separate ImageConfig definition for the Image.Config field. The new definition is a copy of the existing ContainerConfig type, but with updated descriptions for fields, and with an example response that omits the fields that should not be used.

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

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

- Description for the changelog

docs: update API documentation for Image.Config field to better describe fields that are not used.

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

Copy link
Contributor

@dvdksn dvdksn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can remove the <p><br /></p> linebreaks, they don't really do much for the rendered version

image

@thaJeztah
Copy link
Member Author

I think we can remove the <p><br /></p> linebreaks, they don't really do much for the rendered version

Interesting; perhaps difference between browsers; for me without the (ugly!) <p><br /></p> there was no spacing whatsoever between the text and the note;

With:

Screenshot 2024-06-10 at 14 44 26

Without:

Screenshot 2024-06-10 at 14 45 27

The Image.Config field currently reuses the ContainerConfig definition,
matching the Go implementation, which also uses that type.

However, the ContainerConfig type contains various fields that are not
part of the image config, and would never be set. The Image.Config is
used as template / default values for containers started from the image,
but will only use the fields that are part of the [Docker image spec].

This patch updates the swagger files used in the documentation to use a
separate `ImageConfig` definition for the Image.Config field. The new
definition is a copy of the existing `ContainerConfig` type, but with
updated descriptions for fields, and with an example response that omits
the fields that should not be used.

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

- `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

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
The Image.Config field currently reuses the ContainerConfig definition,
matching the Go implementation, which also uses that type.

However, the ContainerConfig type contains various fields that are not
part of the image config, and would never be set. The Image.Config is
used as template / default values for containers started from the image,
but will only use the fields that are part of the [Docker image spec].

This patch updates the swagger files used in the documentation to use a
separate `ImageConfig` definition for the Image.Config field. The new
definition is a copy of the existing `ContainerConfig` type, but with
updated descriptions for fields, and with an example response that omits
the fields that should not be used.

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

- `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

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@thaJeztah thaJeztah force-pushed the api_swagger_update_image_config branch from 052cc3d to 58641c7 Compare June 10, 2024 13:38
@thaJeztah
Copy link
Member Author

@dvdksn updated; applied your suggestions, but I kept the <p><br /></p> for now 🙈 (see above); PTAL

@thaJeztah thaJeztah merged commit 4d40d77 into moby:master Jun 10, 2024
@thaJeztah thaJeztah deleted the api_swagger_update_image_config branch June 10, 2024 14:45
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.

3 participants