Add docker labels for WebUI and Icon

This commit is contained in:
bergware
2021-05-18 18:31:43 +02:00
parent 27c1872773
commit edfc85d365
2 changed files with 9 additions and 0 deletions

View File

@@ -295,6 +295,9 @@ class DockerTemplates {
$tmp['paused'] = $ct['Paused'];
$tmp['autostart'] = in_array($name, $autoStart);
$tmp['cpuset'] = $ct['CPUset'];
// read docker label for WebUI & Icon
if ($ct['Url'] && !$tmp['url']) $tmp['url'] = $ct['Url'];
if ($ct['Icon']) $tmp['icon'] = $ct['Icon'];
if (!is_file($tmp['icon']) || $reload) $tmp['icon'] = $this->getIcon($image,$name);
if ($ct['Running']) {
$port = &$ct['Ports'][0];
@@ -884,6 +887,8 @@ class DockerClient {
[$net, $id] = explode(':',$c['NetworkMode']);
$c['CPUset'] = $info['HostConfig']['CpusetCpus'];
$c['BaseImage'] = $ct['Labels']['BASEIMAGE'] ?? false;
$c['Icon'] = $info['Config']['Labels']['net.unraid.docker.icon'] ?? false;
$c['Url'] = $info['Config']['Labels']['net.unraid.docker.webui'] ?? false;
$c['Ports'] = [];
if ($id) $c['NetworkMode'] = $net.str_replace('/',':',DockerUtil::ctMap($id)?:'/???');
if ($driver[$c['NetworkMode']]=='bridge') {

View File

@@ -271,6 +271,10 @@ function xmlToCommand($xml, $create_paths=false) {
$Variables[] = 'TZ="'.$var['timeZone'].'"';
// Add HOST_OS variable
$Variables[] = 'HOST_OS="Unraid"';
// Docker labels for WebUI and Icon
$Labels[] = 'net.unraid.docker.managed=dockerman';
if (strlen($xml['WebUI'])) $Labels[] = 'net.unraid.docker.webui='.escapeshellarg($xml['WebUI']);
if (strlen($xml['Icon'])) $Labels[] = 'net.unraid.docker.icon='.escapeshellarg($xml['Icon']);
foreach ($xml['Config'] as $key => $config) {
$confType = strtolower(strval($config['Type']));