I can't seem to be able to use a $VARIABLE reference in --from part of COPY instruction
$ docker build - <<<'
> ARG DOCKER_REGISTRY=docker.io
FROM $DOCKER_REGISTRY/library/docker:24-cli
ENV DOCKER_REGISTRY=$DOCKER_REGISTRY
COPY --from=$DOCKER_REGISTRY/kcov/kcov:latest-alpine /usr/local/bin/kcov* /usr/local/bin/
'
[+] Building 0.0s (2/2) FINISHED docker:default
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 243B 0.0s
=> CANCELED [internal] load metadata for docker.io/library/docker:24-cli 0.0s
Dockerfile:6
--------------------
4 |
5 | ENV DOCKER_REGISTRY=$DOCKER_REGISTRY
6 | >>> COPY --from=$DOCKER_REGISTRY/kcov/kcov:latest-alpine /usr/local/bin/kcov* /usr/local/bin/
7 |
8 |
--------------------
ERROR: failed to solve: failed to parse stage name "$DOCKER_REGISTRY/kcov/kcov:latest-alpine": invalid reference format
Is it supported? There is nothing in the documentation suggesting you can't use build args there.
How else can I parametrize the registry there? (We have an internal proxy of docker hub, that I don't want to hardcode)
The ENV statement doesn't make a difference, I added it just in case it would.