From c9c8799088b60ac58c943ee5545ebcba7483cd4c Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Tue, 13 Mar 2018 21:17:11 -0700 Subject: [PATCH] daemon.ContainerExport(): do not panic In case ContainerExport() is called for an unmounted container, it leads to a daemon panic as container.BaseFS, which is dereferenced here, is nil. To fix, do not rely on container.BaseFS; use the one returned from rwlayer.Mount(). Fixes: 7a7357dae1bccc ("LCOW: Implemented support for docker cp + build") Signed-off-by: Kir Kolyshkin (cherry picked from commit 81f6307eda44ab3a91de6e29304810a976161d74) Signed-off-by: Sebastiaan van Stijn --- components/engine/daemon/export.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/engine/daemon/export.go b/components/engine/daemon/export.go index 1f788ad9a8..d6d091d1a9 100644 --- a/components/engine/daemon/export.go +++ b/components/engine/daemon/export.go @@ -61,12 +61,12 @@ func (daemon *Daemon) containerExport(container *container.Container) (arch io.R } }() - _, err = rwlayer.Mount(container.GetMountLabel()) + basefs, err := rwlayer.Mount(container.GetMountLabel()) if err != nil { return nil, err } - archive, err := archivePath(container.BaseFS, container.BaseFS.Path(), &archive.TarOptions{ + archive, err := archivePath(basefs, basefs.Path(), &archive.TarOptions{ Compression: archive.Uncompressed, UIDMaps: daemon.idMappings.UIDs(), GIDMaps: daemon.idMappings.GIDs(),