Browse code

Windows: Skip layers+base images

Signed-off-by: John Howard <jhoward@microsoft.com>

John Howard authored on 2016/09/07 01:09:18
Showing 1 changed files
... ...
@@ -1,10 +1,21 @@
1 1
 package image
2 2
 
3
-import "github.com/docker/docker/layer"
3
+import (
4
+	"runtime"
5
+
6
+	"github.com/Sirupsen/logrus"
7
+	"github.com/docker/docker/layer"
8
+)
4 9
 
5 10
 // TypeLayers is used for RootFS.Type for filesystems organized into layers.
6 11
 const TypeLayers = "layers"
7 12
 
13
+// typeLayersWithBase is an older format used by Windows up to v1.12. We
14
+// explicitly handle this as an error case to ensure that a daemon which still
15
+// has an older image like this on disk can still start, even though the
16
+// image itself is not usable. See https://github.com/docker/docker/pull/25806.
17
+const typeLayersWithBase = "layers+base"
18
+
8 19
 // RootFS describes images root filesystem
9 20
 // This is currently a placeholder that only supports layers. In the future
10 21
 // this can be made into an interface that supports different implementations.
... ...
@@ -25,5 +36,9 @@ func (r *RootFS) Append(id layer.DiffID) {
25 25
 
26 26
 // ChainID returns the ChainID for the top layer in RootFS.
27 27
 func (r *RootFS) ChainID() layer.ChainID {
28
+	if runtime.GOOS == "windows" && r.Type == typeLayersWithBase {
29
+		logrus.Warnf("Layer type is unsupported on this platform. DiffIDs: '%v'", r.DiffIDs)
30
+		return ""
31
+	}
28 32
 	return layer.CreateChainID(r.DiffIDs)
29 33
 }