Docker build error There are no enabled repos

15,709

Using yum (the Yellowdog Updater, Modified) in your Dockerfile has nothing to do with your host CentOS.
It has to do with your base image used by your Dockerfile (FROM xxx).

The error message that matters is:

There are no enabled repos.

You can see a manual resolution in "RHEL 7 - Solution to "There are no enabled repos" message"

If you simply want to play around and install software without the need for up to date Red Hat subscription you can mount your downloaded redhat ISO image and make it your default local repository and be able to install software.
To enable your local repository and thus overcome the There are no enabled repos, first mount your REHL7 iso image:

[root@rhel7 ~]# mkdir /media/rhel7-repo-iso
[root@rhel7 ~]# mount /dev/cdrom /media/rhel7-repo-iso/
mount: /dev/sr0 is write-protected, mounting read-only

That is not supported by a Dockerfile/docker image though.

You are better off using a base image which does not require any subscription model. For example:

FROM fedora
RUN yum update -y
RUN yum install -y httpd

Again, this has nothing to do with your host.


The OP mentions following Red Hat Enterprise Linux Atomic Host 7 Getting Started Guide

That guide clearly includes:

To enable software updates, you must register your Red Hat Enterprise Linux Atomic Host installation.
This is done with the subscription-manager command as described below.
If your system is located on a network that requires the use of an HTTP proxy, please see the Red Hat Knowledge Base Article on configuring subscription manager to use an HTTP proxy. The --name= option may be included if you wish to provide an easy to remember name to be used when reviewing subscription records.

$ sudo subscription-manager register --username=<username> --auto-attach
Share:
15,709
iam
Author by

iam

Updated on June 04, 2022

Comments

  • iam
    iam almost 2 years

    On Centos7.1 Docker host : I am building a docker image with Dockerfile having command

    RUN yum -y install deltarpm yum-utils --disablerepo=*-eus-* --disablerepo=*-htb-*     --disablerepo=*-ha-* --disablerepo=*-rt-* --disablerepo=*-lb-* --disablerepo=*-rs-* --disablerepo=*-sap-*
    

    During the run of docker build command : docker build -t <image>, I get the error:

    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.
     You can enable repos with yum-config-manager --enable <repo>
    

    How can I fix this? Do I need to enable yum repo inside docker also?

    (Note that I can install these packages in Docker host)

  • iam
    iam over 8 years
    I am using FROM rhel7:latest
  • VonC
    VonC over 8 years
    @iam simply use another base image. Is there any specifc requirement which means you have to use rhel7?
  • iam
    iam over 8 years
    yes, I am working on this : access.redhat.com/documentation/en/…
  • VonC
    VonC over 8 years
    @iam sure but this is for a registered REHL7 host. You don't need it for installing an apache web server. That would work as well with, for instance, fedora
  • VonC
    VonC over 8 years
    @iam did you do the register step sudo subscription-manager register as mentioned in the guide? (see my edited answer)
  • iam
    iam over 8 years
    thanks, somewhere my subscription is screwed up. I moved to centos:latest as you suggested before, no seeing issues further.
  • Otheus
    Otheus about 8 years
    The problem is, RHEL documentation says "do X" and it doesn't work. Currently, centos images don't download from docker (for unknown reasons). So how would one get the subscription manager to work during the docker build?