在 Centos7.1 Docker 主机上:我正在使用具有命令的 Dockerfile 构建 Docker 镜像
RUN yum -y install deltarpm yum-utils --disablerepo=*-eus-* --disablerepo=*-htb-* --disablerepo=*-ha-* --disablerepo=*-rt-* --disablerepo=*-lb-* --disablerepo=*-rs-* --disablerepo=*-sap-*
运行 docker build 命令期间:docker build -t <image>
,我收到错误:
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>
我该如何解决这个问题?我还需要在 docker 内启用 yum repo 吗?
(请注意,我可以在 Docker 主机中安装这些包)
最佳答案
使用yum (the Yellowdog Updater, Modified)你的 Dockerfile 中的内容与你的主机 CentOS 无关。
它与 Dockerfile 使用的基础镜像有关(FROM xxx
)。
重要的错误消息是:
There are no enabled repos.
您可以在“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 theThere 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
但是 Dockerfile/docker 镜像不支持这一点。
您最好使用不需要任何订阅模型的基础镜像。例如:
FROM fedora
RUN yum update -y
RUN yum install -y httpd
再次强调,这与您的主机无关。
<小时/>OP提到以下Red Hat Enterprise Linux Atomic Host 7 Getting Started Guide
该指南明确包括:
To enable software updates, you must register your Red Hat Enterprise Linux Atomic Host installation.
This is done with thesubscription-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
关于Docker 构建错误 没有启用的存储库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34248753/