Docker code cleanup/refactor and bug fixes:

- Dont start container after update if it was in a stopped state before the update

- Dont try to stop a container if it is not running (was causing warnings to be logged)

- Reduced script tag generation for docker pull operations

- Correctly clean up old orphan images after updating a container (was broken before)

- Eliminated race condition when deleting both container and image

- Switched to use SweetAlert instead of jQuery UI dialogs for prompts and alerts
This commit is contained in:
Eric Schultz
2016-02-12 07:15:23 -08:00
parent bb7a9a8080
commit 4f560d7ee5
8 changed files with 706 additions and 687 deletions
@@ -12,10 +12,10 @@
*/
?>
<?
exec("pgrep docker",$pid);
if (count($pid)==1) exit(0);
exec("pgrep docker", $pid);
if (count($pid) == 1) exit(0);
require_once("/usr/local/emhttp/plugins/dynamix.docker.manager/include/DockerClient.php");
require_once '/usr/local/emhttp/plugins/dynamix.docker.manager/include/DockerClient.php';
$DockerClient = new DockerClient();
$DockerTemplates = new DockerTemplates();
@@ -32,15 +32,14 @@ if (!isset($check)) {
$DockerTemplates->getAllInfo(true);
echo " Done.";
} else {
require_once("/usr/local/emhttp/webGui/include/Wrappers.php");
require_once '/usr/local/emhttp/webGui/include/Wrappers.php';
$notify = "/usr/local/emhttp/webGui/scripts/notify";
$unraid = parse_plugin_cfg("dynamix",true);
$server = strtoupper($var['NAME']);
$output = $unraid['notify']['docker_notify'];
$list = $DockerClient->getDockerContainers();
$info = $DockerTemplates->getAllInfo(true);
foreach ($list as $ct) {
foreach ($DockerClient->getDockerContainers() as $ct) {
$name = $ct['Name'];
$image = $ct['Image'];
if ($info[$name]['updated'] == "false") {