File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed
Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -398,17 +398,20 @@ class DeploymentResult {
398398
399399function Check-Docker {
400400 try {
401- # Try to get Docker info to check if Docker daemon is running
402- $dockerInfo = docker info 2>&1
403- if ($dockerInfo -match " ERROR: error during connect" ) {
401+ # Try to get Docker info to check if Docker daemon is running
402+ $dockerInfo = docker info 2>&1
403+ if ($LASTEXITCODE -ne 0 -or $ dockerInfo -match " error during connect" ) {
404404 return $false
405- } else {
405+ }
406+ else {
406407 return $true
407408 }
408- } catch {
409+ }
410+ catch {
409411 Write-Host " An error occurred while checking Docker status." - ForegroundColor Red
410412 Write-Host $_.Exception.Message - ForegroundColor Red
411- return $false }
413+ return $false
414+ }
412415}
413416
414417# Check if Docker is running before proceeding
You can’t perform that action at this time.
0 commit comments