Skip to content

[Bug]: Default values for build args are ignored #1295

@stijndcl

Description

@stijndcl

I have done the following

  • I have searched the existing issues
  • If possible, I've reproduced the issue using the 'main' branch of this project

Steps to reproduce

Dockerfile:

ARG PYTHON_IMAGE="python:3.13-slim"
FROM ${PYTHON_IMAGE} AS builder

First build it without explicitly passing this value, then try building by explicitly passing it as a build arg.

Example using the container CLI:

container build

container build --build-arg PYTHON_IMAGE="python:3.13-slim"

Current behavior

The first command fails because the default value is not used to fill in the arg when you don't supply it. The second command works as expected.

container build

[+] Building 0.0s (0/0)
Error: unknown (2): failed to solve: invalid ref: ${PYTHON_IMAGE}

Note that this does work as expected when building with alternatives like Docker and Rancher (= Lima under the hood).

Expected behavior

The first command also works, by using the supplied default value from the Dockerfile.

Environment

- OS: macOS 26.3.1
- Xcode: Version 26.3
- Container: container CLI version 0.10.0 (build: release, commit: 6bdb647)

Relevant log output

N/A

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions