Home>

When building imgae from Dockerfile, I get an error at the following.

Dockerfile

RUN curl -LJO https://github.com/rasyomon/sourcecode/releases/download/v$ {LEAN_VERSION} /Leantime-v $ {LEAN_VERSION} .tar.gz &
&
 \ \
tar -zxvf Leantime-v $ {LEAN_VERSION} .tar.gz --strip-components 1 &
&
 \ \
rm Leantime-v $ {LEAN_VERSION} .tar.gz

Error details

[7/15] RUN curl -LJO https://github.com/rasyomon/sourcecode/releases/download/v2.1.8/Leantime-v2.1.8.tar.gz &
&
     tar -zxvf Leantime-v2.1.8.tar.gz --strip-components 1 &
&
     rm Leantime-v2.1.8.tar.gz:
# 10 0.338% Total% Received% Xferd Average Speed ​​Time Time Time Current
# 10 0.338 Dload Upload Total Spent Left Speed
100 9 100 9 0 0 17 0-:-:--:-:--:-:--17
# 10 0.858
# 10 0.858 gzip: stdin: not in gzip format
# 10 0.858 tar: Child returned status 1
# 10 0.858 tar: Error is not recoverable: exiting now
executor failed running [/bin/sh -c curl -LJO https://github.com/rasyomon/sourcecode/releases/download/v$ {LEAN_VERSION} /Leantime-v $ {LEAN_VERSION} .tar.gz &
&
     tar -zxvf Leantime-v $ {LEAN_VERSION} .tar.gz --strip-components 1 &
&
     rm Leantime-v $ {LEAN_VERSION} .tar.gz]: exit code: 2

I checked it on the net and found that it is not in gzip format.
wget https://github.com/Leantime/leantime/releases/download/v2.1.8/Leantime-v2.1.8.tar.gz
And inspected the file with the file command
Leantime-v2.1.8.tar.gz: gzip compressed data, from Unix, original size modulo 2 ^ 32 98795520
Came out.

How can I resolve the error?

  • Answer # 1

    Problems

    • The download URL specified in the Dockerfile is
      in the first place. Repository (https://github.com/rasyomon/sourcecode/) Is in the 404 Not Found state.

    • The URL specified in
    • wget seems to be correct, but this URL has a redirect in between, so the result is saved as an HTML file (with this method of execution).

    Correspondence method

    Try to correct the URL specified by the RUN command in the Dockerfile.

    RUN curl -LJO https://github.com/Leantime/leantime/releases/download/v$ {LEAN_VERSION} /Leantime-v $ {LEAN_VERSION} .tar.gz &
    &
     \ \
    tar -xzvf Leantime-v $ {LEAN_VERSION} .tar.gz --strip-components 1 &
    &
     \ \
    rm Leantime-v $ {LEAN_VERSION} .tar.gz
    

    As a supplementtarThe handling of arguments in commands is a bit special, normally only the first argumentc,x x,tThe order is fixed as either. (The second and subsequent commands are in no particular order like other general commands)

    If you want to decompress (decompress)xzvflikex xMust be specified at the beginning.