7.4. Adding software in a standard UBI container
To add software inside the standard UBI container, disable non-UBI dnf repositories to ensure the containers you build can be redistributed.
Prerequisites
-
The
container-toolsmeta-package is installed.
Procedure
Pull and run the
registry.access.redhat.com/ubi10/ubiimage:$ podman run -it --name myubi registry.access.redhat.com/ubi10/ubiAdd a package to the
myubicontainer.To add a package that is in the UBI repository, disable all dnf repositories except for UBI repositories. For example, to add the
bzip2package:# dnf install --disablerepo= --enablerepo=ubi-10-for-x86_64-appstream-rpms --enablerepo=ubi-10-for-x86_64-baseos-rpms bzip2*To add a package that is not in the UBI repository, do not disable any repositories. For example, to add the
zshpackage:# dnf install zshTo 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:# dnf install --enablerepo=codeready-builder-for-rhel-10-x86_64-rpms python3-devel
Verification
List all enabled repositories inside the container:
# dnf 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.