diff --git a/plugins/dynamix.docker.manager/include/CreateDocker.php b/plugins/dynamix.docker.manager/include/CreateDocker.php index 488f8491b..bda3d324f 100644 --- a/plugins/dynamix.docker.manager/include/CreateDocker.php +++ b/plugins/dynamix.docker.manager/include/CreateDocker.php @@ -1,7 +1,7 @@
'; goto END; @@ -175,15 +176,18 @@ if (isset($_GET['updateContainer'])){ if ($echo && !pullImage($Name, $Repository)) continue; $oldContainerInfo = $DockerClient->getContainerDetails($Name); // determine if the container is still running + $startContainer = false; if (!empty($oldContainerInfo) && !empty($oldContainerInfo['State']) && !empty($oldContainerInfo['State']['Running'])) { // since container was already running, put it back it to a running state after update $cmd = str_replace('/docker create ', '/docker run -d ', $cmd); + $startContainer = true; // attempt graceful stop of container first stopContainer($Name, $echo); } // force kill container if still running after 10 seconds if (empty($_GET['communityApplications'])) removeContainer($Name, $echo); execCommand($cmd, $echo); + if ($startContainer) addRoute($Name); // add route for remote WireGuard access $DockerClient->flushCaches(); $newImageID = $DockerClient->getImageID($Repository); // remove old orphan image since it's no longer used by this container diff --git a/plugins/dynamix.docker.manager/include/DockerClient.php b/plugins/dynamix.docker.manager/include/DockerClient.php index 36d2aee6a..8d4555a0e 100644 --- a/plugins/dynamix.docker.manager/include/DockerClient.php +++ b/plugins/dynamix.docker.manager/include/DockerClient.php @@ -1,7 +1,7 @@ getDockerJSON("/containers/$id/start", 'POST', $code); $this->flushCache($this::$containersCache); + addRoute($id); // add route for remote WireGuard access return $code; } @@ -788,6 +789,7 @@ class DockerClient { public function restartContainer($id) { $this->getDockerJSON("/containers/$id/restart", 'POST', $code); $this->flushCache($this::$containersCache); + addRoute($id); // add route for remote WireGuard access return $code; } diff --git a/plugins/dynamix.docker.manager/include/Helpers.php b/plugins/dynamix.docker.manager/include/Helpers.php index 0a6cece63..df3c14523 100644 --- a/plugins/dynamix.docker.manager/include/Helpers.php +++ b/plugins/dynamix.docker.manager/include/Helpers.php @@ -1,7 +1,7 @@ /dev/null"); + } +} + function xml_encode($string) { return htmlspecialchars($string, ENT_XML1, 'UTF-8'); }