From da66238a1b4b60a20de5222ddb85c1b671c0b302 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Gronowski?= Date: Thu, 26 Jan 2023 14:02:46 +0100 Subject: [PATCH] daemon: Don't set empty platform for GetImageOpts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Don't set `GetImageOpts.Platform` to avoid searching for `unknown/unknown` platform in image, when for some reason the `container.Config.Platform` is empty. This is possible for containers created before `run --platform X` support was added. Signed-off-by: Paweł Gronowski --- daemon/list.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/daemon/list.go b/daemon/list.go index 51e242a4c033d..1d1925f8fcb8a 100644 --- a/daemon/list.go +++ b/daemon/list.go @@ -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 != "" { + opts.Platform = &ctr.Config.Platform + } } img, err := daemon.imageService.GetImage(ctx, tmpImage, opts)