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?
Run docker build to create a docker image with tag service (call it v1) Change a file(say prod. json ) that required the 3rd step in the Dockerfile to rerun (thus failing the cache) Run docker build to create docker image with tag service (call it v2)
#6 Using ENTRYPOINT with CMD Still, they both can be used in your Docker file. There are many such cases where we can use both ENTRYPOINT and CMD. The thing is that you will have to define the executable with the ENTRYPOINT and the default parameters using the CMD command. Maintain them in exec form at all times.
The basic syntax for the command is: docker run [OPTIONS] IMAGE [COMMAND] [ARG...] You can run containers from locally stored Docker images. If you use an image that is not on your system, the software pulls it from the online registry.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With