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>
| ... | ... |
@@ -61,12 +61,12 @@ func (daemon *Daemon) containerExport(container *container.Container) (arch io.R |
| 61 | 61 |
} |
| 62 | 62 |
}() |
| 63 | 63 |
|
| 64 |
- _, err = rwlayer.Mount(container.GetMountLabel()) |
|
| 64 |
+ basefs, err := rwlayer.Mount(container.GetMountLabel()) |
|
| 65 | 65 |
if err != nil {
|
| 66 | 66 |
return nil, err |
| 67 | 67 |
} |
| 68 | 68 |
|
| 69 |
- archive, err := archivePath(container.BaseFS, container.BaseFS.Path(), &archive.TarOptions{
|
|
| 69 |
+ archive, err := archivePath(basefs, basefs.Path(), &archive.TarOptions{
|
|
| 70 | 70 |
Compression: archive.Uncompressed, |
| 71 | 71 |
UIDMaps: daemon.idMappings.UIDs(), |
| 72 | 72 |
GIDMaps: daemon.idMappings.GIDs(), |