Skip to content

Pass multiple host environment variables during buildah run #4688

@cbandy

Description

@cbandy

Description

podman run will pass multiple environment variables from the host to the container when the name passed to --env ends with *:

As a special case, if an environment variable ending in * is specified without a value, Podman will search the host environment for variables starting with the prefix and will add those variables to the container.

$ export ENV1=a
$ podman run --env 'ENV*' alpine env | grep ENV
ENV1=a

I have found this very useful for tools that can be configured through the environment. It would be great if buildah run also had this behavior. For example,

$ export TOOL_ONE=1 TOOL_TWO=profit
$ CONTAINER=$(buildah from alpine)
$ buildah run --env 'TOOL_*' "${CONTAINER}" -- env

TOOL_ONE=1
TOOL_TWO=profit

Output of buildah version:

buildah version 1.27.3 (image-spec 1.0.2-dev, runtime-spec 1.0.2-dev)

Output of podman version:

podman version 4.2.0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions