Using yum inside a Red Hat Enterprise Linux container

Updated:

If you try to install packages using yum in a Red Hat Enterprise Linux (RHEL) container, you might see the message “There are no enabled repos”.

For example, during a Docker build which uses yum to install packages into the container, you might see this:

 ---> bbc8b148f8cb
Removing intermediate container a35a352e9f4e
Step 3 : RUN INSTALL_PKGS="python-devel libxml2-devel libxslt-devel zlib gcc python-pip" &&     yum install -y $INSTALL_PKGS &&     yum clean all -y
 ---> Running in 9a9b712a4e95
Loaded plugins: ovl, product-id, search-disabled-repos, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
There are no enabled repos.
 Run "yum repolist all" to see the repos you have.
 To enable Red Hat Subscription Management repositories:
     subscription-manager repos --enable <repo>
 To enable custom repositories:
 yum-config-manager --enable <repo>

This happens when the Docker host where the container is running is not registered with Red Hat subscription management, and is therefore not entitled to download packages.

For example, if you’re developing with RHEL containers on a Mac OS X host, then you’ll see this message. (Because OS X isn’t RHEL).

To solve this, don’t subscribe a container to Red Hat subscription management (bad idea!). Instead, you should use a Red Hat Enterprise Linux host to run your Docker builds, and ensure that the host is registered with RH subscription management. This is because the RHEL version of Docker carries a patch that allows Red Hat subscriptions from the host to work inside a container.

You can get RHEL as a developer for free, with a no-cost developer subscription.

Leave a Comment