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

Kaniko doesn’t set image platform for FROM scratch images #997

Closed
andrewshadura opened this issue Jan 24, 2020 · 3 comments · Fixed by #1130
Closed

Kaniko doesn’t set image platform for FROM scratch images #997

andrewshadura opened this issue Jan 24, 2020 · 3 comments · Fixed by #1130
Labels
good first issue Good for newcomers priority/p3 agreed that this would be good to have, but no one is available at the moment.

Comments

@andrewshadura
Copy link

andrewshadura commented Jan 24, 2020

Actual behavior
When trying to pull an image generated with kaniko FROM scratch with podman, podman complains:

Trying to pull registry.tld/package-builder...
  Image operating system mismatch: image uses "", expecting "linux"
Error: unable to pull registry.tld/package-builder: unable to pull image: Image operating system mismatch: image uses "", expecting "linux"

Apparently, the platform is set only for images derived from others:

$ skopeo inspect docker://registry.tld/debian-based-image-builder | grep Os
    "Os": "linux",
$ skopeo inspect docker://registry.tld/package-builder | grep Os
    "Os": "",

Expected behavior
Set the platform value to an actual one or provide a way to override.

To Reproduce
Steps to reproduce the behavior:

FROM scratch

ADD rootfs.tar.gz /

Triage Notes for the Maintainers

Description Yes/No
Please check if this a new feature you are proposing
Please check if the build works in docker but not in kaniko
Please check if this error is seen when you use --cache flag
Please check if your dockerfile is a multistage dockerfile
@andrewshadura andrewshadura changed the title Kaniko doesn’t set imae platform for FROM scratch images Kaniko doesn’t set image platform for FROM scratch images Jan 24, 2020
@em-
Copy link

em- commented Jan 24, 2020

My naive observation is that kaniko may be creating an empty manifest that is too empty when building an image from scratch:
https://github.com/GoogleContainerTools/kaniko/blob/master/pkg/executor/build.go#L444

Os and Architecture should probably be set if unset, just like it is done for Env:
https://github.com/GoogleContainerTools/kaniko/blob/a2aae627/pkg/executor/build.go#L139

Likely these values should be used by default (they don't seem to be used anywhere at the moment):
https://github.com/GoogleContainerTools/kaniko/blob/a2aae6274/pkg/util/util.go#L146

@tejal29 tejal29 added good first issue Good for newcomers priority/p3 agreed that this would be good to have, but no one is available at the moment. labels Jan 24, 2020
@tejal29
Copy link
Member

tejal29 commented Jan 24, 2020

Thanks @em for the details.
@andrewshadura oe @em- Would you any of you want to give it a try?

@sereinity
Copy link

Also, having os="" makes podman fail to run the container.

podman run …
Error: incompatible image OS "" on "linux" host

Do you prefer a separated issue ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers priority/p3 agreed that this would be good to have, but no one is available at the moment.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants