-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Platform on create #2551
Platform on create #2551
Conversation
This brings in client support to set the platform on container create. Signed-off-by: Brian Goff <cpuguy83@gmail.com>
5572cd1
to
e108122
Compare
@cpuguy83 Looks like there's a build failure
|
e108122
to
14139d7
Compare
Previously we only set the platform when performing a pull, which is only initiated if pull always is set, or if the image reference does not exist in the daemon. The daemon now supports specifying which platform you wanted on container create so it can validate the image reference is the platform you thought you were getting. Signed-off-by: Brian Goff <cpuguy83@gmail.com>
14139d7
to
ccd9d63
Compare
// Engine API version 1.41 first introduced the option to specify platform on | ||
// create. It will produce an error if you try to set a platform on older API | ||
// versions, so check the API version here to maintain backwards | ||
// compatibility for CLI users. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we change
Lines 125 to 129 in 590f327
func AddPlatformFlag(flags *pflag.FlagSet, target *string) { | |
flags.StringVar(target, "platform", os.Getenv("DOCKER_DEFAULT_PLATFORM"), "Set platform if server is multi-platform capable") | |
flags.SetAnnotation("platform", "version", []string{"1.32"}) | |
flags.SetAnnotation("platform", "experimental", nil) | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Platform is supported on pull since I don't know when.
@tonistiigi ptal 🤗 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@tonistiigi @tiborvass PTAL
On moby I'm using master at
|
@tiborvass I'm not sure I'm following along, here is what I'm seeing:
After setting up binfmt:
|
- What I did
Set platform on container create API.
- How I did it
Propagate platform to the container create API
- How to verify it
Run engine master with DOCKER_API_VERSION=1.41
Before this change:
The 2nd run would run an armhf image somewhat unexpectedly.
After this change:
The 2nd run will do a new pull to get the host native arch (ie linux/amd64).
- Description for the changelog
Propagate platform flag to container create API
- A picture of a cute animal (not mandatory but encouraged)