Skip to content

expand build arguments in log #6327

@vrothberg

Description

@vrothberg

Issue Description

Buildah/Podman does not expand build arguments in the logs. The build logs/steps display the unexpanded contents of the Containerfile instructions, e.g., [1/2] STEP 5/9: RUN mkdir $NEWROOT.

Docker/Buildkit does the expansions (e.g., [builder 2/5] RUN mkdir /new-root-fs) which is extremely helpful to debug/analyze if the expansion during the build process works as expected.

I would love Buildah to expand the variables as well. I couldn't wrap my head around an issue where the build succeeded but didn't provide the build artifact I expected. Trying docker build helped me debug the issue and correct the Containerfile.

Cc: @nalind @flouthoc

Steps to reproduce the issue

Steps to reproduce the issue

[root@lima-fedora tmp.cGoHObl9M4]# cat Containerfile
FROM fedora:rawhide
ARG FOO=foo
RUN echo $FOO
[root@lima-fedora tmp.cGoHObl9M4]# buildah build -f Containerfile .
STEP 1/3: FROM fedora:rawhide
STEP 2/3: ARG FOO=foo
STEP 3/3: RUN echo $FOO
[...]
[root@lima-fedora tmp.cGoHObl9M4]# docker build -f Containerfile .
[..]                                                                                                0.0s
 => CACHED [1/2] FROM docker.io/library/fedora:rawhide@sha256:af660adb8de42682b494c7d102860c155466ba61cd850a8420e1ffad1764b1b7        0.0s
 => [2/2] RUN echo foo                                                                                                                0.1s
[...]

Describe the results you received

RUN echo $FOO

Describe the results you expected

RUN echo foo

buildah version output

Version:         1.40.1
Go Version:      go1.24.3
Image Spec:      1.1.1
Runtime Spec:    1.2.1
CNI Spec:        1.1.0
libcni Version:
image Version:   5.35.0
Git Commit:
Built:           Thu Jun  5 16:13:27 2025
OS/Arch:         linux/arm64
BuildPlatform:   linux/arm64/v8

buildah info output

{
    "host": {
        "CgroupVersion": "v2",
        "Distribution": {
            "distribution": "fedora",
            "version": "42"
        },
        "MemFree": 174956544,
        "MemTotal": 4082163712,
        "OCIRuntime": "crun",
        "SwapFree": 4082102272,
        "SwapTotal": 4082102272,
        "arch": "arm64",
        "cpus": 4,
        "hostname": "lima-fedora",
        "kernel": "6.14.0-63.fc42.aarch64",
        "os": "linux",
        "rootless": false,
        "uptime": "6h 4m 56.52s (Approximately 0.25 days)",
        "variant": ""
    },
    "store": {
        "ContainerStore": {
            "number": 0
        },
        "GraphDriverName": "overlay",
        "GraphOptions": [
            "overlay.imagestore=/usr/lib/containers/storage",
            "overlay.mountopt=nodev,metacopy=on"
        ],
        "GraphRoot": "/var/lib/containers/storage",
        "GraphStatus": {
            "Backing Filesystem": "btrfs",
            "Native Overlay Diff": "false",
            "Supports d_type": "true",
            "Supports shifting": "true",
            "Supports volatile": "true",
            "Using metacopy": "true"
        },
        "ImageStore": {
            "number": 2
        },
        "RunRoot": "/run/containers/storage"
    }
}

Provide your storage.conf

Standard F42

Upstream Latest Release

Yes

Additional environment details

Additional environment details

Additional information

Additional information like issue happens only occasionally or issue happens with a particular architecture or on a particular setting

Metadata

Metadata

Assignees

Labels

kind/bugCategorizes issue or PR as related to a bug.stale-issue

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions