mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
LCOW: Fix schemav1 pull to extract platform
Signed-off-by: John Howard <jhoward@microsoft.com>
This commit is contained in:
parent
bdabc76a53
commit
b21d9ab595
1 changed files with 21 additions and 1 deletions
|
@ -27,6 +27,7 @@ import (
|
|||
"github.com/docker/docker/pkg/ioutils"
|
||||
"github.com/docker/docker/pkg/progress"
|
||||
"github.com/docker/docker/pkg/stringid"
|
||||
"github.com/docker/docker/pkg/system"
|
||||
refstore "github.com/docker/docker/reference"
|
||||
"github.com/docker/docker/registry"
|
||||
"github.com/opencontainers/go-digest"
|
||||
|
@ -486,7 +487,26 @@ func (p *v2Puller) pullSchema1(ctx context.Context, ref reference.Named, unverif
|
|||
descriptors = append(descriptors, layerDescriptor)
|
||||
}
|
||||
|
||||
resultRootFS, release, err := p.config.DownloadManager.Download(ctx, *rootFS, "", descriptors, p.config.ProgressOutput)
|
||||
// The v1 manifest itself doesn't directly contain a platform. However,
|
||||
// the history does, but unfortunately that's a string, so search through
|
||||
// all the history until hopefully we find one which indicates the os.
|
||||
platform := runtime.GOOS
|
||||
if runtime.GOOS == "windows" && system.LCOWSupported() {
|
||||
type config struct {
|
||||
Os string `json:"os,omitempty"`
|
||||
}
|
||||
for _, v := range verifiedManifest.History {
|
||||
var c config
|
||||
if err := json.Unmarshal([]byte(v.V1Compatibility), &c); err == nil {
|
||||
if c.Os != "" {
|
||||
platform = c.Os
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
resultRootFS, release, err := p.config.DownloadManager.Download(ctx, *rootFS, layer.Platform(platform), descriptors, p.config.ProgressOutput)
|
||||
if err != nil {
|
||||
return "", "", err
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue