From 6f28eb66e4dc3002c1cc9cb2a656967c35cae333 Mon Sep 17 00:00:00 2001 From: chodeus Date: Tue, 14 Jul 2026 15:59:59 +0800 Subject: [PATCH] fix: don't delete the shared default docker icon when removing an icon-less container Containers with no template icon get /plugins/dynamix.docker.manager/images/question.png recorded as their icon in the webui-info registry (DockerClient.php L346). removeContainer() then unlinks that recorded path when cache flags are set, deleting the shared fallback from the docroot for the whole system until the next reboot. CA Docker Auto-Update triggers this whenever it updates an icon-less container. Also quote and guard the container-list onerror fallback (this.onerror=null) so a missing fallback degrades to one failed request per image instead of an endless 404 retry loop. Fixes #2691 --- emhttp/plugins/dynamix.docker.manager/include/DockerClient.php | 3 ++- .../dynamix.docker.manager/include/DockerContainers.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/emhttp/plugins/dynamix.docker.manager/include/DockerClient.php b/emhttp/plugins/dynamix.docker.manager/include/DockerClient.php index fc51e1ae2a..28b20c0248 100755 --- a/emhttp/plugins/dynamix.docker.manager/include/DockerClient.php +++ b/emhttp/plugins/dynamix.docker.manager/include/DockerClient.php @@ -898,7 +898,8 @@ public function removeContainer($name, $id=false, $cache=false) { // Attempt to remove container $this->getDockerJSON("/containers/$id?force=1", 'DELETE', $code); if (isset($info[$name])) { - if (isset($info[$name]['icon'])) { + // never unlink the shared default icon recorded for icon-less containers + if (isset($info[$name]['icon']) && $info[$name]['icon'] != '/plugins/dynamix.docker.manager/images/question.png') { $iconRAM = $docroot.$info[$name]['icon']; $iconUSB = str_replace($dockerManPaths['images-ram'], $dockerManPaths['images'], $iconRAM); if ($cache>=1 && is_file($iconRAM)) unlink($iconRAM); diff --git a/emhttp/plugins/dynamix.docker.manager/include/DockerContainers.php b/emhttp/plugins/dynamix.docker.manager/include/DockerContainers.php index ca2d0918dc..c6768f5c50 100644 --- a/emhttp/plugins/dynamix.docker.manager/include/DockerContainers.php +++ b/emhttp/plugins/dynamix.docker.manager/include/DockerContainers.php @@ -97,7 +97,7 @@ function my_lang_log($text) { $color = $status=='started' ? 'green-text' : ($status=='paused' ? 'orange-text' : 'red-text'); $update = $updateStatus==1 && !empty($compose) ? 'blue-text' : ''; $icon = $info['icon'] ?: '/plugins/dynamix.docker.manager/images/question.png'; - $image = substr($icon,-4)=='.png' ? "" : (substr($icon,0,5)=='icon-' ? "" : ""); + $image = substr($icon,-4)=='.png' ? "" : (substr($icon,0,5)=='icon-' ? "" : ""); $wait = var_split($autostart[array_search($name,$names)]??'',1); $networks = []; $network_ips = [];