|
@@ -18,7 +18,7 @@ import (
|
|
|
|
|
|
// PullImage initiates a pull operation. image is the repository name to pull, and
|
|
|
// tag may be either empty, or indicate a specific tag to pull.
|
|
|
-func (daemon *Daemon) PullImage(ctx context.Context, image, tag string, metaHeaders map[string][]string, authConfig *types.AuthConfig, outStream io.Writer) error {
|
|
|
+func (daemon *Daemon) PullImage(ctx context.Context, image, tag, platform string, metaHeaders map[string][]string, authConfig *types.AuthConfig, outStream io.Writer) error {
|
|
|
// Special case: "pull -a" may send an image name with a
|
|
|
// trailing :. This is ugly, but let's not break API
|
|
|
// compatibility.
|
|
@@ -43,10 +43,10 @@ func (daemon *Daemon) PullImage(ctx context.Context, image, tag string, metaHead
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- return daemon.pullImageWithReference(ctx, ref, metaHeaders, authConfig, outStream)
|
|
|
+ return daemon.pullImageWithReference(ctx, ref, platform, metaHeaders, authConfig, outStream)
|
|
|
}
|
|
|
|
|
|
-func (daemon *Daemon) pullImageWithReference(ctx context.Context, ref reference.Named, metaHeaders map[string][]string, authConfig *types.AuthConfig, outStream io.Writer) error {
|
|
|
+func (daemon *Daemon) pullImageWithReference(ctx context.Context, ref reference.Named, platform string, metaHeaders map[string][]string, authConfig *types.AuthConfig, outStream io.Writer) error {
|
|
|
// Include a buffer so that slow client connections don't affect
|
|
|
// transfer performance.
|
|
|
progressChan := make(chan progress.Progress, 100)
|
|
@@ -60,11 +60,10 @@ func (daemon *Daemon) pullImageWithReference(ctx context.Context, ref reference.
|
|
|
close(writesDone)
|
|
|
}()
|
|
|
|
|
|
- // ------------------------------------------------------------------------------
|
|
|
- // TODO @jhowardmsft LCOW. For now, use just the store for the host OS. This will
|
|
|
- // need some work to complete - we won't know the platform until after metadata
|
|
|
- // is pulled from the repository. This affects plugin as well to complete.
|
|
|
- // ------------------------------------------------------------------------------
|
|
|
+ // Default to the host OS platform in case it hasn't been populated with an explicit value.
|
|
|
+ if platform == "" {
|
|
|
+ platform = runtime.GOOS
|
|
|
+ }
|
|
|
|
|
|
imagePullConfig := &distribution.ImagePullConfig{
|
|
|
Config: distribution.Config{
|
|
@@ -73,12 +72,13 @@ func (daemon *Daemon) pullImageWithReference(ctx context.Context, ref reference.
|
|
|
ProgressOutput: progress.ChanOutput(progressChan),
|
|
|
RegistryService: daemon.RegistryService,
|
|
|
ImageEventLogger: daemon.LogImageEvent,
|
|
|
- MetadataStore: daemon.stores[runtime.GOOS].distributionMetadataStore,
|
|
|
- ImageStore: distribution.NewImageConfigStoreFromStore(daemon.stores[runtime.GOOS].imageStore),
|
|
|
- ReferenceStore: daemon.stores[runtime.GOOS].referenceStore,
|
|
|
+ MetadataStore: daemon.stores[platform].distributionMetadataStore,
|
|
|
+ ImageStore: distribution.NewImageConfigStoreFromStore(daemon.stores[platform].imageStore),
|
|
|
+ ReferenceStore: daemon.stores[platform].referenceStore,
|
|
|
},
|
|
|
DownloadManager: daemon.downloadManager,
|
|
|
Schema2Types: distribution.ImageTypes,
|
|
|
+ Platform: platform,
|
|
|
}
|
|
|
|
|
|
err := distribution.Pull(ctx, ref, imagePullConfig)
|