|
@@ -10,6 +10,7 @@ import (
|
|
|
"os"
|
|
|
"os/exec"
|
|
|
"path"
|
|
|
+ "path/filepath"
|
|
|
"strconv"
|
|
|
|
|
|
"github.com/docker/docker/daemon/graphdriver"
|
|
@@ -119,7 +120,16 @@ func Init(home string, options []string, uidMaps, gidMaps []idtools.IDMap) (grap
|
|
|
return nil, graphdriver.ErrNotSupported
|
|
|
}
|
|
|
|
|
|
- fsMagic, err := graphdriver.GetFSMagic(home)
|
|
|
+ // Perform feature detection on /var/lib/docker/overlay if it's an existing directory.
|
|
|
+ // This covers situations where /var/lib/docker/overlay is a mount, and on a different
|
|
|
+ // filesystem than /var/lib/docker.
|
|
|
+ // If the path does not exist, fall back to using /var/lib/docker for feature detection.
|
|
|
+ testdir := home
|
|
|
+ if _, err := os.Stat(testdir); os.IsNotExist(err) {
|
|
|
+ testdir = filepath.Dir(testdir)
|
|
|
+ }
|
|
|
+
|
|
|
+ fsMagic, err := graphdriver.GetFSMagic(testdir)
|
|
|
if err != nil {
|
|
|
return nil, err
|
|
|
}
|