7.5. Adding software in a minimal UBI container
UBI dnf repositories are enabled inside UBI Minimal images by default.
Prerequisites
-
The
container-toolsmeta-package is installed.
Procedure
Pull and run the
registry.access.redhat.com/ubi10/ubi-minimalimage:$ podman run -it --name myubimin registry.access.redhat.com/ubi10/ubi-minimalAdd a package to the
myubimincontainer:To add a package that is in the UBI repository, do not disable any repositories. For example, to add the
bzip2package:# microdnf install bzip2 --setopt install_weak_deps=0To add a package that is in a different host repository, explicitly enable the repository you need. For example, to install the
python38-develpackage from thecodeready-builder-for-rhel-8-x86_64-rpmsrepository:# microdnf install --enablerepo=codeready-builder-for-rhel-10-x86_64-rpms python3-devel --setopt install_weak_deps=0The
--setopt install_weak_deps=falseoption disables the installation of weak dependencies. Weak dependencies include recommended or suggested packages that are not strictly required but are often installed by default.
Verification
List all enabled repositories inside the container:
# microdnf repolist- Ensure that the required repositories are listed.
List all installed packages:
# rpm -qa- Ensure that the required packages are listed.
Installing Red Hat packages that are not inside the Red Hat UBI repositories can limit the ability to distribute the container outside of subscribed RHEL systems.