在Dockerfile中找不到tar命令

use*_*871 6 linux docker rhel6

我正在尝试在rhel6中下载文件并使用tar解压缩。我在docker上运行它。我收到一个奇怪的错误,说/ bin / sh:tar:找不到命令。我是Linux和Docker的新手。有人可以帮忙吗?

#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
Run Code Online (Sandbox Code Playgroud)

hba*_*hba 5

非常奇怪...这没有发生...然后突然开始发生。我不确定为什么,但是我通过安装tar.x86_64解决了这个问题:

FROM centos:6
RUN     yum -y update && \
    yum -y install wget && \
    yum install -y tar.x86_64 && \
    yum clean all
Run Code Online (Sandbox Code Playgroud)


use*_*097 0

我尝试过类似的,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 /]#
Run Code Online (Sandbox Code Playgroud)

您可能需要注册红帽订阅管理吗?