Michael Agarenzo
Michael Agarenzo

Reputation: 239

Docker runtime error after tar command

I am retreiving a tar.gz file using wget and unpacking it using tar -xzf. If I run the tar command from within the running container, it unpacks successfully and is stored as init in which I can then start the service with ./init.

The issue I'm having is that when I use that same tar command from a RUN instruction in the Dockerfile, I always get the same error when docker build . gets up to any next instruction after the RUN tar -xzf command.

Here is the error I am getting:

OCI runtime create failed: container_linux.go:348: starting container process caused "exec: \"/bin/sh\": stat /bin/sh: no such file or directory": unknown

And here is my Dockerfile for testing:

FROM amazonlinux:2
RUN yum install -y wget tar gzip
wget https://github.com/just-containers/s6-overlay/releases/download/v1.19.1.1/s6-overlay-amd64.tar.gz
RUN tar -xzf s6-overlay-amd64.tar.gz
RUN echo "test"

Note: If I make RUN tar -xzf the final instruction in the Dockerfile, it will build successfully, but attempting to run the image in a container will lead to that same error.


Further Troubleshooting Information:

From within the container, I ran which gzip to confirm gzip is being used from the right path (/usr/bin/gzip), and I also ran file https://github.com/just-containers/s6-overlay/releases/download/v1.19.1.1/s6-overlay-amd64.tar.gz, which produced the following output towards the end:

Length: 1713081 (1.6M) [application/octet-stream]

To my knowledge, octet-stream just means the file is a binary file, and the extension should be enough to tell me that this is a gzip file.

For what its worth, I know this tar.gz file is being successfully unpacked in another working Dockerfile built FROM alpine:3.6: https://hub.docker.com/r/webcenter/activemq/~/dockerfile/

I have tried the tar command used in the referenced Dockerfile and I always end up with the same error.

Upvotes: 2

Views: 3380

Answers (1)

Michael Agarenzo
Michael Agarenzo

Reputation: 239

The issue ended up not being a Docker issue but rather an issue with the tar.gz file I was trying to unpack. Multiple workarounds found here.

Upvotes: 2

Related Questions