如何在Dockerfile RUN中使用pipe道(ioredirection)?
Dockerfile中的以下行不起作用:
RUN git archive master | tar -x -C /path
错误信息:
fatal: Not a valid object name tar: This does not look like a tar archive tar: Exiting with failure status due to previous errors
如何解决这个问题?
怎么样下面的变化: git archive master | tar xf - -C /path
git archive master | tar xf - -C /path
?
你可以试试sh -c
命令
RUN sh -c 'git archive master | tar -x -C /path'
如果没有,可以将该命令包含在脚本中,复制脚本并运行。
看起来问题实际上是在你的git仓库(或者你的RUN
执行目录)中:
fatal: Not a valid object name
这个错误是来自git,并build议没有分支命名master
。