tar command not found in Dockerfile

我是研究僧i 提交于 2019-12-05 06:48:35

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
user2915097

I tried with a similar one, 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 /]#

May be you need to register to Red Hat Subscription Management ?

After a lot of pain i came to know that when you are inside a container it is not registered to RHN or satellite. I doubt if REDHAT provides this feature in the near future.

What i did is to get required rpm's from CENTOS and install them on top of 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 for now. Take the very basic RHEL6 image and install required packages from CENTOS. You should be using this custom RHEL6 image for your development purposes.

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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!