@@ -1271,7 +1271,7 @@ func (p *DockerProvider) findContainerByName(ctx context.Context, name string) (
1271
1271
1272
1272
// Note that, 'name' filter will use regex to find the containers
1273
1273
filter := filters .NewArgs (filters .Arg ("name" , fmt .Sprintf ("^%s$" , name )))
1274
- containers , err := p .client .ContainerList (ctx , container.ListOptions {Filters : filter })
1274
+ containers , err := p .client .ContainerList (ctx , container.ListOptions {All : true , Filters : filter })
1275
1275
if err != nil {
1276
1276
return nil , fmt .Errorf ("container list: %w" , err )
1277
1277
}
@@ -1369,6 +1369,17 @@ func (p *DockerProvider) ReuseOrCreateContainer(ctx context.Context, req Contain
1369
1369
lifecycleHooks : []ContainerLifecycleHooks {combineContainerHooks (defaultHooks , req .LifecycleHooks )},
1370
1370
}
1371
1371
1372
+ if p .config .RyukDisabled {
1373
+ // ryuk disabled, ensure the container we are about to reuse is running
1374
+ if c .State != "running" {
1375
+ // found container to reuse, but it is not in state running
1376
+ fmt .Println ("Attempting to start: " + req .Name + " in state: " + c .State )
1377
+ if err := dc .Start (ctx ); err != nil {
1378
+ return dc , fmt .Errorf ("start container %s in state %s: %w" , req .Name , c .State , err )
1379
+ }
1380
+ }
1381
+ }
1382
+
1372
1383
err = dc .startedHook (ctx )
1373
1384
if err != nil {
1374
1385
return nil , err
0 commit comments