Skip to content

Allow using variables in COPY --from= #2374

Description

@selurvedu

Variables defined via ARG can't be used in COPY --from=$ARG /source /target.

Example:

FROM scratch
ARG SOURCE=debian:11
COPY --from=$SOURCE /etc/os-release /target
$ DOCKER_BUILDKIT=1 docker build
...
failed to solve with frontend dockerfile.v0: failed to create LLB definition: failed to parse stage name "$SOURCE": invalid reference format: repository name must be lowercase

FYI, the variable in a source or target definintion, e.g. COPY --from=debian:11 /etc/os-release /target/$SOURCE, gets expanded correctly both with and without DOCKER_BUILDKIT=1.

May be related to #815.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions