@@ -1271,7 +1271,7 @@ func (p *DockerProvider) findContainerByName(ctx context.Context, name string) (
12711271
12721272 // Note that, 'name' filter will use regex to find the containers
12731273 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 })
12751275 if err != nil {
12761276 return nil , fmt .Errorf ("container list: %w" , err )
12771277 }
@@ -1369,6 +1369,16 @@ func (p *DockerProvider) ReuseOrCreateContainer(ctx context.Context, req Contain
13691369 lifecycleHooks : []ContainerLifecycleHooks {combineContainerHooks (defaultHooks , req .LifecycleHooks )},
13701370 }
13711371
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+ if err := dc .Start (ctx ); err != nil {
1377+ return dc , fmt .Errorf ("start container %s in state %s: %w" , req .Name , c .State , err )
1378+ }
1379+ }
1380+ }
1381+
13721382 err = dc .startedHook (ctx )
13731383 if err != nil {
13741384 return nil , err
0 commit comments