From eb4a438be77d545f741510aa375595087ddaa670 Mon Sep 17 00:00:00 2001 From: Phil Estes Date: Fri, 30 Oct 2015 16:39:04 -0400 Subject: [PATCH] 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 "." ending) so that it uses/resolves to the same graphdir on restart. Docker-DCO-1.1-Signed-off-by: Phil Estes (github: estesp) Upstream-commit: 0c57b9f5b3cb72df47578a3f0e505db2bec5ccf1 Component: engine --- components/engine/integration-cli/docker_utils.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/components/engine/integration-cli/docker_utils.go b/components/engine/integration-cli/docker_utils.go index 188c821f32..58689bbcf7 100644 --- a/components/engine/integration-cli/docker_utils.go +++ b/components/engine/integration-cli/docker_utils.go @@ -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...) }