q8:docker build构建镜像 yum -y install vim报错
报错信息:1.295 Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=container error was
1.295 14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error"
在dockerfile中修改yum源配置
添加代码
RUN sed -i 's|^mirrorlist=|#mirrorlist=|g' /etc/yum.repos.d/CentOS-Base.repo && \
sed -i 's|^#baseurl=http://mirror.centos.org|baseurl=http://mirrors.aliyun.com|g' /etc/yum.repos.d/CentOS-Base.repo && \
yum clean all && yum -y makecache
再次构建即可