LoginSignup
11
5

More than 3 years have passed since last update.

CensOS6のサポートが切れてyum updateでError: Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and try againが出た時の対処法

Last updated at Posted at 2020-12-04

起こったこと

2020-11-30でCentOS6のサポートが終了した。
Dockerfileでyum updateしてるところがあってエラーになってしまった。
今回はその対処法を残しておく。

Dockerfile
FROM centos:6.6

RUN yum update -y
実行したコマンドとエラー
$ docker build -t centos6.6 .
Sending build context to Docker daemon  2.048kB
Step 1/2 : FROM centos:6.6
 ---> 368c96d786ae
Step 2/2 : RUN yum update -y
 ---> Running in 7daac25d2959
Loaded plugins: fastestmirror
Setting up Update Process
Error: Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and try again
YumRepo Error: All mirror URLs are not using ftp, http[s] or file.
 Eg. Invalid release/repo/arch combination/
removing mirrorlist with no valid mirrors: /var/cache/yum/x86_64/6/base/mirrorlist.txt
The command '/bin/sh -c yum update -y' returned a non-zero code: 1

対処法

Dockerfileを修正

Dockerfile
FROM centos:6.6

RUN sed -i "s|#baseurl=|baseurl=|g" /etc/yum.repos.d/CentOS-Base.repo \
  && sed -i "s|mirrorlist=|#mirrorlist=|g" /etc/yum.repos.d/CentOS-Base.repo \
  && sed -i "s|http://mirror\.centos\.org/centos/\$releasever|https://vault\.centos\.org/6.6|g" /etc/yum.repos.d/CentOS-Base.repo

RUN yum update -y

まとめ

本当はCentOSのバージョンを上げるべきだよ

参考

yumコマンド実行時に Cannot retrieve repository metadata と出て失敗する(CentOS 6.4)

11
5
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
11
5