Skip to content
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

set osversion in index descriptor from base image #3619

Merged
merged 1 commit into from
Feb 17, 2023

Conversation

tonistiigi
Copy link
Member

As pointed out by @cpuguy83 , when cross-compiling windows images, the manifest descriptors do not contain OSVersion that is used on windows. There is currently no way to pass OSVersion as containerd has not defined the os/arch/variant serialization for that field, but if base image used by the build has OSVersion defined we can just use that one. In image config OSVersion was already set before by the base image.

Signed-off-by: Tonis Tiigi tonistiigi@gmail.com

frontend/dockerui/build.go Outdated Show resolved Hide resolved
@@ -50,6 +50,23 @@ func (bc *Client) Build(ctx context.Context, fn BuildFunc) (*ResultBuilder, erro
if tp != nil {
p = *tp
}

// in certain conditions we allow input platform to be extended from base image
if p.OS == "windows" && img.OS == p.OS {
Copy link
Member

Choose a reason for hiding this comment

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

Is there any reason to gate this on Windows?

Copy link
Member Author

Choose a reason for hiding this comment

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

You mean in case other OS would also set os.version? I've only seen the field use for windows.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
@cpuguy83
Copy link
Member

We may need a way to tell buildkit to not do this for Windows "host process" images.
/cc @marosset

@marosset
Copy link

We may need a way to tell buildkit to not do this for Windows "host process" images. /cc @marosset

I think we don't need to worry about this for "host process" images.
We are encouraging everyone to use a specific base image for building "host process" container images and this image sets OS and Architecture but not OSVersion so we'll get the desired behavior.

https://github.com/microsoft/windows-host-process-containers-base-image/blob/414061ffba9342925ac8b197a5213566268c0dc3/New-HostProcessBaseImage.ps1#L85-L123

All of the other base images for Windows will have OS, Architecture, and OSVersion set.

@crazy-max crazy-max merged commit dbafcc8 into moby:master Feb 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants