From b2ece4fe9d1cb519a0254b83d76b33fe57e54c8d Mon Sep 17 00:00:00 2001 From: Seth Hoenig Date: Tue, 7 Mar 2023 11:29:45 -0600 Subject: [PATCH] docker: cl: thread context from driver into pause container restoration --- drivers/docker/driver.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/docker/driver.go b/drivers/docker/driver.go index 8b043fed2d7..b8911ac112c 100644 --- a/drivers/docker/driver.go +++ b/drivers/docker/driver.go @@ -171,7 +171,7 @@ func NewDockerDriver(ctx context.Context, logger hclog.Logger) drivers.DriverPlu ctx: ctx, logger: logger, } - go driver.recoverPauseContainers() + go driver.recoverPauseContainers(ctx) return driver } @@ -274,6 +274,9 @@ func (d *Driver) RecoverTask(handle *drivers.TaskHandle) error { } d.tasks.Set(handle.Config.ID, h) + + // find a pause container? + go h.run() return nil @@ -745,7 +748,7 @@ func (d *Driver) containerBinds(task *drivers.TaskConfig, driverConfig *TaskConf return binds, nil } -func (d *Driver) recoverPauseContainers() { +func (d *Driver) recoverPauseContainers(ctx context.Context) { // On Client restart, we must rebuild the set of pause containers // we are tracking. Basically just scan all containers and pull the ID from // anything that has the Nomad Label and has Name with prefix "/nomad_init_". @@ -757,7 +760,8 @@ func (d *Driver) recoverPauseContainers() { } containers, listErr := dockerClient.ListContainers(docker.ListContainersOptions{ - All: false, // running only + Context: ctx, + All: false, // running only Filters: map[string][]string{ "label": {dockerLabelAllocID}, },