0

I'm having a strange issue with tar. I'm running it in a Dockerfile, so while building an image. To make matters more complicated, this is using buildx on a buildserver to build an arm64 image on an amd64 machine, using qemu. So maybe those things are influencing the behavior I'm seeing.

But the core problem is, I'm downloading a tgz file, which seems to work fine. Then I do:

tar -xvf file.tgz

And I get the following error:

tar: Child returned status 1
tar: Error is not recoverable: exiting now

Everywhere I search, there is an extra line explaining what exactly went wrong (e.g. it isn't a correct tar.gz file). But in my case, there is no extra line. Any ideas how I can investigate this further?

Peter
  • 13,733
  • 11
  • 75
  • 122
  • Apparently, similar to https://stackoverflow.com/questions/69272380/error-docker-buildx-on-x86-64-for-building-multiarch-x86-64-arm64 (voted to close) and I should unzip and untar separately. – Peter Sep 21 '22 at 10:10
  • just a curiosity: which form of the RUN instruction did you use in your Dockerfile? The shell form or the exec form? https://docs.docker.com/engine/reference/builder/#run – jackdbd Sep 21 '22 at 10:39
  • @jackdbd we're using the shell form – Peter Sep 26 '22 at 09:08

1 Answers1

0

This tar file is compressed so you can first uncompress it and then untar. Or you can do this with one command:

tar xzvf file.tgz
Romeo Ninov
  • 6,538
  • 1
  • 22
  • 31
  • Tried that, but it didn't work. I really had to do it in 2 separate steps. No idea why. – Peter Sep 26 '22 at 09:08