LCOW: Push to switch platform

Signed-off-by: John Howard <jhoward@microsoft.com>
This commit is contained in:
John Howard 2017-05-31 10:41:56 -07:00
parent e05cedcbf9
commit a97b99e2d8

View file

@ -10,6 +10,7 @@ import (
"github.com/docker/docker/distribution"
progressutils "github.com/docker/docker/distribution/utils"
"github.com/docker/docker/pkg/progress"
"github.com/docker/docker/pkg/system"
"golang.org/x/net/context"
)
@ -40,10 +41,11 @@ func (daemon *Daemon) PushImage(ctx context.Context, image, tag string, metaHead
close(writesDone)
}()
// ------------------------------------------------------------------------------
// TODO @jhowardmsft LCOW. For now, use just the store for the host OS. This will
// need some work to complete.
// ------------------------------------------------------------------------------
// TODO @jhowardmsft LCOW Support. This will require revisiting. For now, hard-code.
platform := runtime.GOOS
if platform == "windows" && system.LCOWSupported() {
platform = "linux"
}
imagePushConfig := &distribution.ImagePushConfig{
Config: distribution.Config{
@ -52,12 +54,12 @@ func (daemon *Daemon) PushImage(ctx context.Context, image, tag string, metaHead
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,
},
ConfigMediaType: schema2.MediaTypeImageConfig,
LayerStore: distribution.NewLayerProviderFromStore(daemon.stores[runtime.GOOS].layerStore),
LayerStore: distribution.NewLayerProviderFromStore(daemon.stores[platform].layerStore),
TrustKey: daemon.trustKey,
UploadManager: daemon.uploadManager,
}