From 786c09f7e45b31b7e5973a9c180e6033d4ff3d05 Mon Sep 17 00:00:00 2001 From: Clint Armstrong Date: Thu, 31 Aug 2017 14:28:13 -0400 Subject: [PATCH] Always purge stopped containers --- client/driver/docker.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/client/driver/docker.go b/client/driver/docker.go index 0287aad53d3..7552700bf66 100644 --- a/client/driver/docker.go +++ b/client/driver/docker.go @@ -1275,10 +1275,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 } @@ -1300,7 +1301,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 }