Merge pull request #3682 from nextcloud/fix/3671/skip-starting-container

This commit is contained in:
Simon L 2023-11-06 16:10:47 +01:00 committed by GitHub
commit dee51b3804
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -33,12 +33,21 @@ class DockerController
$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) {