docker { logs } returns no lines for containers that log to stderr
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 82/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- docker, typescript
- 領域
- backend
調査の方向性
api/src/unraid-api/graph/resolvers/docker/docker-log.service.ts の DockerLogService.getContainerLogs から始めます。issue によると、docker コマンドからは stdout だけが読み取られています。resolver がタイムスタンプ付きの行をどのように解析して並べ替えるかを確認し、その後、stderr のみを出力するコンテナを使った提示済みの再現例も含め、クエリが stderr の出力も返すことを検証します。
索引モデルが issue の本文から書いたものです。
説明
Environment
Unraid OS Version:
7.4.0 (API 4.37.11+8e587fe2)
Are you using a reverse proxy?
Yes (NPMPlus). I reproduced the issue directly on the server through the API's unix socket (/var/run/unraid-api.sock), without the proxy. The result is the same.
Pre-submission Checklist
- I have verified that my Unraid OS is up to date
- I have tested this issue by accessing my server directly (not through a reverse proxy)
- This is not an Unraid Connect related issue (if it is, please submit via the support form instead)
Issue Description
The docker { logs } query returns an empty lines list and no error for a container that writes its log output to stderr. Containers that log to stdout return their lines as expected.
A client therefore cannot tell "the container logged nothing" from "the container logs to stderr", which is the default for Python's logging and many Go services.
Steps to Reproduce
-
Start a container that only writes to stderr:
docker run -d --name stderr-test alpine sh -c 'while true; do echo "to stderr" >&2; sleep 5; done' -
Check on the host that the output is on stderr only:
# docker logs --tail 3 stderr-test to stderr to stderr to stderr # docker logs --tail 3 stderr-test 2>/dev/null # -
Look up the container id with
query { docker { containers { id names } } }and request its logs, directly on the server:curl -s --unix-socket /var/run/unraid-api.sock http://localhost/graphql \ -H "x-api-key: $KEY" -H "Content-Type: application/json" \ -d '{"query":"{ docker { logs(id: \"<id>\", tail: 3) { lines { timestamp message } } } }"}'
Expected Behavior
The lines from both stdout and stderr, ordered by timestamp, as docker logs shows them.
Actual Behavior
{"data":{"docker":{"logs":{"lines":[]}}}}
No lines and no error. The same happens without tail and with since. On the same server, containers that log to stdout (for example jellyfin, pihole, redis) return lines through the same query.
Additional Context
DockerLogService.getContainerLogs in api/src/unraid-api/graph/resolvers/docker/docker-log.service.ts reads only stdout:
const { stdout } = await execa('docker', args);
docker logs writes the container's stderr stream to its own stderr, so that stream is dropped. The line is the same in v4.30.0, v4.35.0, v4.37.5, v4.37.11 and on main, so this is not a regression of 7.4.0.
Reading both streams would fix it, for example with execa's all: true and parsing all instead of stdout. --timestamps is already passed, so the lines can be put in order.
I searched open and closed issues and pull requests for an existing report and found none.
I first noticed this with a real container (unbound) and tracked it down with the help of an AI assistant. I ran the reproduction above myself on the server.
- 主要言語
- TypeScript
- スター
- 123
- フォーク
- 25
- 平均マージ
- 2日 16時間
- マージ済み PR(30日)
- 9
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
unraid/api のほかの issue
-
Temperature metrics: lm-sensors voltages, fan speeds and power are reported as temperatures (°C)オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
flash { guid } always fails: resolver no longer returns guid but the schema marks it non-nullableオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信
似ている issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
yavorsky/unbuilt.app#65 ·
-
CVE security
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
mckinsey/agents-at-scale-ark#4091 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
factory:subtask
難易度 1/5 1時間未満 初心者へのやさしさ 94/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
NUS-Project-SaBai/project-sabai#386 ·
メンテナーはふだん 3 日以内に返信
-
android needs clarification
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
super-productivity/super-productivity#12105 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信