Add --platform flag support for platform-aware image pulls#180
Add --platform flag support for platform-aware image pulls#180
Conversation
…age pull issue Docker 29 with the io.containerd.snapshotter.v1 storage driver sometimes fails to automatically select the correct architecture variant when pulling multi-arch images. This change adds an explicit --platform flag to the build (slim), run, xray, profile, and debug commands, allowing users to specify the desired platform (e.g., linux/arm64). Steps taken: 1. Added FlagPlatform to common CLI flags in pkg/app/master/command/cliflags.go. 2. Added Platform field to crt.PullImageOptions struct in pkg/crt/clients.go. 3. Updated PullImage implementation in pkg/crt/docker/dockercrtclient/dockercrtclient.go to pass the platform to the underlying Docker client. 4. Updated the image inspector's Pull method in pkg/app/master/inspectors/image/image_inspector.go to accept and use the platform parameter. 5. Updated build, run, xray, profile, and debug commands (CLI and handlers) to retrieve the --platform flag value and pass it through to the pull logic. 6. Verified that the project compiles with the new changes. Co-authored-by: kcq <1099414+kcq@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (19 files)
|
🤖 Augment PR SummarySummary: Adds a new
🤖 Was this summary useful? React with 👍 or 👎 |
| FlagRegistryAccount = "registry-account" | ||
| FlagRegistrySecret = "registry-secret" | ||
| FlagShowPullLogs = "show-plogs" | ||
| FlagPlatform = "platform" |
There was a problem hiding this comment.
| logger.WithError(err).Trace("api.ImageService.Get") | ||
| logger.Debugf("api.Pull(%s)", commandParams.DebugContainerImage) | ||
| debugImage, err = api.Pull(ctx, commandParams.DebugContainerImage, containerd.WithPullUnpack) | ||
| pullOpts := []containerd.RemoteOpt{containerd.WithPullUnpack} |
There was a problem hiding this comment.
This PR introduces a new
--platformflag to several key commands (build,run,xray,profile,debug). This flag allows users to explicitly specify the target platform when pulling container images, addressing an issue in Docker 29 where the incorrect architecture variant of a multi-arch image might be selected when using theio.containerd.snapshotter.v1storage driver.The platform value is passed from the CLI all the way down to the container runtime client's pull options. Support has been explicitly added for the Docker and Containerd runtimes. For Podman, a TODO was added as the current bindings don't easily expose the platform parameter for pulls.
Fixes #174
PR created automatically by Jules for task 17122436149153391814 started by @kcq