From 5c67d2e6346d493e2b8b0469d453a64d41c22cb2 Mon Sep 17 00:00:00 2001 From: Michael Crosby Date: Tue, 25 Feb 2014 16:27:07 -0800 Subject: [PATCH] Ensure that the container's dir is remove from native driver on stop Docker-DCO-1.1-Signed-off-by: Michael Crosby (github: crosbymichael) --- execdriver/native/driver.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/execdriver/native/driver.go b/execdriver/native/driver.go index 0603b92400..1460b09e87 100644 --- a/execdriver/native/driver.go +++ b/execdriver/native/driver.go @@ -82,6 +82,8 @@ func (d *driver) Run(c *execdriver.Command, pipes *execdriver.Pipes, startCallba if err := d.createContainerRoot(c.ID); err != nil { return -1, err } + defer d.removeContainerRoot(c.ID) + if c.Tty { term = &dockerTtyTerm{ pipes: pipes, @@ -186,6 +188,10 @@ func (d *driver) createContainerRoot(id string) error { return os.MkdirAll(filepath.Join(d.root, id), 0655) } +func (d *driver) removeContainerRoot(id string) error { + return os.RemoveAll(filepath.Join(d.root, id)) +} + func getEnv(key string, env []string) string { for _, pair := range env { parts := strings.Split(pair, "=")