tar command not found in Dockerfile

user892871 picture user892871 · Dec 23, 2014 · Viewed 24.2k times · Source

I am trying to download a file in rhel6 and use tar to uncompress it. I am running this on docker. I get a wierd error saying /bin/sh: tar: command not found. I am new to linux and docker. Can someone help.

#HELLO
FROM rhel6
MAINTAINER xxxxx

#RUN yum -y install wget

RUN yum update -y && yum clean all

#RUN yum -y install tar

RUN curl -OL  http://username:[email protected]/enterprise/dse-4.0.3-bin.tar.gz

RUN curl -OL  http://username:[email protected]/enterprise/opscenter-4.0.3.tar.gz

RUN echo $PATH

RUN tar -xzvf opscenter-4.0.3.tar.gz

RUN rm *.tar.gz

Answer

hba picture hba · Dec 28, 2015

Very strange...this wasn't happening...then all of a sudden started happening. I'm not sure why, but I got around it by installing tar.x86_64:

FROM centos:6
RUN     yum -y update && \
    yum -y install wget && \
    yum install -y tar.x86_64 && \
    yum clean all