Browse code

Ensure that the container's dir is remove from native driver on stop Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)

Michael Crosby authored on 2014/02/26 09:27:07
Showing 1 changed files
... ...
@@ -82,6 +82,8 @@ func (d *driver) Run(c *execdriver.Command, pipes *execdriver.Pipes, startCallba
82 82
 	if err := d.createContainerRoot(c.ID); err != nil {
83 83
 		return -1, err
84 84
 	}
85
+	defer d.removeContainerRoot(c.ID)
86
+
85 87
 	if c.Tty {
86 88
 		term = &dockerTtyTerm{
87 89
 			pipes: pipes,
... ...
@@ -186,6 +188,10 @@ func (d *driver) createContainerRoot(id string) error {
186 186
 	return os.MkdirAll(filepath.Join(d.root, id), 0655)
187 187
 }
188 188
 
189
+func (d *driver) removeContainerRoot(id string) error {
190
+	return os.RemoveAll(filepath.Join(d.root, id))
191
+}
192
+
189 193
 func getEnv(key string, env []string) string {
190 194
 	for _, pair := range env {
191 195
 		parts := strings.Split(pair, "=")