LoginSignup
1
3

docker-compose buildでエラー 原因はCentOS7が非推奨のため

Last updated at Posted at 2024-07-02

背景

LPIC102の学習でCentOS7 on Dockerを使っていたところ発生しました。

症状

bashでdocker-compose buildを実行した所、packageがダウンロードされない。

dockerfile
FROM centos:7
ENV container docker
RUN (cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == \
systemd-tmpfiles-setup.service ] || rm -f $i; done); \
rm -f /lib/systemd/system/multi-user.target.wants/*;\
rm -f /etc/systemd/system/*.wants/*;\
rm -f /lib/systemd/system/local-fs.target.wants/*; \
rm -f /lib/systemd/system/sockets.target.wants/*udev*; \
rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \
rm -f /lib/systemd/system/basic.target.wants/*;\
rm -f /lib/systemd/system/anaconda.target.wants/*;
RUN yum update -y
RUN  yum install -y  net-tools
RUN yum install -y systemd
RUN  yum install -y  rsyslog
# RUN  yum install -y  source
RUN  yum install -y  zsh
RUN yum install -y postfix
RUN yum install -y mailx
RUN yum install -y traceroute
RUN yum install -y iproute
RUN yum install -y  xinetd
RUN yum -y install lsof
RUN yum -y install nmap
# デフォルトだとrootの実行権限がないので、
RUN groupadd docker -g 1000
RUN usermod root -G 1000

以下エラー文

エラー文

docker-compose build
Loaded plugins: fastestmirror, ovl
Loading mirror speeds from cached hostfile
 * base: ftp.yz.yamagata-u.ac.jp
 * extras: ftp.yz.yamagata-u.ac.jp
 * updates: ftp.yz.yamagata-u.ac.jp
http://ftp.riken.jp/Linux/centos/7.9.2009/updates/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found
Trying other mirror.
To address this issue please refer to the below wiki article

https://wiki.centos.org/yum-errors

If above article doesn't help to resolve this issue please use https://bugs.centos.org/.

http://ftp.yz.yamagata-u.ac.jp/pub/linux/centos/7.9.2009/updates/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found
Trying other mirror.
http://ftp-srv2.kddilabs.jp/Linux/packages/CentOS/7.9.2009/updates/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found
Trying other mirror.
http://ftp.tsukuba.wide.ad.jp/Linux/centos/7.9.2009/updates/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found
Trying other mirror.
http://mirrors.cat.net/centos/7.9.2009/updates/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found
Trying other mirror.
http://ftp.jaist.ac.jp/pub/Linux/CentOS/7.9.2009/updates/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found
Trying other mirror.
http://mirror.aktkn.sg/centos/7.9.2009/updates/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found
Trying other mirror.
http://download.nus.edu.sg/mirror/centos/7.9.2009/updates/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found
Trying other mirror.
http://ftp.iij.ad.jp/pub/linux/centos/7.9.2009/updates/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found
Trying other mirror.
http://ftp.nara.wide.ad.jp/pub/Linux/centos/7.9.2009/updates/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found
Trying other mirror.
Resolving Dependencies
--> Running transaction check
---> Package nmap.x86_64 2:6.40-19.el7 will be installed
--> Processing Dependency: nmap-ncat = 2:6.40-19.el7 for package: 2:nmap-6.40-19.el7.x86_64
--> Processing Dependency: libpcap.so.1()(64bit) for package: 2:nmap-6.40-19.el7.x86_64
--> Running transaction check
---> Package libpcap.x86_64 14:1.5.3-13.el7_9 will be installed
---> Package nmap-ncat.x86_64 2:6.40-19.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

======================================================================================================================================================================= Package                                Arch                                Version                                         Repository                            Size 
=======================================================================================================================================================================Installing:
 nmap                                   x86_64                              2:6.40-19.el7                                   base                                 3.9 M 
Installing for dependencies:
 libpcap                                x86_64                              14:1.5.3-13.el7_9                               updates                              139 k 
 nmap-ncat                              x86_64                              2:6.40-19.el7                                   base                                 206 k 

Transaction Summary
=======================================================================================================================================================================Install  1 Package (+2 Dependent packages)

Total size: 4.3 M
Total download size: 139 k
Installed size: 17 M
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
libpcap-1.5.3-13.el7_9.x86_64. FAILED
http://ftp.riken.jp/Linux/centos/7.9.2009/updates/x86_64/Packages/libpcap-1.5.3-13.el7_9.x86_64.rpm: [Errno 14] HTTP Error 404 - Not Found0 B/s |    0 B  --:--:-- ETA 
Trying other mirror.
libpcap-1.5.3-13.el7_9.x86_64. FAILED
http://ftp.yz.yamagata-u.ac.jp/pub/linux/centos/7.9.2009/updates/x86_64/Packages/libpcap-1.5.3-13.el7_9.x86_64.rpm: [Errno 14] HTTP Error 404 - Not Found --:--:-- ETA 
Trying other mirror.
libpcap-1.5.3-13.el7_9.x86_64. FAILED
http://ftp-srv2.kddilabs.jp/Linux/packages/CentOS/7.9.2009/updates/x86_64/Packages/libpcap-1.5.3-13.el7_9.x86_64.rpm: [Errno 14] HTTP Error 404 - Not Found-:--:-- ETA 
Trying other mirror.
libpcap-1.5.3-13.el7_9.x86_64. FAILED
http://ftp.tsukuba.wide.ad.jp/Linux/centos/7.9.2009/updates/x86_64/Packages/libpcap-1.5.3-13.el7_9.x86_64.rpm: [Errno 14] HTTP Error 404 - Not Found 0 B  --:--:-- ETA 
Trying other mirror.
libpcap-1.5.3-13.el7_9.x86_64. FAILED
http://mirrors.cat.net/centos/7.9.2009/updates/x86_64/Packages/libpcap-1.5.3-13.el7_9.x86_64.rpm: [Errno 14] HTTP Error 404 - Not Found 0.0 B/s |    0 B  --:--:-- ETA 
Trying other mirror.
libpcap-1.5.3-13.el7_9.x86_64. FAILED
http://ftp.jaist.ac.jp/pub/Linux/CentOS/7.9.2009/updates/x86_64/Packages/libpcap-1.5.3-13.el7_9.x86_64.rpm: [Errno 14] HTTP Error 404 - Not Found    0 B  --:--:-- ETA 
Trying other mirror.
libpcap-1.5.3-13.el7_9.x86_64. FAILED
http://mirror.aktkn.sg/centos/7.9.2009/updates/x86_64/Packages/libpcap-1.5.3-13.el7_9.x86_64.rpm: [Errno 14] HTTP Error 404 - Not Found 0.0 B/s |    0 B  --:--:-- ETA 
Trying other mirror.
libpcap-1.5.3-13.el7_9.x86_64. FAILED
http://download.nus.edu.sg/mirror/centos/7.9.2009/updates/x86_64/Packages/libpcap-1.5.3-13.el7_9.x86_64.rpm: [Errno 14] HTTP Error 404 - Not Found   0 B  --:--:-- ETA 
Trying other mirror.
libpcap-1.5.3-13.el7_9.x86_64. FAILED
http://ftp.iij.ad.jp/pub/linux/centos/7.9.2009/updates/x86_64/Packages/libpcap-1.5.3-13.el7_9.x86_64.rpm: [Errno 14] HTTP Error 404 - Not Found |    0 B  --:--:-- ETA 
Trying other mirror.
libpcap-1.5.3-13.el7_9.x86_64. FAILED
http://ftp.nara.wide.ad.jp/pub/Linux/centos/7.9.2009/updates/x86_64/Packages/libpcap-1.5.3-13.el7_9.x86_64.rpm: [Errno 14] HTTP Error 404 - Not Found0 B  --:--:-- ETA 
Trying other mirror.


Error downloading packages:

原因

2024/6/30の時点でCentOS7のサポートが終了し非推奨になったため。
非推奨になり、ダウンロード先のURL上にファイルを置かなくなった(と考えられます。)

具体例 山形大学のurlの場合

コンソール画面で表示されたURLの一つを試しに調べてみます。
今回は最初に表示された山形大学のurlを調べてみます。

https://ftp.yz.yamagata-u.ac.jp/pub/linux/centos/7.9.2009/
readme ファイルのみが置かれています。

image.png

readmeの内容が以下のとおりです。

readme.txt
This directory (and version of CentOS) is deprecated. 

対処

dockerfileのimageをrockylinux:8に変更する

dockerfile
+FROM rockylinux:8
-FROM centos:7
ENV container docker
RUN (cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == \
systemd-tmpfiles-setup.service ] || rm -f $i; done); \
rm -f /lib/systemd/system/multi-user.target.wants/*;\
rm -f /etc/systemd/system/*.wants/*;\
rm -f /lib/systemd/system/local-fs.target.wants/*; \
rm -f /lib/systemd/system/sockets.target.wants/*udev*; \
rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \
rm -f /lib/systemd/system/basic.target.wants/*;\
rm -f /lib/systemd/system/anaconda.target.wants/*;
RUN yum update -y
RUN  yum install -y  net-tools
RUN yum install -y systemd
RUN  yum install -y  rsyslog
# RUN  yum install -y  source
RUN  yum install -y  zsh
RUN yum install -y postfix
RUN yum install -y mailx
RUN yum install -y traceroute
RUN yum install -y iproute
RUN yum install -y  xinetd
RUN yum -y install lsof
RUN yum -y install nmap
# デフォルトだとrootの実行権限がないので、
RUN groupadd docker -g 1000
RUN usermod root -G 1000

参考

REDHAT告知

cetnos7 サポート終了

github変更箇所

1
3
0

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
1
3