Tar command not found in Dockerfile

I am trying to upload a file to rhel6 and use tar to unpack it. I am running this on docker. I am getting strange error: / 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:pwd@downloads.datastax.com/enterprise/dse-4.0.3-bin.tar.gz

RUN curl -OL  http://username:pwd@downloads.datastax.com/enterprise/opscenter-4.0.3.tar.gz

RUN echo $PATH

RUN tar -xzvf opscenter-4.0.3.tar.gz

RUN rm *.tar.gz

      

+3


source to share


3 answers


Very strange ... it didn't happen ... then it suddenly started. 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

      

+3


source


I tried with similar, richxsl / rhel6.5 bash

$ docker run -it richxsl/rhel6.5 bash
[root@5f3b0b7539a3 /]# tar
bash: tar: command not found
[root@5f3b0b7539a3 /]# yum install tar
Loaded plugins: product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Setting up Install Process
No package tar available.
Error: Nothing to do
[root@5f3b0b7539a3 /]#

      



Maybe you need to register with Red Hat Subscription Management?

+2


source


After a lot of pain, I found out that when you are inside a container, it is not registered with RHN or satellite. I doubt REDHAT will provide this feature in the near future.

What I did was get the required rpm from CENTOS and install it over RHEL6.

RUN curl -OL ftp://fr2.rpmfind.net/linux/centos/6.6/os/x86_64/Packages/unzip-6.0-1.el6.x86_64.rpm
RUN yum install -y unzip-6.0-1.el6.x86_64.rpm
RUN rm unzip-6.0-1.el6.x86_64.rpm

      

I think this is the best strategy right now. Take the most basic RHEL6 image and install the required packages from CENTOS. You should use this custom RHEL6 image for your development purposes.

https://access.redhat.com/articles/881893

0


source







All Articles