Signed-off-by: John Howard <jhoward@microsoft.com>
John Howard authored on 2017/06/20 11:42:48... | ... |
@@ -27,6 +27,7 @@ import ( |
27 | 27 |
"github.com/docker/docker/pkg/ioutils" |
28 | 28 |
"github.com/docker/docker/pkg/progress" |
29 | 29 |
"github.com/docker/docker/pkg/stringid" |
30 |
+ "github.com/docker/docker/pkg/system" |
|
30 | 31 |
refstore "github.com/docker/docker/reference" |
31 | 32 |
"github.com/docker/docker/registry" |
32 | 33 |
"github.com/opencontainers/go-digest" |
... | ... |
@@ -486,7 +487,26 @@ func (p *v2Puller) pullSchema1(ctx context.Context, ref reference.Named, unverif |
486 | 486 |
descriptors = append(descriptors, layerDescriptor) |
487 | 487 |
} |
488 | 488 |
|
489 |
- resultRootFS, release, err := p.config.DownloadManager.Download(ctx, *rootFS, "", descriptors, p.config.ProgressOutput) |
|
489 |
+ // The v1 manifest itself doesn't directly contain a platform. However, |
|
490 |
+ // the history does, but unfortunately that's a string, so search through |
|
491 |
+ // all the history until hopefully we find one which indicates the os. |
|
492 |
+ platform := runtime.GOOS |
|
493 |
+ if runtime.GOOS == "windows" && system.LCOWSupported() { |
|
494 |
+ type config struct { |
|
495 |
+ Os string `json:"os,omitempty"` |
|
496 |
+ } |
|
497 |
+ for _, v := range verifiedManifest.History { |
|
498 |
+ var c config |
|
499 |
+ if err := json.Unmarshal([]byte(v.V1Compatibility), &c); err == nil { |
|
500 |
+ if c.Os != "" { |
|
501 |
+ platform = c.Os |
|
502 |
+ break |
|
503 |
+ } |
|
504 |
+ } |
|
505 |
+ } |
|
506 |
+ } |
|
507 |
+ |
|
508 |
+ resultRootFS, release, err := p.config.DownloadManager.Download(ctx, *rootFS, layer.Platform(platform), descriptors, p.config.ProgressOutput) |
|
490 | 509 |
if err != nil { |
491 | 510 |
return "", "", err |
492 | 511 |
} |