How to use pipes(ioredirection) in Dockerfile RUN?
Following line in Dockerfile doesn't work:
RUN git archive master | tar -x -C /path
Error message:
fatal: Not a valid object name
tar: This does not look like a tar archive
tar: Exiting with failure status due to previous errors
How to solve this issue?
How about the following variation: git archive master | tar xf - -C /path
git archive master | tar xf - -C /path
?
You can try a sh -c
command
RUN sh -c 'git archive master | tar -x -C /path'
If not, you can include that command in a script, COPY the script and RUN it.
It looks like the issue is actually with your git repository (or the directory your RUN
is executing in):
fatal: Not a valid object name
This error is coming from git and suggests that there's no branch named master
.
上一篇: SignalR与消息背板