docker: Delete Task on Destroy

Currently the docker driver does not remove tasks from its state map
when destroying the task, which leads to issues when restarting tasks in
place, and leaks expired handles over time.
This commit is contained in:
Danielle Tomlinson
2018-12-18 15:53:31 +01:00
parent fc7455c104
commit ad4bac8d77

View File

@@ -1019,6 +1019,7 @@ func (d *Driver) DestroyTask(taskID string, force bool) error {
}
defer h.dloggerPluginClient.Kill()
if err := h.client.StopContainer(h.containerID, 0); err != nil {
h.logger.Warn("failed to stop container during destroy", "error", err)
}
@@ -1033,6 +1034,7 @@ func (d *Driver) DestroyTask(taskID string, force bool) error {
"error", err)
}
d.tasks.Delete(taskID)
return nil
}