DOCKER_CONFIG env var is parsed inconsistently and incorrectly in fromDockerConfig / fromDockerContext
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 84/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- docker, typescript
- 領域
- devops
調査の方向性
lib/docker-client.ts の fromDockerConfig と fromDockerContext から始め、各エントリポイントが DOCKER_CONFIG とデフォルトのホームディレクトリパスをどのように解決しているかを追ってください。完了条件は、DOCKER_CONFIG が設定されていない場合の動作を維持しつつ、両方のエントリポイントが config.json と contexts のパスを含め、Docker の設定ディレクトリを一貫して使用することです。
索引モデルが issue の本文から書いたものです。
説明
DOCKER_CONFIG is the path to Docker's config directory (default ~/.docker), but docker-client.ts interprets it two different ways, and neither matches that.
1. fromDockerConfig treats it as the path to config.json
const configPath =
process.env.DOCKER_CONFIG ||
join(homedir(), '.docker', 'config.json');
With DOCKER_CONFIG=/etc/docker-config, this does readFile('/etc/docker-config', 'utf8') on a directory, which fails with EISDIR. That is not ENOENT, so the "config file doesn't exist, use default" branch below doesn't catch it either — the error propagates and fromDockerConfig() throws instead of connecting. It should be join(configDir, 'config.json').
2. fromDockerContext treats it as a directory, then appends .docker
const configDir = process.env.DOCKER_CONFIG || homedir();
const contextsDir = join(configDir, '.docker', 'contexts', 'meta');
const tlsDir = join(configDir, '.docker', 'contexts', 'tls');
The .docker component is only correct for the homedir() fallback. With DOCKER_CONFIG=/etc/docker-config this looks in /etc/docker-config/.docker/contexts/meta rather than /etc/docker-config/contexts/meta, so context lookup fails with Docker contexts directory not found.
The two readings are mutually inconsistent — at most one could be right for a given value of the variable.
Expected
Both should resolve the config directory the same way, e.g.
const configDir = process.env.DOCKER_CONFIG || join(homedir(), '.docker');
// config.json -> join(configDir, 'config.json')
// contexts -> join(configDir, 'contexts', 'meta') / join(configDir, 'contexts', 'tls')
This matches the CLI: https://docs.docker.com/reference/cli/docker/#environment-variables
Notes
Neither path misbehaves when DOCKER_CONFIG is unset, which is presumably why it hasn't come up. Affects main as of a4d3867.
Found while adapting the connection logic in docker-client.ts for another client; I haven't opened a PR. This report was written by Claude (AI-generated) and reviewed by me before filing.
- 主要言語
- TypeScript
- スター
- 107
- フォーク
- 12
- PR マージ指標
- 30日以内にマージされた PR はありません
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
docker/node-sdk のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
-
難易度 3/5 1〜2日 初心者へのやさしさ 70/100
-
Podman compatibility オープン
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
docker/node-sdk の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
bug clawsweeper:linked-pr-open clawsweeper:needs-live-repro clawsweeper:no-new-fix-pr impact:message-loss issue-rating: 🐚 platinum hermit P2 regression
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
calcite-components needs triage refactor
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
Esri/calcite-design-system#15203 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 90/100
danielmiessler/LifeOS#2218 ·