Procházet zdrojové kódy

LCOW: Push to switch platform

Signed-off-by: John Howard <jhoward@microsoft.com>
John Howard před 8 roky
rodič
revize
a97b99e2d8
1 změnil soubory, kde provedl 10 přidání a 8 odebrání
  1. 10 8
      daemon/image_push.go

+ 10 - 8
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,
 	}