diff --git a/plugins/dynamix.docker.manager/include/DockerClient.php b/plugins/dynamix.docker.manager/include/DockerClient.php index 3c6b87b252..40f5a0bb8f 100644 --- a/plugins/dynamix.docker.manager/include/DockerClient.php +++ b/plugins/dynamix.docker.manager/include/DockerClient.php @@ -268,11 +268,12 @@ public function getUserTemplate($Container) { return false; } - private function getControlURL(&$ct, $myIP) { + private function getControlURL(&$ct, $myIP, $WebUI) { global $host; $port = &$ct['Ports'][0]; $myIP = $myIP ?: $this->getTemplateValue($ct['Image'], 'MyIP') ?: ($ct['NetworkMode']=='host'||$port['NAT'] ? $host : ($port['IP'] ?: DockerUtil::myIP($ct['Name']))); - $WebUI = preg_replace("%\[IP\]%", $myIP, $this->getTemplateValue($ct['Image'], 'WebUI')); + // Get the WebUI address from the templates as a fallback + $WebUI = preg_replace("%\[IP\]%", $myIP, $WebUI ?: $this->getTemplateValue($ct['Image'], 'WebUI')); if (preg_match("%\[PORT:(\d+)\]%", $WebUI, $matches)) { $ConfigPort = $matches[1]; foreach ($ct['Ports'] as $port) { @@ -306,13 +307,13 @@ public function getAllInfo($reload=false,$com=true,$communityApplications=false) } if ($ct['Running']) { $port = &$ct['Ports'][0]; - $webui = $this->getTemplateValue($ct['Image'], 'WebUI'); + $webui = $tmp['url'] ?: $this->getTemplateValue($ct['Image'], 'WebUI'); if (strlen($webui) > 0 && !preg_match("%\[(IP|PORT:(\d+))\]%", $webui)) { // non-templated webui, user specified $tmp['url'] = $webui; } else { $ip = ($ct['NetworkMode']=='host'||$port['NAT'] ? $host : $port['IP']); - $tmp['url'] = $ip ? (strpos($tmp['url'],$ip)!==false ? $tmp['url'] : $this->getControlURL($ct, $ip)) : $tmp['url']; + $tmp['url'] = $ip ? (strpos($tmp['url'],$ip)!==false ? $tmp['url'] : $this->getControlURL($ct, $ip, $tmp['url'])) : $tmp['url']; } $tmp['shell'] = $tmp['shell'] ?? $this->getTemplateValue($image, 'Shell'); }