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’:
- Curl error (6): Couldn’t resolve host name for https://mirrors.rockylinux.org/mirrorlist?arch=x86_64&repo=BaseOS-9 [getaddrinfo() thread failed to start]
…
The command ‘/bin/sh -c yum install -y epel-release openssl’ returned a non-zero code: 1
It seems the new rockylinux:9 could not resolve the URL. However, if I run the curl command on my host:
curl -X GET “copy URL in the error message here”
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”
…
My docker version:
Docker version 1.13.1, build 7d71120/1.13.1
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