What is the official way to add additional repos to RHEL containers in Atomic

Latest response

Greetings!

I am looking at adding in a few additional repos into my containers on an Atomic Host server. I notice that within the containers subscription-manager is disabled. What is the official method to add these? Unless I missed something, adding them to the Atomic host via subscription-manager didn't work. I figure before I waste too much time, to just ask. The first container that I know would need an additional repo is one that would require Oracle Java for getting any customer support for.

Thanks for all who spend a microsecond pondering this,
Andrew.

Some copied output from the ssh session, to more accurately show my dilemma in case it wasn't perfectly clear.

-bash-4.2# subscription-manager repos --list | grep -B3 'Enabled:   1'
Repo ID:   rhel-7-server-eus-rh-common-rpms
Repo Name: Red Hat Enterprise Linux 7 Server - Extended Update Support - RH Common (RPMs)
Repo URL:  https://cdn.redhat.com/content/eus/rhel/server/7/$releasever/$basearch/rh-common/os
Enabled:   1
--
Repo ID:   rhel-rs-for-rhel-7-server-eus-rpms
Repo Name: Red Hat Enterprise Linux Resilient Storage (for RHEL 7 Server) - Extended Update Support (RPMs)
Repo URL:  https://cdn.redhat.com/content/eus/rhel/server/7/$releasever/$basearch/resilientstorage/os
Enabled:   1
--
Repo ID:   rhel-7-server-extras-rpms
Repo Name: Red Hat Enterprise Linux 7 Server - Extras (RPMs)
Repo URL:  https://cdn.redhat.com/content/dist/rhel/server/7/7Server/$basearch/extras/os
Enabled:   1
--
Repo ID:   rhel-ha-for-rhel-7-server-eus-rpms
Repo Name: Red Hat Enterprise Linux High Availability (for RHEL 7 Server) - Extended Update Support (RPMs)
Repo URL:  https://cdn.redhat.com/content/eus/rhel/server/7/$releasever/$basearch/highavailability/os
Enabled:   1
--
Repo ID:   rhel-7-server-thirdparty-oracle-java-source-rpms
Repo Name: Red Hat Enterprise Linux 7 Server - Oracle Java (Source RPMs)
Repo URL:  https://cdn.redhat.com/content/dist/rhel/server/7/$releasever/$basearch/oracle-java/source/SRPMS
Enabled:   1
--
Repo ID:   rhel-7-server-eus-rpms
Repo Name: Red Hat Enterprise Linux 7 Server - Extended Update Support (RPMs)
Repo URL:  https://cdn.redhat.com/content/eus/rhel/server/7/$releasever/$basearch/os
Enabled:   1
--
Repo ID:   rhel-7-server-thirdparty-oracle-java-rpms
Repo Name: Red Hat Enterprise Linux 7 Server - Oracle Java (RPMs)
Repo URL:  https://cdn.redhat.com/content/dist/rhel/server/7/$releasever/$basearch/oracle-java/os
Enabled:   1
--
Repo ID:   rhel-rs-for-rhel-7-server-rpms
Repo Name: Red Hat Enterprise Linux Resilient Storage (for RHEL 7 Server) (RPMs)
Repo URL:  https://cdn.redhat.com/content/dist/rhel/server/7/$releasever/$basearch/resilientstorage/os
Enabled:   1
--
Repo ID:   rhel-ha-for-rhel-7-server-rpms
Repo Name: Red Hat Enterprise Linux High Availability (for RHEL 7 Server) (RPMs)
Repo URL:  https://cdn.redhat.com/content/dist/rhel/server/7/$releasever/$basearch/highavailability/os
Enabled:   1
--
Repo ID:   rhel-7-server-rpms
Repo Name: Red Hat Enterprise Linux 7 Server (RPMs)
Repo URL:  https://cdn.redhat.com/content/dist/rhel/server/7/$releasever/$basearch/os
Enabled:   1
--
Repo ID:   rhel-7-server-supplementary-rpms
Repo Name: Red Hat Enterprise Linux 7 Server - Supplementary (RPMs)
Repo URL:  https://cdn.redhat.com/content/dist/rhel/server/7/$releasever/$basearch/supplementary/os
Enabled:   1
--
Repo ID:   rhel-7-server-optional-rpms
Repo Name: Red Hat Enterprise Linux 7 Server - Optional (RPMs)
Repo URL:  https://cdn.redhat.com/content/dist/rhel/server/7/$releasever/$basearch/optional/os
Enabled:   1
[root@b309d73cee15 /]# subscription-manager repos --list
subscription-manager is disabled when running inside a container. Please refer to your host system for subscription management.

[root@b309d73cee15 /]# yum repolist
Loaded plugins: product-id, subscription-manager
repo id                                                                        repo name                                                                                                                     status
rhel-7-server-eus-rpms/7Server/x86_64                                          Red Hat Enterprise Linux 7 Server - Extended Update Support (RPMs)                                                            5509
rhel-7-server-rpms/7Server/x86_64                                              Red Hat Enterprise Linux 7 Server (RPMs)                                                                                      6812
rhel-7-server-rt-beta-rpms/x86_64                                              Red Hat Enterprise Linux for Real Time Beta (RHEL 7 Server) (RPMs)                                                              14
rhel-ha-for-rhel-7-server-eus-rpms/7Server/x86_64                              Red Hat Enterprise Linux High Availability (for RHEL 7 Server) - Extended Update Support (RPMs)                                 82
rhel-ha-for-rhel-7-server-rpms/7Server/x86_64                                  Red Hat Enterprise Linux High Availability (for RHEL 7 Server) (RPMs)                                                          106
rhel-rs-for-rhel-7-server-eus-rpms/7Server/x86_64                              Red Hat Enterprise Linux Resilient Storage (for RHEL 7 Server) - Extended Update Support (RPMs)                                 93
rhel-rs-for-rhel-7-server-rpms/7Server/x86_64                                  Red Hat Enterprise Linux Resilient Storage (for RHEL 7 Server) (RPMs)                                                          124
repolist: 12740
[root@b309d73cee15 /]# 

Responses

Hello Andrew,

For containers you can use yum-config-manager to enable or disable repos, like so:

# yum-config-manager --disable rhel-7-server-eus-rpms

or

# yum-config-manager --enable rhel-7-server-eus-rpms

Note that yum-config-manager is from the yum-utils package, so to first install it you'd want to run this:

# yum --disablerepo=* --enablerepo=rhel-7-server-rpms install yum-utils

If you wanted to disable all the EUS, RT, HTB and HA repos you could use this:

# yum-config-manager --disable \*-htb-* \*-rt-* \*-eus* \*-ha-*
# yum repolist enabled

See also https://access.redhat.com/solutions/1314663
A workaround if yum-config-manager is not available, is to manually edit /etc/yum.repos.d/redhat.repo

The link above is retired as it is a duplicate of https://access.redhat.com/solutions/1443553

Thanks for the information. I knew I had to be missing something, and, lo and behold I was.

I found that both Jake's and Daniel's answers were correct. I needed to add in yum-config-manager to fix things. I have had bad luck in the past doing manual edits, so I shyed away from that (ie. not tested when I asked this question).

Thanks to both of you for your time! Sorry for the slow response. I have been busier than snot with both work and personal life. Funny how them things tie up an unbelievable amount of time and resources :D

What if you are running a RHEL6 container? How can you hook up RHEL6 repo to a RHEL6 container?

Well the main RHEL ones translate in (RHEL 7.2 host here) and any additional ones can be installed like usual (rpms for epel6 or whatnot, copy over your .repo file for one, etc). And yes, you can do this via the dockerfile or afterwards.

[root@shadow startup-scripts]# docker run -ti --rm rhel6:latest /bin/bash
[root@c626396e8ee8 /]# yum repolist
Loaded plugins: product-id, subscription-manager
rrepo id                             repo name                                                                                       status
rhel-6-server-eus-rpms              Red Hat Enterprise Linux 6 Server - Extended Update Support (RPMs)                              16,761
rhel-6-server-rpms                  Red Hat Enterprise Linux 6 Server (RPMs)                                                        16,789
rhel-ha-for-rhel-6-server-eus-rpms  Red Hat Enterprise Linux High Availability (for RHEL 6 Server) - Extended Update Support (RPMs)    533
rhel-ha-for-rhel-6-server-rpms      Red Hat Enterprise Linux High Availability (for RHEL 6 Server) (RPMs)                              498
rhel-hpn-for-rhel-6-server-rpms     Red Hat Enterprise Linux High Performance Networking (for RHEL 6 Server) (RPMs)                     54
rhel-lb-for-rhel-6-server-eus-rpms  Red Hat Enterprise Linux Load Balancer (for RHEL 6 Server) - Extended Update Support (RPMs)         52
rhel-lb-for-rhel-6-server-rpms      Red Hat Enterprise Linux Load Balancer (for RHEL 6 Server) (RPMs)                                   22
rhel-rs-for-rhel-6-server-eus-rpms  Red Hat Enterprise Linux Resilient Storage (for RHEL 6 Server) - Extended Update Support (RPMs)    579
rhel-rs-for-rhel-6-server-rpms      Red Hat Enterprise Linux Resilient Storage (for RHEL 6 Server) (RPMs)                              581
rhel-scalefs-for-rhel-6-server-rpms Red Hat Enterprise Linux Scalable File System (for RHEL 6 Server) (RPMs)                            46
rhel-server-dts-6-rpms              Red Hat Developer Toolset RPMs for Red Hat Enterprise Linux 6 Server                                84
rhel-server-dts2-6-rpms             Red Hat Developer Toolset 2 RPMs for Red Hat Enterprise Linux 6 Server                             469
rhel-sfs-for-rhel-6-server-eus-rpms Red Hat Enterprise Linux Scalable File System (for RHEL 6 Server) - Extended Update Support (RP     46
repolist: 36,514
[root@c626396e8ee8 /]# 

Thank you, I've resolved using the following solution --> https://access.redhat.com/solutions/1443553

cat Dockerfile

# RHEL7 Container #
FROM rhel7:latest

# File Author / Maintainer
MAINTAINER ME - me@domain.com

RUN yum repolist all && \ 
yum-config-manager --enable rhel-7-server-satellite-capsule-6.2-rpms && \
yum makecache && \
yum install satellite-capsule -y && \
yum clean all && \
rm -rf /var/cache/yum/*

First of all the RHEL automic host is not even having yum-config-manager in it. How do we run that?