How to use channels (ioredirection) in Dockerfile RUN?

The following line in the Docker file does not 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 problem?

+7
docker dockerfile
source share
3 answers

How about the following option: git archive master | tar xf - -C /path git archive master | tar xf - -C /path ?

+2
source share

You can try sh -c

 RUN sh -c 'git archive master | tar -x -C /path' 

If not, you can include this command in the script, COPY script and RUN it.

+1
source share

It looks like the problem is with your git repository (or in your RUN directory):

 fatal: Not a valid object name 

This error comes from git and assumes that there is no branch named master .

0
source share

All Articles