Docker not extracting .tar.gz and cannot find the file in the image

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
HereturbiesWalt
Level 1
Level 1
5 sign-ins 5 questions asked First like given

I am having trouble with extracting a .tar.gz file and accessing its files on a docker image. I've tried looking around Stackoverflow, but the solutions didn't fix my problem... Below is my folder structure and my Dockerfile. I've made an image called modus.

Folder structure:

- modus
    Dockerfile
    ModusToolbox_2.1.0.1266-linux-install.tar.gz

Dockerfile:

FROM ubuntu:latest

USER root
RUN apt-get update -y && apt-get upgrade -y && apt-get install git -y 
COPY ./ModusToolbox_2.1.0.1266-linux-install.tar.gz /root/
RUN cd /root/ && tar -C /root/ -zxzf ModusToolbox_2.1.0.1266-linux-install.tar.gz 

I've been running the commands below, but when I try to check /root/ the extracted files aren't there...

docker build .
docker run -it modus
  root@e19d081664e4:/# cd root
  root@e19d081664e4:/# ls
  <prints nothing>

There should be a folder called ModusToolBox, but I can't find it anywhere. Any help is appreciated.

P.S I have tried changing ADD to COPY, but both don't work.

0 Likes
2 Replies
Rakshith
Moderator
Moderator
Moderator
250 likes received 1000 replies posted 750 replies posted

Hi @HereturbiesWalt

Can you please try running  tar -xvf ModusToolbox_2.1.0.1266-linux-install.tar.gz instead of tar -C /root/ -zxzf ModusToolbox_2.1.0.1266-linux-install.tar.gzand let me know if that works?

In case that does not work, can you please try extracting any tar file on your image to check if extraction works?

Thanks and Regards,
Rakshith M B
0 Likes
AlenAn14
Moderator
Moderator
Moderator
500 replies posted 100 solutions authored 250 replies posted

Hi @HereturbiesWalt ,

Thread was locked due to inactivity for long time, you can continue the discussion on the topic by opening a new thread with reference to the locked one. The continuous discussion in an inactive thread may mostly be unattended by community users.

Thanks and Regards,
Alen

0 Likes