我尝试编写一个通用的Dockerfile,我希望每次版本更改时都不会更改文件名。如何使用*
作为变量名?
ADD ./Trimmomatic-*.zip /tmp/
RUN cd /usr/local ; unzip /tmp/Trimmomatic*.zip
ENV JAR_LOC echo `ls -1 /usr/local/Trimmomatic/trimmomatic-*.jar`
RUN chmod 755 ${JAR_LOC}
RUN ln -s /usr/local/Trimmomatic/trimmomatic-*.jar /usr/local/bin/trimmomatic.jar
RUN rm -rf /tmp/Trimmomatic*.zip
不幸的是,我收到了以下错误:
Step 12 : ADD ./Trimmomatic-*.zip /tmp/
---> Using cache
---> b0104788f151
Step 13 : RUN cd /usr/local ; unzip /tmp/Trimmomatic*.zip
---> Using cache
---> ffeae9bbd5f6
Step 14 : ENV JAR_LOC echo `ls -1 /usr/local/Trimmomatic/trimmomatic-*.jar`
---> Using cache
---> e4f836c140ca
Step 15 : RUN chmod 755 ${JAR_LOC}
---> Running in 539728a7f13f
chmod: cannot access '755': No such file or directory
chmod: cannot access 'echo': No such file or directory
chmod: cannot access '`ls': No such file or directory
chmod: cannot access '/usr/local/Trimmomatic/trimmomatic-*.jar`': No such file or directory
The command '/bin/sh -c chmod 755 ${JAR_LOC}' returned a non-zero code: 1
为什么*
不会被变量值替换