Skip to content

Commit

Permalink
Merge pull request #3682 from nextcloud/fix/3671/skip-starting-container
Browse files Browse the repository at this point in the history
  • Loading branch information
szaimen authored Nov 6, 2023
2 parents 7f3fbbd + bdb4a8c commit dee51b3
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions php/src/Controller/DockerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,21 @@ private function PerformRecursiveContainerStart(string $id, bool $pullContainer
$this->PerformRecursiveContainerStart($dependency, $pullContainer);
}

// Don't start if container is already running
// This is expected to happen if a container is defined in depends_on of multiple containers
if ($container->GetRunningState() instanceof RunningState) {
error_log('Not starting ' . $id . ' because it was already started.');
return;
}

// Skip database image pull if the last shutdown was not clean
if ($id === 'nextcloud-aio-database') {
if ($this->dockerActionManager->GetDatabasecontainerExitCode() > 0) {
$pullContainer = false;
error_log('Not pulling the latest database image because the container was not correctly shut down.');
}
}

$this->dockerActionManager->DeleteContainer($container);
$this->dockerActionManager->CreateVolumes($container);
if ($pullContainer) {
Expand Down

0 comments on commit dee51b3

Please sign in to comment.