Skip to content

Commit

Permalink
Output debug info in case Container already started
Browse files Browse the repository at this point in the history
  • Loading branch information
Commifreak committed Dec 22, 2022
1 parent 521f48b commit c01d291
Showing 1 changed file with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,6 @@ function backupLog($msg, $newLine = true, $skipDate = false)

} else {
backupLog("Not stopping {$docker['Name']}: Not started! [{$docker['Paused']} / {$docker['Status']}]");
backupLog("DEBUG-INFO while this happened:");
$res = shell_exec("docker ps -a");
backupLog($res );
}
}
}
Expand Down Expand Up @@ -351,6 +348,23 @@ function backupLog($msg, $newLine = true, $skipDate = false)
backupLog("Starting $docker... (try #$dockerStartTry) ", false);
$dockerStartCode = $dockerClient->startContainer($docker);
if ($dockerStartCode != 1) {
if($dockerStartCode == "Container already started") {
backupLog("Hmm - container is already started! DEBUG Info following...", true, true);
foreach ($dockerRunning as $runningContainer) {
if($runningContainer['Name'] == $docker) {
backupLog("BEFORE backing up container status: ".json_encode($runningContainer));
$nowRunning = $dockerClient->getDockerContainers();
foreach ($nowRunning as $nowRunningContainer) {
if($nowRunningContainer["Name"] == $docker) {
backupLog("AFTER backing up container status: ".json_encode($nowRunningContainer));
}
}
}
}
$dockerContainerStarted = true;
continue;
}

backupLog("Error while starting container! - Code: " . $dockerStartCode, true, true);
if ($dockerStartTry < 3) {
$dockerStartTry++;
Expand Down

0 comments on commit c01d291

Please sign in to comment.