From a97b99e2d801ed1ec4c77387dd7b47631697c25f Mon Sep 17 00:00:00 2001 From: John Howard Date: Wed, 31 May 2017 10:41:56 -0700 Subject: [PATCH] LCOW: Push to switch platform Signed-off-by: John Howard --- daemon/image_push.go | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/daemon/image_push.go b/daemon/image_push.go index f11669c660..b1d15454fb 100644 --- a/daemon/image_push.go +++ b/daemon/image_push.go @@ -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, }