lnxd
lnxd

Reputation: 39

Use same variable multiple times in a Dockerfile

I'm trying to use the same variable ($MINERV) multiple times in the following Dockerfile

FROM debian:stable

ARG MINERV=5.5c

RUN export DEBIAN_FRONTEND=noninteractive
RUN apt-get update
RUN apt-get upgrade -y
RUN apt-get install -y curl
RUN mkdir /home/docker
RUN curl "https://github.com/PhoenixMinerDevTeam/PhoenixMiner/releases/download/$MINERV/PhoenixMiner_$MINERV_Linux.tar.gz" -L -o "/home/docker/PhoenixMiner_$MINERV_Linux.tar.gz"

WORKDIR /home/docker

CMD ["ls"]

The output for docker build . -t test && docker run test is PhoenixMiner_.tar.gz when I'm expecting PhoenixMiner_5.5c_linux.tar.gz

I can confirm the curl is trying to grab https://github.com/PhoenixMinerDevTeam/PhoenixMiner/releases/download/5.5c/PhoenixMiner_$MINERV_Linux.tar.gz as well. I've also tried it with ENV instead of ARG to the same result.

How can I use the same variable multiple times in a Dockerfile?

Thanks!

Upvotes: 0

Views: 683

Answers (1)

Kolepcruz
Kolepcruz

Reputation: 61

I believe that you have to put $MINERV like this -> ${MINERV} where you are using it

Upvotes: 1

Related Questions