Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion daemon/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,9 @@ func (daemon *Daemon) refreshImage(ctx context.Context, s *container.Snapshot, f
if err != nil || ctr == nil {
return nil, err
}
opts.Platform = &ctr.Config.Platform
if ctr.Config.Platform.OS != "" {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Do we always set a normalised Platform ? (i.e., --platform=arm64 gets normalised to linux/arm64?) ISTR fields can be treated as "optional", so if we would not normalise the value, OS could be empty, but Arch possibly not.

Looking at this, I wonder if sending a nil platform is actually problematic;

  • daemon.imageService.GetImage()
  • calls imageService.getImage()
  • calls imageService.GetContainerdImage()
  • calls (is a wrapper for) imageService.resolveImage()

That last one may be problematic if we do not specify a platform;

// resolveImage searches for an image based on the given
// reference or identifier. Returns the descriptor of
// the image, could be manifest list, manifest, or config.
func (i *ImageService) resolveImage(ctx context.Context, refOrID string, platform *ocispec.Platform) (img containerdimages.Image, err error) {

It looks like that function returns;

  • a manifest index if no platform is specified
  • an image manifest (image) if a platform is specified'
  • (or a "not found" if the image was found, but no matching platform)

Which means that we would now switch the container from referencing an image to it referencing a manifest list (?)

I wonder if instead of "no platform", we should either;

  • Set the default platform (I think that's also what would be used if no platform is specified
  • Or to look up the container's image ID, and check the image's platform?

opts.Platform = &ctr.Config.Platform
}
}
img, err := daemon.imageService.GetImage(ctx, tmpImage, opts)

Expand Down