瀏覽代碼

Ensure the container state is removed on daemon boot

This ensures that the libcontainer state is fully removed for a
container after it is terminated.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
Michael Crosby 10 年之前
父節點
當前提交
06c939e527
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      daemon/execdriver/native/driver.go

+ 2 - 2
daemon/execdriver/native/driver.go

@@ -242,6 +242,7 @@ func (d *driver) Unpause(c *execdriver.Command) error {
 }
 
 func (d *driver) Terminate(c *execdriver.Command) error {
+	defer d.cleanContainer(c.ID)
 	// lets check the start time for the process
 	active := d.activeContainers[c.ID]
 	if active == nil {
@@ -262,7 +263,6 @@ func (d *driver) Terminate(c *execdriver.Command) error {
 		err = syscall.Kill(pid, 9)
 		syscall.Wait4(pid, nil, 0, nil)
 	}
-	d.cleanContainer(c.ID)
 
 	return err
 
@@ -302,7 +302,7 @@ func (d *driver) cleanContainer(id string) error {
 	d.Lock()
 	delete(d.activeContainers, id)
 	d.Unlock()
-	return os.RemoveAll(filepath.Join(d.root, id, "container.json"))
+	return os.RemoveAll(filepath.Join(d.root, id))
 }
 
 func (d *driver) createContainerRoot(id string) error {