To add software inside the standard UBI container, disable non-UBI DNF repositories to ensure the containers you build can be redistributed.
Before you begin
- The
container-tools meta-package is installed.
Procedure
-
Pull and run the
registry.access.redhat.com/ubi10/ubi image:
$ podman run -it --name myubi registry.access.redhat.com/ubi10/ubi
-
Add a package to the
myubi container.
- To add a package that is in the UBI repository, disable all dnf repositories except for UBI repositories.
For example, to add the
bzip2 package:
# 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
zsh package:
- To add a package that is in a different host repository, explicitly enable the repository you need.
For example, to install the
python3-devel package from the codeready-builder-for-ubi-10-x86_64-rpms repository:
# dnf install --enablerepo=codeready-builder-for-ubi-10-x86_64-rpms python3-devel
Results
- List all enabled repositories inside the container:
- Ensure that the required repositories are listed.
- List all installed packages:
- Ensure that the required packages are listed.
Note
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.