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 <kolyshkin@gmail.com>
Upstream-commit: 81f6307eda44ab3a91de6e29304810a976161d74
Component: engine
This commit is contained in:
@@ -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(),
|
||||
|
||||
Reference in New Issue
Block a user