1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

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