mirror of
https://github.com/nextcloud/all-in-one.git
synced 2024-09-21 07:16:09 +08:00
Merge pull request #4256 from nextcloud/enh/noid/harden-pulling-images
harden pulling images from docker hub issues
This commit is contained in:
commit
5e86d7baaf
|
@ -48,6 +48,15 @@ class DockerController
|
|||
}
|
||||
}
|
||||
|
||||
// Check if docker hub is reachable in order to make sure that we do not try to pull an image if it is down
|
||||
// and try to mitigate issues that are arising due to that
|
||||
if ($pullImage) {
|
||||
if (!$this->dockerActionManager->isDockerHubReachable($container)) {
|
||||
$pullImage = false;
|
||||
error_log('Not pulling the image for the ' . $container->GetContainerName() . ' container because docker hub does not seem to be reachable.');
|
||||
}
|
||||
}
|
||||
|
||||
$this->dockerActionManager->DeleteContainer($container);
|
||||
$this->dockerActionManager->CreateVolumes($container);
|
||||
if ($pullImage) {
|
||||
|
|
|
@ -587,6 +587,21 @@ class DockerActionManager
|
|||
|
||||
}
|
||||
|
||||
public function isDockerHubReachable(Container $container) : bool {
|
||||
$tag = $container->GetImageTag();
|
||||
if ($tag === '%AIO_CHANNEL%') {
|
||||
$tag = $this->GetCurrentChannel();
|
||||
}
|
||||
|
||||
$remoteDigest = $this->dockerHubManager->GetLatestDigestOfTag($container->GetContainerName(), $tag);
|
||||
|
||||
if ($remoteDigest === null) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public function PullImage(Container $container) : void
|
||||
{
|
||||
$imageName = $this->BuildImageName($container);
|
||||
|
|
Loading…
Reference in a new issue