docker - Docker CentOS - 添加 EPEL
问题描述
我正在尝试在 CentOS(v8,Dockerhub 最新)上访问 EPEL。我正在遵循似乎是推荐的方法;也就是安装epel-release
.
Dockerfile
FROM centos
RUN yum update -y
RUN yum install -y epel-release
但是当我尝试构建容器时,我得到以下信息:
Sending build context to Docker daemon 2.048kB
Step 1/6 : FROM centos
latest: Pulling from library/centos
729ec3a6ada3: Pull complete
Digest: sha256:f94c1d992c193b3dc09e297ffd54d8a4f1dc946c37cbeceb26d35ce1647f88d9
Status: Downloaded newer image for centos:latest
---> 0f3e07c0138f
Step 2/6 : LABEL maintainer="rremer@medallia.com"
---> Running in be2f7fef5052
Removing intermediate container be2f7fef5052
---> 2f81a5f48a09
Step 3/6 : RUN yum update -y
---> Running in 441eafae5dac
CentOS-8 - AppStream 0.0 B/s | 0 B 00:20
CentOS-8 - Base 0.0 B/s | 0 B 00:20
CentOS-8 - Extras 0.0 B/s | 0 B 00:20
Failed to synchronize cache for repo 'AppStream', ignoring this repo.
Failed to synchronize cache for repo 'BaseOS', ignoring this repo.
Failed to synchronize cache for repo 'extras', ignoring this repo.
Dependencies resolved.
Nothing to do.
Complete!
Removing intermediate container 441eafae5dac
---> 9410b8dede8c
Step 4/6 : RUN yum install -y epel-release
---> Running in 0514401a6ea3
CentOS-8 - AppStream 0.0 B/s | 0 B 00:20
CentOS-8 - Base 0.0 B/s | 0 B 00:20
CentOS-8 - Extras 0.0 B/s | 0 B 00:20
Failed to synchronize cache for repo 'AppStream', ignoring this repo.
Failed to synchronize cache for repo 'BaseOS', ignoring this repo.
Failed to synchronize cache for repo 'extras', ignoring this repo.
No match for argument: epel-release
Error: Unable to find a match
The command '/bin/sh -c yum install -y epel-release' returned a non-zero code: 1
解决方案
如这篇关于 serverfault的帖子所述,添加
assumeyes=1
在
/etc/yum.conf
会给你你想要的。因此对于 Dockerfile,您将添加:
RUN echo "assumeyes=1" >> /etc/yum.conf
推荐阅读
- sqlite - Sqlite 文件中包含未显示在表中的数据
- javascript - 如何一键更改多个对象的颜色?Javascript?
- python - Plotly:如何为使用多条轨迹创建的图形设置调色板?
- javascript - 如何处理材质 UI 的多个受控工具提示
- amp-html - amp-next-page JSON 配置:可选字段“next”不起作用
- javascript - (耗时的)JS如何阻止渲染?
- android - 将 XML 转换为 Kotlin 数据类
- javascript - 将 Vue for 循环的结果限制为仅当前使用的结果
- python - 按索引合并对象及其标签编码器的两个 df
- php - 嵌套的 div 显示在不同的高度