BuildKit fails to start container process under Rosetta emulation
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 10.3k
- Forks
- 1.5k
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 48
Description
Contributing guidelines and issue reporting guide
- I've read the contributing guidelines and wholeheartedly agree. I've also read the issue reporting guide.
Well-formed report checklist
- I have found a bug that the documentation does not mention anything about my problem
- I have found a bug that there are no open or closed issues that are related to my problem
- I have provided version/information about my environment and done my best to provide a reproducer
Description of bug
Bug description
BuildKit fails to RUN commands when running under amd64 emulation through Rosetta, logging a "signal: trace/breakpoint trap" / "failed to open elf at -exec-root=/var/run/docker" error.
Reproduction
I am running containers under Apple's container runtime, but need them to be running as essentially --platform=linux/amd64 and supporting "Docker in Docker" usage. I am able to run images within the nested Docker daemon, but building them fails:
# start dind daemon
container run -d --rm --arch amd64 --cap-add ALL --read-only-path NONE -v .:/repro --name rosetta-repro docker.io/docker:29.7.2
# attempt a build
cat <<EOF > Dockerfile
FROM debian
RUN uname -a
EOF
container exec -w /repro rosetta-repro docker build .
That build command always crashes with an error like:
#5 [2/2] RUN uname -a
#5 0.182 runc run failed: unable to start container process: error during container init: error running prestart hook #0: signal: trace/breakpoint trap, stdout: , stderr: rosetta error: failed to open elf at -exec-root=/var/run/docker
#5 0.182
#5 ERROR: process "/bin/sh -c uname -a" did not complete successfully: exit code: 1
Workaround / alternative
If I instead use Docker's legacy build system with same as above, setting DOCKER_BUILDKIT=0:
container exec -w /repro -e DOCKER_BUILDKIT=0 rosetta-repro docker build .
the build completes successfully, with its RUN uname -a step logging something like:
Linux 129cc24a0c02 6.18.5 #1 SMP Wed Jan 28 20:00:41 UTC 2026 x86_64 GNU/Linux
Version information
The host of all this is running container CLI version 1.3.0 (build: release, commit: d6de569) under macOS 26.6.2 (25G83). My understanding is that the overall setup ends up being:
- Apple Silicon (arm64) host
- running a lightweight Linux VM per container (still arm64/aarch64)
- the processes of the container itself are launched as amd64/x84_64
- presumedly via the usual binfmt mechanism but with Apple's own Rosetta helper (rather than e.g. Qemu) as the handler, see https://developer.apple.com/documentation/virtualization/running-intel-binaries-in-linux-vms
- thus the whole container namespace is running emulated, which seems to generally work except for something inside BuildKit
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the reported container exec ... docker build . command with the provided Dockerfile and Rosetta setup. Compare the failing BuildKit path for the RUN uname -a step with the successful legacy build and inspect the reported runc prestart-hook error. Done means identifying and fixing the BuildKit-specific failure under amd64 Rosetta emulation, with the reproduction no longer failing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, dockerfile, go
- Domain
- build-system, devops, infrastructure
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100