[Bug]: `container build` transfers an empty local context and `COPY` cannot find files
- Dominant language
- Swift
- Stars
- 49.9k
- Forks
- 1.8k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 22
Description
### I have done the following
- [x] I have searched the existing issues
- [ ] If possible, I've reproduced the issue using the 'main' branch of this project
### Steps to reproduce
```sh
mkdir container-context-repro
cd container-context-repro
printf '%s\n' \
'FROM scratch' \
'COPY staged-run.sh /run.sh' >Dockerfile
printf '%s\n' '#!/bin/sh' >staged-run.sh
container build \
--platform linux/arm64 \
--progress plain \
--tag local/container-context-repro:latest \
.
```
There is no `.dockerignore`.
## Current behaviour
```text
#1 [internal] load build definition from Dockerfile
#1 transferring dockerfile: 2B 0.0s done
#1 DONE 0.0s
#2 [internal] load .dockerignore
#2 transferring context: 2B done
#2 DONE 0.0s
#3 [internal] load build context
#3 transferring context: 2B done
#3 DONE 0.0s
#4 [linux/arm64/v8 1/1] COPY staged-run.sh /run.sh
#4 ERROR: failed to calculate checksum ... "/staged-run.sh": not found
```
## Expected behaviour
The local context should include `staged-run.sh`, and the image should build
successfully.
### Problem description
`container build` transfers a `2B` local build context and fails every `COPY`,
even for a root-level file in a minimal context with no `.dockerignore`.
The failure persists after stopping and deleting the builder, pulling
`ghcr.io/apple/container-builder-shim/builder:0.12.0` again, and starting a new
builder.
### Environment
```markdown
- macOS 26.6 (25G72)
- Xcode 26.6 (17F113)
- Swift 6.3.3
- container CLI 1.1.0
- container-apiserver 1.1.0
- builder image ghcr.io/apple/container-builder-shim/builder:0.12.0
- architecture arm64
- builder resources: 8 CPUs, 12288 MB
```
### Code of Conduct
- [x] I agree to follow this project's Code of Conduct
Contributor guide
Research direction
Start with the `container build` entry point and the local context transfer path, using the provided minimal `Dockerfile` and `staged-run.sh` reproduction. Run the macOS/arm64 command and verify the context includes `staged-run.sh`; done when the build completes and `COPY staged-run.sh /run.sh` succeeds.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- build-system, cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100