Signed-off-by: John Howard <jhoward@microsoft.com>
| ... | ... |
@@ -5,6 +5,7 @@ import ( |
| 5 | 5 |
"runtime" |
| 6 | 6 |
|
| 7 | 7 |
"github.com/docker/docker/image/tarexport" |
| 8 |
+ "github.com/docker/docker/pkg/system" |
|
| 8 | 9 |
) |
| 9 | 10 |
|
| 10 | 11 |
// ExportImage exports a list of images to the given output stream. The |
| ... | ... |
@@ -13,8 +14,12 @@ import ( |
| 13 | 13 |
// the same tag are exported. names is the set of tags to export, and |
| 14 | 14 |
// outStream is the writer which the images are written to. |
| 15 | 15 |
func (daemon *Daemon) ExportImage(names []string, outStream io.Writer) error {
|
| 16 |
- // TODO @jhowardmsft LCOW. For now, assume it is the OS of the host |
|
| 17 |
- imageExporter := tarexport.NewTarExporter(daemon.stores[runtime.GOOS].imageStore, daemon.stores[runtime.GOOS].layerStore, daemon.stores[runtime.GOOS].referenceStore, daemon) |
|
| 16 |
+ // TODO @jhowardmsft LCOW. This will need revisiting later. |
|
| 17 |
+ platform := runtime.GOOS |
|
| 18 |
+ if platform == "windows" && system.LCOWSupported() {
|
|
| 19 |
+ platform = "linux" |
|
| 20 |
+ } |
|
| 21 |
+ imageExporter := tarexport.NewTarExporter(daemon.stores[platform].imageStore, daemon.stores[platform].layerStore, daemon.stores[platform].referenceStore, daemon) |
|
| 18 | 22 |
return imageExporter.Save(names, outStream) |
| 19 | 23 |
} |
| 20 | 24 |
|
| ... | ... |
@@ -22,7 +27,11 @@ func (daemon *Daemon) ExportImage(names []string, outStream io.Writer) error {
|
| 22 | 22 |
// complement of ImageExport. The input stream is an uncompressed tar |
| 23 | 23 |
// ball containing images and metadata. |
| 24 | 24 |
func (daemon *Daemon) LoadImage(inTar io.ReadCloser, outStream io.Writer, quiet bool) error {
|
| 25 |
- // TODO @jhowardmsft LCOW. For now, assume it is the OS of the host |
|
| 26 |
- imageExporter := tarexport.NewTarExporter(daemon.stores[runtime.GOOS].imageStore, daemon.stores[runtime.GOOS].layerStore, daemon.stores[runtime.GOOS].referenceStore, daemon) |
|
| 25 |
+ // TODO @jhowardmsft LCOW. This will need revisiting later. |
|
| 26 |
+ platform := runtime.GOOS |
|
| 27 |
+ if platform == "windows" && system.LCOWSupported() {
|
|
| 28 |
+ platform = "linux" |
|
| 29 |
+ } |
|
| 30 |
+ imageExporter := tarexport.NewTarExporter(daemon.stores[platform].imageStore, daemon.stores[platform].layerStore, daemon.stores[platform].referenceStore, daemon) |
|
| 27 | 31 |
return imageExporter.Load(inTar, outStream, quiet) |
| 28 | 32 |
} |