diff --git a/emhttp/plugins/dynamix.docker.manager/include/DockerClient.php b/emhttp/plugins/dynamix.docker.manager/include/DockerClient.php
index 9ee25b6ab5..af487dba94 100755
--- a/emhttp/plugins/dynamix.docker.manager/include/DockerClient.php
+++ b/emhttp/plugins/dynamix.docker.manager/include/DockerClient.php
@@ -923,7 +923,22 @@ public function pullImage($image, $callback=null) {
]))."\r\n";
}
- $ret = $this->getDockerJSON("/images/create?fromImage=".urlencode($image), 'POST', $code, $callback, false, $header);
+ // The daemon streams {"error":...} only once the pull has started. Failures before that (registry
+ // unreachable, DNS, TLS, auth) come back as an HTTP error with a {"message":...} body, which the
+ // callers of this function do not look at. Turn such a reply into an "error" line for them.
+ // An empty message ("", "0") does not count as reported: the callers treat an empty() error as success.
+ $reported = false;
+ $wrapped = $callback ? function ($line) use ($callback, &$code, &$reported) {
+ $cnt = json_decode($line, true);
+ if (is_array($cnt) && !empty($cnt['error'])) $reported = true;
+ elseif ($code !== true && is_array($cnt) && !empty($cnt['message'])) {
+ $line = json_encode(['error' => $cnt['message']])."\n";
+ $reported = true;
+ }
+ $callback($line);
+ } : null;
+ $ret = $this->getDockerJSON("/images/create?fromImage=".urlencode($image), 'POST', $code, $wrapped, false, $header);
+ if ($callback && $code !== true && !$reported) $callback(json_encode(['error' => is_string($code) ? $code : 'Pull failed'])."\n");
$this->flushCache($this::$imagesCache);
return $ret;
}
diff --git a/emhttp/plugins/dynamix.docker.manager/scripts/update_container b/emhttp/plugins/dynamix.docker.manager/scripts/update_container
index e753f3dcce..d485146c8c 100755
--- a/emhttp/plugins/dynamix.docker.manager/scripts/update_container
+++ b/emhttp/plugins/dynamix.docker.manager/scripts/update_container
@@ -127,6 +127,8 @@ function pullImage_nchan($name, $image) {
write("addLog\0
"._('TOTAL DATA PULLED').": ".$DockerClient->formatBytes(array_sum($alltotals)));
if (!empty($strError)) {
write("addLog\0
"._('Error').": ".htmlspecialchars($strError)."");
+ write("addLog\0"._('The container was not changed'));
+ my_logger("Pull of $image failed, container $name not updated");
return false;
}
return true;
@@ -152,6 +154,7 @@ $style[] = "fieldset.docker{border:solid thin;margin-top:8px}";
$style[] = "legend{font-size:1.1rem!important;font-weight:bold}";
$style[] = "";
+$failed = false;
write(implode($style)."