daemon.cleanupContainer: nullify container RWLayer upon release

ReleaseRWLayer can and should only be called once (unless it returns
an error), but might be called twice in case of a failure from
`system.EnsureRemoveAll(container.Root)`. This results in the
following error:

> Error response from daemon: driver "XXX" failed to remove root filesystem for YYY: layer not retained

The obvious fix is to set container.RWLayer to nil as soon as
ReleaseRWLayer() succeeds.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
Kir Kolyshkin 2018-01-30 15:01:45 -08:00
parent a80cd04eb5
commit e9b9e4ace2
1 changed files with 1 additions and 0 deletions

View File

@ -128,6 +128,7 @@ func (daemon *Daemon) cleanupContainer(container *container.Container, forceRemo
container.SetRemovalError(e)
return e
}
container.RWLayer = nil
}
if err := system.EnsureRemoveAll(container.Root); err != nil {