Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Build fails with fs.read entitlement error when dockerfile is outside the build context (buildx >= 0.37.2)

クローズ
#14,285 コメント 7 件 リアクション 13 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

関連するプルリクエストがすでにマージされています。

  • #14286 @locker95 による — マージされずにクローズ
  • #14325 @crazy-max による — マージ済み

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
docker, docker-compose, go
領域
build-system

調査の方向性

Start in pkg/compose/build_bake.go and inspect localBuildPaths, which currently grants fs.read access for build contexts but not the Dockerfile path. Reproduce with a Compose service whose Dockerfile is outside its build context, then check existing build-bake tests for coverage. Done means a local external Dockerfile is included in the fs.read allowlist while dockerfile_inline remains unaffected; an open linked pull request is already addressing this issue.

索引モデルが issue の本文から書いたものです。

説明

Description

Since buildx v0.37.2 (GHSA-gwr2-q96m-6682), buildx bake --progress rawjson enforces filesystem entitlements instead of skipping the consent check. Compose always invokes bake that way, but localBuildPaths in pkg/compose/build_bake.go only grants --allow fs.read= for build.context and build.additional_contexts — not for build.dockerfile. A service whose Dockerfile lives outside its build context therefore no longer builds. Before buildx v0.37.2 the missing grant went unnoticed because the check was skipped under rawjson.

This breaks every Dev Container that uses a Compose service with build:: the devcontainer CLI writes Dockerfile-with-features into a temp directory and points dockerfile: at it through an override file (dockerCompose.ts), which fails with:

additional privileges requested: pass "--allow=fs.read=/private/var/folders/…/T/devcontainercli/container-features/0.76.0-…/Dockerfile-with-features" to grant requested privileges

The code is unchanged in v5.6.0 and on main.

Steps To Reproduce
mkdir -p /tmp/outside && echo 'FROM alpine' > /tmp/outside/Dockerfile
mkdir -p /tmp/repro && cd /tmp/repro
cat > compose.yaml <<'EOF'
services:
  app:
    build:
      context: .
      dockerfile: /tmp/outside/Dockerfile
EOF
docker compose build
[+] Building 0.0s (1/1) FINISHED
 => [internal] load local bake definitions                         0.0s
 => => reading from stdin 466B                                     0.0s
[+] build 0/1
 ⠋ Image repro-app Building                                        0.1s
additional privileges requested: pass "--allow=fs.read=../outside/Dockerfile" to grant requested privileges
Compose Version
Docker Compose version v5.5.1
Docker Environment

macOS (Apple Silicon), Docker Desktop 4.94.0 (241994), buildx v0.37.2

Anything else?

Workaround: BUILDX_BAKE_ENTITLEMENTS_FS=0, which disables the check for all paths.
Suggested fix: add the resolved Dockerfile path to the fs.read allowlist when it is a local path outside the context (dockerfile_inline is unaffected).

主要言語
Go
スター
38.4k
フォーク
5.9k
平均マージ
2日 7時間
マージ済み PR(30日)
60

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

docker/compose のほかの issue

docker/compose の issue をすべて見る

似ている issue

Go の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。