在Dockerfile中找不到tar命令 [英] tar command not found in Dockerfile

查看:232
本文介绍了在Dockerfile中找不到tar命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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: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

推荐答案

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

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

这篇关于在Dockerfile中找不到tar命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆