Browse Source

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

Fix integration-cli daemon restart with user namespaces enabled
Alexander Morozov 9 years ago
parent
commit
6563b7d2e8
1 changed files with 8 additions and 0 deletions
  1. 8 0
      integration-cli/docker_utils.go

+ 8 - 0
integration-cli/docker_utils.go

@@ -386,6 +386,14 @@ out2:
 // Restart will restart the daemon by first stopping it and then starting it.
 // Restart will restart the daemon by first stopping it and then starting it.
 func (d *Daemon) Restart(arg ...string) error {
 func (d *Daemon) Restart(arg ...string) error {
 	d.Stop()
 	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...)
 	return d.Start(arg...)
 }
 }