Top-level `docker bake` ignores the selected builder (`docker buildx use`) — builds on the context's docker driver instead of the current docker-container builder
まだ誰も着手していません。
評価
調査の方向性
デフォルト以外の Docker コンテキストと選択した docker-container builder を使って不一致を再現し、トップレベルの docker bake エントリポイントと docker buildx bake を比較します。次に、CLI がトップレベルのエイリアスをどのようにディスパッチするか、また各経路が現在の builder をどのように解決するかを調べます。この構成で両方のコマンドが選択した builder を使用するか、ディスパッチの担当が別の場所にある場合に issue が移管されれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Contributing guidelines
- I've read the contributing guidelines and wholeheartedly agree
I've found a bug and checked that ...
- ... the documentation does not mention anything about my problem
- ... there are no open or closed issues that are related to my problem
Description
Given a docker-container builder selected as the current builder (via docker buildx create --use / docker buildx use), the top-level docker bake <target> builds on the active docker context's implicit docker-driver builder, while docker buildx bake <target> builds on the selected docker-container builder. The two commands pick different builders from identical state.
Expected behaviour
Both docker bake and docker buildx bake should build with the builder that is currently selected — the one marked * in docker buildx ls and recorded in ~/.docker/buildx/current. docker bake reports Usage: docker buildx bake in its --help, so the two are expected to resolve the builder identically.
Actual behaviour
With a docker-container builder selected as current (confirmed by docker buildx ls and ~/.docker/buildx/current), and a non-default docker context active:
docker buildx bake app→#0 building with "repro-buildx" instance using docker-container driver✅docker bake app→#0 building with "repro-ctx" instance using docker driver❌ — falls back to the active context's implicit docker-driver builder, ignoring the selection.
This has real consequences: the docker-container driver supports cache exporters and features the docker driver does not, and tooling that acts on the selected builder (e.g. reproducible-containers/buildkit-cache-dance, which injects/extracts cache mounts against the selected builder) then silently operates on a different builder than the one docker bake actually used.
Buildx version
github.com/docker/buildx v0.35.0-desktop.2 b554ce1decd8b509893b1e7c6227eabfb923d094
Also reproduces on GitHub Actions with the upstream release github.com/docker/buildx v0.35.0 a319e5b15052cf6557ceb666eb8ff6e32380b782 (Docker 29.6.2, docker/setup-docker-action@v5 + docker/setup-buildx-action@v4).
Docker info
Client: Docker 29.6.2, Context: desktop-linux, buildx v0.35.0-desktop.2
Server:
Server Version: 29.6.2
Storage Driver: overlayfs (io.containerd.snapshotter.v1)
Cgroup Version: 2
containerd version: e53c7c1516c3b2bff98eb76f1f4117477e6f4e66
runc version: v1.3.6-0-g491b69ba
Kernel Version: 6.12.76-linuxkit
Operating System: Docker Desktop
OSType: linux
Architecture: aarch64
CPUs: 10 / Total Memory: 7.65GiB
(plugin list, labels and local paths trimmed)
Builders list
Current builder is the docker-container instance (*), yet docker bake used the repro-ctx docker driver:
NAME/NODE DRIVER/ENDPOINT STATUS BUILDKIT PLATFORMS
repro-buildx* docker-container
\_ repro-buildx0 \_ repro-ctx inactive
default docker
\_ default \_ default running v0.31.2 linux/amd64 (+2), ...
desktop-linux docker
\_ desktop-linux \_ desktop-linux running v0.31.2 linux/amd64 (+2), ...
repro-ctx docker
\_ repro-ctx \_ repro-ctx running v0.31.2 linux/amd64 (+2), ...
$ cat ~/.docker/buildx/current
{"Key":"repro-ctx","Name":"repro-buildx","Global":false}
Configuration
Minimal reproduction (mirrors what docker/setup-docker-action — creates and uses a non-default context — and docker/setup-buildx-action --use do). The essential ingredients are a non-default active docker context plus a docker-container builder selected as current:
# Dockerfile
# syntax=docker/dockerfile:1
FROM alpine
RUN echo hello
# docker-bake.hcl
target "app" {
dockerfile = "Dockerfile"
}
# create + use a non-default context pointing at the same daemon
$ docker context create repro-ctx --docker host="$(docker context inspect $(docker context show) --format '{{.Endpoints.docker.Host}}')"
$ docker context use repro-ctx
# create a docker-container builder and select it
$ docker buildx create --name repro-buildx --driver docker-container --use
$ cat ~/.docker/buildx/current
{"Key":"repro-ctx","Name":"repro-buildx","Global":false} # docker-container builder is current
# same target, two commands, different builder:
$ docker bake app # -> #0 building with "repro-ctx" instance using docker driver (unexpected)
$ docker buildx bake app # -> #0 building with "repro-buildx" instance using docker-container driver (expected)
Build logs
# docker bake app
#0 building with "repro-ctx" instance using docker driver
# docker buildx bake app
#0 building with "repro-buildx" instance using docker-container driver
Additional info
~/.docker/buildx/currentcorrectly records thedocker-containerselection keyed to the active context, sodocker buildx use/--useitself works — only the top-leveldocker bakeentrypoint diverges.- The trigger requires a non-default active docker context whose implicit default is the
dockerdriver, plus adocker-containerbuilder selected as current. With the default context active, both commands agree. - Top-level
docker bake --helpprintsUsage: docker buildx bake, so it appears to route through buildx; the divergence seems to be in how the top-level command entrypoint resolves the current builder vs. thedocker buildx bakesubcommand path. (If the top-levelbakealias is registered/dispatched by docker/cli rather than buildx, this may need to be transferred there.)
- 主要言語
- Go
- スター
- 6.1k
- フォーク
- 2.2k
- 平均マージ
- 1日 10時間
- マージ済み PR(30日)
- 47
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
docker/cli のほかの issue
-
kind/bug status/0-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
kind/bug status/0-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
-
kind/feature status/0-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
-
kind/bug status/0-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
-
Bob Shell support オープンenhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
santhosh-tekuri/jsonschema#276 ·