首页 > 解决方案 > 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

标签: dockeryumepelcentos8

解决方案


如这篇关于 serverfault的帖子所述,添加

assumeyes=1

/etc/yum.conf

会给你你想要的。因此对于 Dockerfile,您将添加:

RUN echo "assumeyes=1" >> /etc/yum.conf

推荐阅读