Docker build with rockylinux:9 failed with error not able to resolve host name to mirrors site

Hello All:

I am trying to build a docker container image with rockylinux-9 without success. I can always build a docker container with rockylinux:8.9 without any problem, using the same Dockerfile.

My Dockerfile contains:

FROM rockylinux:8.9
RUN yum install -y epel-release openssl
WORKDIR /usr/jc
ENTRYPOINT [“/usr/jc/my-entrypoint.sh”]
CMD [“/bin/bash”]

My build script is:

#!/bin/bash
BUILD_DATE=01-20-24
docker build -f Dockerfile -t jc/rocky:$BUILD_DATE .
docker save jc/rocky:$BUILD_DATE --output jc-rocky-docker-$BUILD_DATE.tar
gzip jc-rocky-docker-$BUILD_DATE.tar

The script works fine with rockylinux:8.9 and produces the image gzip file. But after changing 8.9 to 9.3 (or 9.2, or 9 for that matter) in the Dockerfile, it always fails during the “docker build” processing, with errors during the BaseOS step:

Sending build context to Docker daemon 1.108 GB
Step 1/5 : FROM rockylinux:9.3
—> eeea865f4111
Step 2/5 : RUN yum install -y epel-release openssl
—> Running in 48e238283494

Rocky Linux 9 - BaseOS 0.0 B/s | 0 B 00:00
Errors during downloading metadata for repository ‘baseos’:

It seems the new rockylinux:9 could not resolve the URL. However, if I run the curl command on my host:

curl -X GET “https://mirrors.rockylinux.org/mirrorlist?arch=x86_64&repo=BaseOS-9

I can get the full mirror list.

I tried adding “RUN cat /etc/hosts && cat /etc/resolv.conf” to Dockerfile, and compared the contents between 8.9 and 9.3, they are exactly the same. The resolv.conf contains only one nameserver entry whish is 8.8.8.8 (supposedly google). Even if I purposely added a nameserver entry using my host’s resolv.conf, it did not help and I got the same errors:

RUN echo nameserver x.x.x.x (my host’s entry value) >> /etc/resolv.conf && yum install -y epel-release openssl

My host system is CentOS 7.7:

CentOS Linux release 7.7.1908 (Core)
Derived from Red Hat Enterprise Linux 7.7 (Source)
NAME=“CentOS Linux”
VERSION=“7 (Core)”
ID=“centos”
ID_LIKE=“rhel fedora”
VERSION_ID=“7”
PRETTY_NAME=“CentOS Linux 7 (Core)”
ANSI_COLOR=“0;31”
CPE_NAME=“cpe:/o:centos:centos:7”
HOME_URL=“https://www.centos.org/
BUG_REPORT_URL=“https://bugs.centos.org/

I tried search on this site, and also googled but did not come up with any specific helpful info. Please help me with any pointers or insights.

Thanks in advance.

JC

Seems nobody has encountered this problem.

Just an update: run the same on a RedHat 9.2 host. No error. So the problem seems to be caused by outdated CentOS 7. Also posted to the docker community forum, somebody tried on a Debian which also had no problem.

Works fine after I upgrade docker-ce from version 19.03 to 20.10 on CentOS7.4 and later.