mirror of
https://github.com/unraid/webgui.git
synced 2026-04-24 11:19:25 -05:00
Create rebuild_container
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/php -q
|
||||
<?PHP
|
||||
/* Copyright 2005-2023, Lime Technology
|
||||
* Copyright 2012-2023, Bergware International.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*/
|
||||
?>
|
||||
<?
|
||||
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
|
||||
require_once "$docroot/plugins/dynamix.docker.manager/include/DockerClient.php";
|
||||
|
||||
$DockerClient = new DockerClient();
|
||||
$DockerUpdate = new DockerUpdate();
|
||||
$DockerTemplates = new DockerTemplates();
|
||||
|
||||
$custom = DockerUtil::custom();
|
||||
$subnet = DockerUtil::network($custom);
|
||||
$cpus = DockerUtil::cpus();
|
||||
$tmpl = $DockerTemplates->getUserTemplate($argv[1]);
|
||||
$xml = file_get_contents($tmpl);
|
||||
|
||||
[$cmd,$name,$repository] = xmlToCommand($tmpl);
|
||||
$old = $DockerClient->getImageID($repository);
|
||||
|
||||
removeContainer($name,false,false);
|
||||
execCommand(str_replace('/docker create ','/docker run -d ',$cmd),false);
|
||||
$DockerClient->flushCaches();
|
||||
$new = $DockerClient->getImageID($repository);
|
||||
if ($old && $old != $new) removeImage($old,false);
|
||||
?>
|
||||
Reference in New Issue
Block a user