Skip to content

Commit

Permalink
Merge b2ece4f into backport/pause-reconciliation/moderately-funny-puma
Browse files Browse the repository at this point in the history
  • Loading branch information
hc-github-team-nomad-core committed Mar 10, 2023
2 parents 795c3a4 + b2ece4f commit 615e845
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions drivers/docker/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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_".
Expand All @@ -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},
},
Expand Down

0 comments on commit 615e845

Please sign in to comment.