linux – Why I cant create an image using below Dockerfile? Iam getting below error

The reason is that CentOS 7 has reached end of life and its default mirror lists are no longer available.

To fix this you can add vault (archive) mirrors to your Dockerfile before installing Apache:

RUN sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-* && \
    sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*

If you’d like to consider updating the OS for this project, try Rocky Linux or CentOS Stream.

Read more here: Source link