Merge pull request #3148 from clinta/purge-stopped

Always purge stopped containers
This commit is contained in:
Alex Dadgar 2017-09-05 17:18:05 -07:00 committed by GitHub
commit 31f9e099d9
1 changed files with 3 additions and 2 deletions

View File

@ -1305,10 +1305,11 @@ CREATE:
containerName := "/" + config.Name
d.logger.Printf("[DEBUG] driver.docker: searching for container name %q to purge", containerName)
for _, shimContainer := range containers {
d.logger.Printf("[DEBUG] driver.docker: listed container %+v", container)
d.logger.Printf("[DEBUG] driver.docker: listed container %+v", shimContainer.Names)
found := false
for _, name := range shimContainer.Names {
if name == containerName {
d.logger.Printf("[DEBUG] driver.docker: Found container %v: %v", containerName, shimContainer.ID)
found = true
break
}
@ -1330,7 +1331,7 @@ CREATE:
// See #2802
return nil, structs.NewRecoverableError(err, true)
}
if container != nil && (container.State.Running || container.State.FinishedAt.IsZero()) {
if container != nil && container.State.Running {
return container, nil
}