mirror of
https://github.com/unraid/webgui.git
synced 2026-04-24 11:19:25 -05:00
fix: prevent deleting containers that are assigned as a network
This commit is contained in:
@@ -824,6 +824,13 @@ class DockerClient {
|
||||
global $docroot, $dockerManPaths;
|
||||
$id = $id ?: $name;
|
||||
$info = DockerUtil::loadJSON($dockerManPaths['webui-info']);
|
||||
|
||||
// Check to see if the container is linked to other containers
|
||||
$networks = array_map(function ($n) { return $n['NetworkMode']; }, $this->getDockerContainers());
|
||||
if (in_array("container:{$name}", $networks)) {
|
||||
return "Container currently assigned as network for another container.";
|
||||
}
|
||||
|
||||
// Attempt to remove container
|
||||
$this->getDockerJSON("/containers/$id?force=1", 'DELETE', $code);
|
||||
if (isset($info[$name])) {
|
||||
|
||||
Reference in New Issue
Block a user