【发布时间】:2019-03-18 08:17:54
【问题描述】:
我使用 Docker Toolbox for windows(出于兼容性问题)并在 Dockerfile 中指定了一个ARG,以便在使用--build-arg 命令构建映像时可以使用它。在 dockerfile 中,我还有一些 COPY 命令,我想在那里使用我的变量,但是当我运行 docker build --build-arg VERSION_APP=something 时。它不翻译变量。我已经用过$VERSION_APP 或${VERSION_APP} 或%VERSION_APP%。
FROM alpine
MAINTAINER Marinos
ARG VERSION_APP
RUN apk update && apk add dos2unix
COPY script.sh /home/script.sh
RUN chmod a+x /home/script.sh
RUN dos2unix /home/script.sh
RUN sh /home/script.sh
COPY installation.txt /home/Desktop/${VERSION_APP}
更新
看来你应该将整个路径传递给你使用的变量,这就是我让它工作的方式。
【问题讨论】:
标签: docker dockerfile