[英]Use same variable multiple times in a Dockerfile
我試圖在以下 Dockerfile 中多次使用相同的變量( $MINERV
)
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"]
output 用於docker build. -t test && docker run test
docker build. -t test && docker run test
是PhoenixMiner_.tar.gz
當我期待PhoenixMiner_5.5c_linux.tar.gz
我可以確認curl
嘗試抓取https://github.com/PhoenixMinerDevTeam/PhoenixMiner/releases/download/5.5c/PhoenixMiner_$MINERV_Linux.tar.gz
。 我也嘗試過使用ENV
而不是ARG
來獲得相同的結果。
如何在 Dockerfile 中多次使用同一個變量?
謝謝!
我相信你必須把 $MINERV 這樣 -> ${MINERV} 放在你正在使用它的地方
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.