Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist
While i was preparing a docker Image, I encountered this error. My base Image was CentOS.
[ 2/20] RUN yum install -y wget tar openssh-server openssh-clients sysstat sudo which openssl hostname:
#5 0.998 CentOS Linux 8 - AppStream 59 B/s | 38 B 00:00
#5 1.001 Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist
Solution:
The Next question is how to fix it ? Lets check that out below:
CentOS Linux 8 had reached the End Of Life (EOL) on December 31st, 2021. It means that CentOS 8 will no longer receive development resources from the official CentOS project. After Dec 31st, 2021, if you need to update your CentOS, you need to change the mirrors to vault.centos.org where they will be archived permanently.
Run the below commands
[root@odc ~]# sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
[root@odc ~]# sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
Now you can run the yum command to install packages.
No comments