Browse code

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)

Phil Estes authored on 2015/10/31 05:39:04
Showing 1 changed files
... ...
@@ -386,6 +386,14 @@ out2:
386 386
 // Restart will restart the daemon by first stopping it and then starting it.
387 387
 func (d *Daemon) Restart(arg ...string) error {
388 388
 	d.Stop()
389
+	// in the case of tests running a user namespace-enabled daemon, we have resolved
390
+	// d.root to be the actual final path of the graph dir after the "uid.gid" of
391
+	// remapped root is added--we need to subtract it from the path before calling
392
+	// start or else we will continue making subdirectories rather than truly restarting
393
+	// with the same location/root:
394
+	if root := os.Getenv("DOCKER_REMAP_ROOT"); root != "" {
395
+		d.root = filepath.Dir(d.root)
396
+	}
389 397
 	return d.Start(arg...)
390 398
 }
391 399