[Bug]: Container build can't resolve default arguments
- 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
Try and build the following containerfile:
```docker
ARG TAG="${TAG:-latest}"
FROM docker.io/library/alpine:${TAG}
RUN echo ok
```
### Problem description
When building with default args, I get the following error:
```
➜ mvp-error container build
[+] Building 0.0s (0/0)
Error: unknown (2): failed to solve: invalid ref: docker.io/library/alpine:${TAG}
```
Expected behaviour should match podman or docker where they use `:latest` tag for sample image:
```
➜ mvp-error docker build .
[+] Building 0.5s (6/6) FINISHED docker:desktop-linux
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 111B 0.0s
=> [internal] load metadata for docker.io/library/alpine:latest 0.4s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [1/2] FROM docker.io/library/alpine:latest@sha256:28bd5fe8b56d1bd048e5babf5b10710ebe0bae67db86916198a6eec434943f8b 0.0s
=> => resolve docker.io/library/alpine:latest@sha256:28bd5fe8b56d1bd048e5babf5b10710ebe0bae67db86916198a6eec434943f8b 0.0s
=> CACHED [2/2] RUN echo ok 0.0s
=> exporting to image 0.0s
=> => exporting layers 0.0s
=> => exporting manifest sha256:3cfd1f1c63292a946d97d643b56cb230284724a6c3f884a80646fe68796b455a 0.0s
=> => exporting config sha256:bc70131ba5c16c30df94fbaf4d61ac5f8160f70edfbfa36e79f99ce2747fd366 0.0s
=> => exporting attestation manifest sha256:317c203aa45b3e782b2d7435ce09cde0219c98c2f6a0e1fd0dec79a3b8bb5a3f 0.0s
=> => exporting manifest list sha256:9282520c0e9a0ac0544cdd4f015aaec553a28854646fd024f25be758979d6882 0.0s
=> => naming to moby-dangling@sha256:9282520c0e9a0ac0544cdd4f015aaec553a28854646fd024f25be758979d6882 0.0s
=> => unpacking to moby-dangling@sha256:9282520c0e9a0ac0544cdd4f015aaec553a28854646fd024f25be758979d6882 0.0s
View build details: docker-desktop://dashboard/build/desktop-linux/desktop-linux/d2iqo4jqxllanvszslk56p8id
What's next:
View a summary of image vulnerabilities and recommendations → docker scout quickview
➜ mvp-error podman build .
STEP 1/2: FROM docker.io/library/alpine:latest
STEP 2/2: RUN echo ok
ok
COMMIT
--> 3c0ea4ac2df7
3c0ea4ac2df7b582868a11ea54a8082ef302f2a32997f5e8a3a50554af5b0141
```
### Environment
```markdown
- OS: macOS 26.5.1 (25F80)
- Xcode: Version 26.5 (17F42)
- Container: container CLI version 0.6.0 (build: release, commit: a23bcf0)
```
### Code of Conduct
- [x] I agree to follow this project's Code of Conduct
Contributor guide
Research direction
Start by reproducing the supplied Containerfile with the container CLI and compare its ARG expansion with the shown Docker and Podman behavior. Trace the container build path that parses the ARG and resolves the FROM image reference. Done means the example resolves the unset TAG to alpine:latest without producing an invalid reference.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dockerfile, swift
- Domain
- build-system, cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100