Handle docker start inside overlayfs

Raspberry Pi allows to start system under overlayfs.
Docker is successfully fallbacks to fuse-overlay but not starting
because of the `Error starting daemon: rename /var/lib/docker/runtimes /var/lib/docker/runtimes-old: invalid cross-device link` error
It's happening because `rename` is not supported by overlayfs.

After manually removing directory `runtimes` docker starts and works successfully

Signed-off-by: Illia Antypenko <ilya@antipenko.pp.ua>
(cherry picked from commit d591710f82)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Illia Antypenko 2022-02-08 23:14:23 +01:00 committed by Sebastiaan van Stijn
parent ebedb1c496
commit a8926de2a1
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C

View file

@ -69,7 +69,9 @@ func (daemon *Daemon) initRuntimes(runtimes map[string]types.Runtime) (err error
}
if err = os.Rename(runtimeDir, runtimeDir+"-old"); err != nil {
return
if err = os.RemoveAll(runtimeDir); err != nil {
return
}
}
if err = os.Rename(tmpDir, runtimeDir); err != nil {
err = errors.Wrap(err, "failed to setup runtimes dir, new containers may not start")