最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

linux - How to install certain packages that are not available inside a container environment - Stack Overflow

programmeradmin3浏览0评论

I am working on tekton pipeline and I am trying to build my Dockerfile inside a running container (i.e., dind), but it's not able to find a few packages inside the container environment.

#No match for argument: lsscsi
#No match for argument: nvme-cli
#No match for argument: nfs-utils
#Dockerfile
FROM registry.access.redhat/ubi8/ubi-init

RUN yum -y update \
    && yum -y install \
              lsscsi \
              nvme-cli \
              net-tools

#Rest of Dockerfile

On the base container, I have enabled epel repo, attached redhat subscription and enabled few other repos, but still it does not work. I have written a script and execute this script before the docker build takes place

#!/bin/bash
subscription-manager register --username --password
subscription-manager attach
subscription-manager repos --enable codeready-builder-for-rhel-8-$(arch)-rpms
subscription-manager repos --enable rhel-8-for-$(arch)-baseos-rpms
subscription-manager repos --enable rhel-8-for-$(arch)-appstream-rpms
yum -y install .noarch.rpm

When I build this on rhel8 system, it uses the host's subscription and it is successfully able to install those packages, but only inside container env it fails. Is there some way I can work it to install inside a container? Also am I missing out enabling any ubi specific repos?

I am working on tekton pipeline and I am trying to build my Dockerfile inside a running container (i.e., dind), but it's not able to find a few packages inside the container environment.

#No match for argument: lsscsi
#No match for argument: nvme-cli
#No match for argument: nfs-utils
#Dockerfile
FROM registry.access.redhat/ubi8/ubi-init

RUN yum -y update \
    && yum -y install \
              lsscsi \
              nvme-cli \
              net-tools

#Rest of Dockerfile

On the base container, I have enabled epel repo, attached redhat subscription and enabled few other repos, but still it does not work. I have written a script and execute this script before the docker build takes place

#!/bin/bash
subscription-manager register --username --password
subscription-manager attach
subscription-manager repos --enable codeready-builder-for-rhel-8-$(arch)-rpms
subscription-manager repos --enable rhel-8-for-$(arch)-baseos-rpms
subscription-manager repos --enable rhel-8-for-$(arch)-appstream-rpms
yum -y install https://dl.fedoraproject./pub/epel/epel-release-latest-8.noarch.rpm

When I build this on rhel8 system, it uses the host's subscription and it is successfully able to install those packages, but only inside container env it fails. Is there some way I can work it to install inside a container? Also am I missing out enabling any ubi specific repos?

Share Improve this question asked Nov 18, 2024 at 18:08 DevOps__1903DevOps__1903 771 silver badge8 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

The issue occurs because the UBI8 container doesn't automatically use the same repositories as the host. To fix it, register the container with the Red Hat Subscription Manager using

subscription-manager register --username=<your_username> --password=<your_password> 

and attach the subscription with

subscription-manager attach

Then, enable the required repositories with

subscription-manager repos --enable codeready-builder-for-rhel-8-$(arch)-rpms --enable rhel-8-for-$(arch)-baseos-rpms --enable rhel-8-for-$(arch)-appstream-rpms

Finally, install EPEL inside the container using

 yum -y install https://dl.fedoraproject./pub/epel/epel-release-latest-8.noarch.rpm
发布评论

评论列表(0)

  1. 暂无评论