Skip to content

Suggestion: Deprecate and disrecommend Platform's os.features key. #1147

@TBBle

Description

@TBBle

The platform object (in both Image Index and Config) contains a string-array property os.features, which is currently defined only for Windows, only for one possible value (plus empty), and only as a SHOULD.

This field describes a requirement of the Host OS for the container to run, per #632 (comment) and the spec documentation.

However, it's become both not-useful and not-usable.

The specific requirement was for containers that could not run on a Windows Nano Server host, due to absent win32k.sys. However, in 2017, Windows Nano Server lost the ability to be run as anything except a container base image, and no Nano Server edition before that change has been in a supported state since 2019.

So there's been no supported platforms where this check is relevant for about 3 years.

As mentioned at #632 (comment), Microsoft Windows base images served from mcr.microsoft.com, except Nano Server, are marked with the win32k feature, even today.

However, neither containerd (windows-specific, generic) nor moby can use os.features to select an image from an image index, or ensure an image will be runnable. (containerd also does not advertise the feature in its own platform definition, so if it was filtering as specified, it would be getting the wrong result). This was noted as the case in Docker in 2017, and presumably never changed.

This lack of support also turns out to be irrelevant because it seems that the Docker legacy builder (the only supported Windows Container image builder AFAIK) does not propagate this field into derived images, and so images on the Internet that should have this annotation do not. (Or I did something wrong in my research. I haven't tracked down specific code in Docker that leads to this result, and os.version is correctly propagated.)

Further, examination of a couple of projects (PowerShell-Docker and DotNet-Docker) which are:

  • MS Supported, i.e. should be best-practice
  • Generate images based on both Server Core and Nanoserver base image
  • Generate an Image Index

showed that none of the images contained the win32k feature, and also showed no attempt to include both Nanoserver- and Server Core-based images in the same index. These two projects have fallen on opposite sides of which one to make default, as it happens.

So my suggestion is move the spec to reflect the status quo:

  • Deprecate os.features in both places it appears
  • Recommend image builds may either ignore or propagate os.features into derived images. They should not provide a mechanism to modify os.features in any other way, e.g., platform overrides should not expose os.features for overriding.
    • BuildKit might turn out to propagate this by accident. We're still getting the final rough edges sorted, and this showed up during that process.
  • Container runtimes SHOULD ignore os.features, and not use it for purposes of selecting, ranking, or filtering images from an image index.
    • Putting images in an image index that differ only in os.features is a bad idea, and won't work correctly today, so we should standardese-discourage that.

I suggest we deprecate (I'd say remove, but I suspect that's hard for back-compat reasons) this field completely because, even if a future need for this appears, the field name has become inappropriate, as it describes a requirement on the Host OS, but sits next to os.version, which describes the Container's OS. At the time these fields were introduced, that distinction was minor (basically equality-matching versions), but improvements in the Windows Container ecosystem have complicated the use of os.version.

Because I'm aiming to reflect the status quo here, such a change to the spec is not urgent for 1.1.0; if it's considered a good idea, then various implementations need only not start supporting it and they're compliant. (This is relevant right now because containerd probably needs to start exposing os.version in its stringified Platfom object representation, and a simple approach would probably also expose os.features for consistency)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions