1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Fix integration-cli daemon restart with user namespaces enabled

The `d.root` dir is resolved to the full path to the graph dir after the
daemon starts, but on restart, should be set back to the parent (without
the "<uid>.<gid>" ending) so that it uses/resolves to the same graphdir
on restart.

Docker-DCO-1.1-Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com> (github: estesp)
This commit is contained in:
Phil Estes 2015-10-30 16:39:04 -04:00
parent a154b95d06
commit 0c57b9f5b3

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...)
}