|
@@ -10,6 +10,7 @@ import (
|
|
|
"github.com/docker/docker/api/types/container"
|
|
|
"github.com/docker/docker/builder"
|
|
|
containerpkg "github.com/docker/docker/container"
|
|
|
+ "github.com/docker/docker/errdefs"
|
|
|
"github.com/docker/docker/pkg/stringid"
|
|
|
"github.com/pkg/errors"
|
|
|
)
|
|
@@ -128,9 +129,9 @@ func (e *statusCodeError) StatusCode() int {
|
|
|
// RemoveAll containers managed by this container manager
|
|
|
func (c *containerManager) RemoveAll(stdout io.Writer) {
|
|
|
for containerID := range c.tmpContainers {
|
|
|
- if err := c.backend.ContainerRm(containerID, &backend.ContainerRmConfig{ForceRemove: true, RemoveVolume: true}); err != nil {
|
|
|
+ if err := c.backend.ContainerRm(containerID, &backend.ContainerRmConfig{ForceRemove: true, RemoveVolume: true}); err != nil && !errdefs.IsNotFound(err) {
|
|
|
_, _ = fmt.Fprintf(stdout, "Removing intermediate container %s: %v\n", stringid.TruncateID(containerID), err)
|
|
|
- return
|
|
|
+ continue
|
|
|
}
|
|
|
delete(c.tmpContainers, containerID)
|
|
|
_, _ = fmt.Fprintf(stdout, " ---> Removed intermediate container %s\n", stringid.TruncateID(containerID))
|