Home > Mobile >  Why does tar say no such file or directory when extracting a file that was downloaded with wget in d
Why does tar say no such file or directory when extracting a file that was downloaded with wget in d

Time:01-31

Building dockerfile from windows. In the settings of docker desktop it says it is using WSL backend, idk if that is useful info.

Here is the part of the dockerfile that is failing:

FROM amazon/aws-lambda-python:3.9

RUN yum install wget tar -y

RUN wget https://github.com/mozilla/geckodriver/releases/download/v0.32.0/geckodriver-v0.32.0-linux64.tar.gz
RUN ls ./
RUN tar -xzf geckodriver-v0.32.0-linux64.tar.gz

And here is the docker build output:

#6 [ 3/12] RUN wget https://github.com/mozilla/geckodriver/releases/download/v0.32.0/geckodriver-v0.32.0-linux64.tar.gz
...
#6 0.503 HTTP request sent, awaiting response... 200 OK
#6 0.640 Length: 2991185 (2.9M) [application/octet-stream]
#6 0.641 Saving to: ‘geckodriver-v0.32.0-linux64.tar.gz’
#6 0.643
#6 0.643      0K .......... .......... .......... .......... ..........  1% 6.62M 0s
...
#6 0.872   2900K .......... .......... .                               100% 10.2M=0.2s
#6 0.874
#6 0.875 2023-01-29 22:55:10 (12.2 MB/s) - ‘geckodriver-v0.32.0-linux64.tar.gz’ saved [2991185/2991185]
#6 0.875
#6 DONE 0.9s

#7 [ 4/12] RUN ls ./
#7 sha256:ddad3fe0334a0635c938f7d3e5c29333c8cd679b086aa669da09a4040ede27a3
#7 0.465 geckodriver-v0.32.0-linux64.tar.gz
#7 DONE 0.5s

#8 [ 5/12] RUN tar -xzf geckodriver-v0.32.0-linux64.tar.gz
#8 sha256:3cb7d0909f1fa5057ed561a1ce563398eaa9ba5208acaa56dad93060cdf4eb1e
#8 0.358 tar (child): gzip: Cannot exec: No such file or directory
#8 0.358 tar (child): Error is not recoverable: exiting now
#8 0.358 tar: Child returned status 2
#8 0.358 tar: Error is not recoverable: exiting now
#8 ERROR: executor failed running [/bin/sh -c tar -xzf geckodriver-v0.32.0-linux64.tar.gz]: exit code: 2
------
 > [ 5/12] RUN tar -xzf geckodriver-v0.32.0-linux64.tar.gz:
------
executor failed running [/bin/sh -c tar -xzf geckodriver-v0.32.0-linux64.tar.gz]: exit code: 2

I've tried various directories and the ls shows the file so I am very stumped. No clue what is wrong.

CodePudding user response:

tar z tries to run gzip before it extracts the contents of the archive, and the error message is saying it can't find that tool.

It may be enough to add gzip to the list of packages you install

RUN yum install -y \
  gzip \
  tar \
  wget
  • Related