update_container ignores pull errors that Docker returns as HTTP error and recreates the container from the old image
メンテナーはふだん 1 日以内に返信
評価
調査の方向性
Start with DockerClient::getDockerJSON() and pullImage() in include/DockerClient.php, then inspect pullImage_nchan() and the update flow in scripts/update_container. Trace how HTTP status and Docker's message response reach the update log and exit status. Done means failed pulls leave the existing container untouched, report the error, and make the script exit nonzero; verify with the unreachable registry response described in the issue.
索引モデルが issue の本文から書いたものです。
説明
Unraid version: 7.2.3 (same code in current master)
Describe the bug
If docker pull fails before the download starts (registry timeout, TLS handshake timeout, DNS or auth error), update_container does not notice. It stops and removes the container, recreates it from the image that is still on disk, shows no error and exits with code 0.
Real error that triggers it (from docker pull on the same host, same night):
Error response from daemon: Get "https://lscr.io/v2/": net/http: request canceled (Client.Timeout exceeded while awaiting headers)
Error response from daemon: Get "https://lscr.io/v2/": net/http: TLS handshake timeout
Root cause
DockerClient::getDockerJSON()reads the HTTP status into$code, butpullImage()never looks at itpullImage_nchan()inscripts/update_containeronly fails on anerrorkey in the streamed lines- Docker only streams
{"error": ...}after the response has started. Errors before that (mobyimage_routes.go:if !output.Flushed() { return err }) come back as HTTP 500 with a body{"message": "..."}. There is noerrorkey, sopullImage_nchan()returnstrue
To reproduce
What Docker returns for an unreachable registry:
$ curl -si --unix-socket /var/run/docker.sock -X POST 'http://localhost/images/create?fromImage=registry.invalid/foo/bar:latest'
HTTP/1.1 500 Internal Server Error
...
{"message":"Get \"https://registry.invalid/v2/\": dial tcp: lookup registry.invalid on 192.168.9.3:53: no such host"}
Same check that pullImage_nchan() does, without touching any container:
<?php
require_once '/usr/local/emhttp/plugins/dynamix.docker.manager/include/DockerClient.php';
$c = new DockerClient(); $strError = '';
$c->pullImage('registry.invalid/foo/bar:latest', function ($line) use (&$strError) {
$cnt = json_decode($line, true);
if (isset($cnt['error'])) $strError = $cnt['error'];
});
echo empty($strError) ? "treated as success\n" : "error: $strError\n";
Output on 7.2.3: treated as success
Full path: a container with an update available whose registry is unreachable at that moment (e.g. lscr.io timing out) → apply update or update_container <name>.
Expected behavior
- The pull error is shown in the update log
- The container is NOT stopped, removed or recreated
- The script exits with a non-zero code, so callers (e.g. the Appdata Backup plugin) can detect the failure
Actual behavior
- No error is shown
- The container is stopped, removed and recreated from the old image (needless downtime)
- Exit code 0. Callers report the update as successful
Real-world impact
The nightly auto-update (Appdata Backup plugin, which calls update_container) ran for swag without any error, but the container stayed on an old image with a known PHP vulnerability. A plain docker pull at the same time of night later failed with the lscr.io timeouts above, which matches this path.
Suggested fix
In pullImage() / pullImage_nchan() treat a non-2xx $code as failure and show the message field. Exit non-zero from update_container when any pull failed.
- 主要言語
- PHP
- スター
- 266
- フォーク
- 116
- 平均マージ
- 1日 5時間
- マージ済み PR(30日)
- 4
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
unraid/webgui のほかの issue
-
CPU core labels missing for Low-Power E-cores on hybrid Intel CPUs (Arrow Lake-H) — get_intel_core_types() ignores /sys/devices/cpu_lowpower対応中かも @dgongut が今日担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
unraid/webgui#2785 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
rsyslog_config: "Mirror syslog to flash" rule is appended again on every Apply — each line written to the boot device N times対応中かも @junkerderprovinz が 38 日前に担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
メンテナーはふだん 1 日以内に返信
-
Notification e-mails are sent without Date and Message-ID headers対応中かも @nofuturekid が 56 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
unraid/webgui#2781 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Static asset caching misses the Connect plugin's hashed bundle: ~144 JS chunks (8.5 MB) revalidate on every page load対応中かも @davidcoulson が 54 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信
似ている issue
-
area: tests area: user refactoring
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
nplhse/collaborative-ivena-statistics#1845 ·
メンテナーはふだん 1 日以内に返信
-
[Sync EN] filesystem: document the ValueError of fgets(), file_get_contents(), and touch() (#6167)オープンsync-en
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信
-
sync-en
難易度 1/5 1〜3時間 初心者へのやさしさ 88/100
メンテナーはふだん 2 日以内に返信
-
Перевод устарел
難易度 2/5 1〜3時間 初心者へのやさしさ 90/100
メンテナーはふだん 1 日以内に返信
-
Documentation Feature: Events / Calendar
難易度 1/5 1時間未満 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信