Merge pull request #17542 from estesp/restart-root-dir-cleanup

Fix integration-cli daemon restart with user namespaces enabled
Upstream-commit: 6563b7d2e8a5c1ebef978e2ad8a1f7971b385abc
Component: engine
This commit is contained in:
Alexander Morozov
2015-11-02 09:50:12 -08:00

View File

@ -386,6 +386,14 @@ out2:
// Restart will restart the daemon by first stopping it and then starting it.
func (d *Daemon) Restart(arg ...string) error {
d.Stop()
// in the case of tests running a user namespace-enabled daemon, we have resolved
// d.root to be the actual final path of the graph dir after the "uid.gid" of
// remapped root is added--we need to subtract it from the path before calling
// start or else we will continue making subdirectories rather than truly restarting
// with the same location/root:
if root := os.Getenv("DOCKER_REMAP_ROOT"); root != "" {
d.root = filepath.Dir(d.root)
}
return d.Start(arg...)
}