File tree Expand file tree Collapse file tree 1 file changed +16
-9
lines changed Expand file tree Collapse file tree 1 file changed +16
-9
lines changed Original file line number Diff line number Diff line change @@ -460,16 +460,23 @@ def compose(self):
460
460
461
461
462
462
def detect_backend ():
463
- if shutil .which ("docker" ) and (
464
- shutil .which ("docker-compose" ) or shutil .which ("docker compose" )
465
- ):
466
- # If docker is available, we can use docker compose (subcommand)
467
- # or docker-compose (standalone binary)
468
- return "docker"
469
- elif shutil .which ("podman" ) and shutil .which ("podman-compose" ):
463
+ if shutil .which ("docker" ):
464
+ try :
465
+ subprocess .run (
466
+ ["docker" , "compose" , "version" ],
467
+ check = True ,
468
+ stdout = subprocess .DEVNULL ,
469
+ stderr = subprocess .DEVNULL ,
470
+ )
471
+ return "docker"
472
+ except Exception :
473
+ pass
474
+ # Check for legacy 'docker-compose' binary
475
+ if shutil .which ("docker-compose" ):
476
+ return "docker"
477
+ if shutil .which ("podman" ) and shutil .which ("podman-compose" ):
470
478
return "podman"
471
- else :
472
- raise RuntimeError ("Neither Docker nor Podman found." )
479
+ raise RuntimeError ("Neither Docker nor Podman found." )
473
480
474
481
475
482
def run_cmd (cmd : list [str ], envs : dict [str , str ] | None = None ):
You can’t perform that action at this time.
0 commit comments