From d14b7212ad7b2b161afc6f0c9ac08daae14198c0 Mon Sep 17 00:00:00 2001 From: "Stefan J. Wernli" Date: Wed, 11 Jan 2017 19:01:13 -0800 Subject: [PATCH] storeLayer.Parent should return describableStoreLayers When storeLayer.Parent returns the parent layer, it needs to use the same logic as Get where it wraps in a describablyStoreLayer if the layer is describable. Otherwise, on Windows, this can result in pushing the foreign layers, which is not supposed to be allowed. This fixes https://github.com/docker/docker/issues/30080. Signed-off-by: Stefan J. Wernli --- distribution/config.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/distribution/config.go b/distribution/config.go index 13ae46e0c5..ab1ab6c003 100644 --- a/distribution/config.go +++ b/distribution/config.go @@ -198,10 +198,18 @@ func (l *storeLayer) Parent() PushLayer { if p == nil { return nil } - return &storeLayer{ + sl := storeLayer{ Layer: p, ls: l.ls, } + if d, ok := p.(distribution.Describable); ok { + return &describableStoreLayer{ + storeLayer: sl, + describable: d, + } + } + + return &sl } func (l *storeLayer) Open() (io.ReadCloser, error) {