diff --git a/php/src/Controller/DockerController.php b/php/src/Controller/DockerController.php index 7de6c1dd..fa121c32 100644 --- a/php/src/Controller/DockerController.php +++ b/php/src/Controller/DockerController.php @@ -33,9 +33,17 @@ class DockerController $this->PerformRecursiveContainerStart($dependency); } + $pullcontainer = true; + if ($id === 'nextcloud-aio-database') { + if ($this->dockerActionManager->GetDatabasecontainerExitCode() > 0) { + $pullcontainer = false; + } + } $this->dockerActionManager->DeleteContainer($container); $this->dockerActionManager->CreateVolumes($container); - $this->dockerActionManager->PullContainer($container); + if ($pullcontainer) { + $this->dockerActionManager->PullContainer($container); + } $this->dockerActionManager->CreateContainer($container); $this->dockerActionManager->StartContainer($container); $this->dockerActionManager->ConnectContainerToNetwork($container); diff --git a/php/src/Docker/DockerActionManager.php b/php/src/Docker/DockerActionManager.php index 455d2999..cb1850f1 100644 --- a/php/src/Docker/DockerActionManager.php +++ b/php/src/Docker/DockerActionManager.php @@ -261,19 +261,14 @@ class DockerActionManager public function PullContainer(Container $container) : void { - $pullcontainer = true; - if ($container->GetIdentifier() === 'nextcloud-aio-database') { - if ($this->GetDatabasecontainerExitCode() > 0) { - $pullcontainer = false; - } - } - if ($pullcontainer) { - $url = $this->BuildApiUrl(sprintf('images/create?fromImage=%s', urlencode($this->BuildImageName($container)))); - try { - $this->guzzleClient->post($url); - } catch (RequestException $e) { - throw $e; - } + $url = $this->BuildApiUrl(sprintf('images/create?fromImage=%s', urlencode($this->BuildImageName($container)))); + try { + $this->guzzleClient->post($url); + } catch (RequestException $e) { + error_log($e->getMessage()); + // Don't exit here because it is possible that the image is already present + // and we ran into docker hub limits. + // We will exit later if not image should be available. } }