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

**URL:** <https://forums.rockylinux.org/t/docker-build-with-rockylinux-9-failed-with-error-not-able-to-resolve-host-name-to-mirrors-site/12568>\
**Category:** Rocky Linux Help & Support\
**Tags:** rocky-linux-9\
**Created:** [January 19, 2024, 10:30pm UTC](https://forums.rockylinux.org/t/docker-build-with-rockylinux-9-failed-with-error-not-able-to-resolve-host-name-to-mirrors-site/12568 "2024-01-19T22:30:16Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jcui](https://avatars.discourse-cdn.com/v4/letter/j/fbc32d/32.png) [@jcui](https://forums.rockylinux.org/u/jcui)\
**Post date:** [January 19, 2024, 10:30pm UTC](https://forums.rockylinux.org/t/docker-build-with-rockylinux-9-failed-with-error-not-able-to-resolve-host-name-to-mirrors-site/12568/1 "2024-01-19T22:30:16Z")

</div>

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](https://mirrors.rockylinux.org/mirrorlist?arch=x86_64&repo=BaseOS-9) [getaddrinfo() thread failed to start]  
Error: Failed to download metadata for repo ‘baseos’: Cannot prepare internal mirrorlist: Curl error (6): Couldn’t resolve host name for [https://mirrors.rockylinux.org/mirrorlist?arch=x86\_64&repo=BaseOS-9](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 “[https://mirrors.rockylinux.org/mirrorlist?arch=x86\_64&repo=BaseOS-9](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/](https://www.centos.org/)”  
BUG\_REPORT\_URL=“[https://bugs.centos.org/](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

---

<div class="post-metadata">

**Author:** ![jcui](https://avatars.discourse-cdn.com/v4/letter/j/fbc32d/32.png) [@jcui](https://forums.rockylinux.org/u/jcui)\
**Post date:** [January 23, 2024, 7:04pm UTC](https://forums.rockylinux.org/t/docker-build-with-rockylinux-9-failed-with-error-not-able-to-resolve-host-name-to-mirrors-site/12568/2 "2024-01-23T19:04:50Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![glen](https://avatars.discourse-cdn.com/v4/letter/g/8c91f0/32.png) [@glen](https://forums.rockylinux.org/u/glen)\
**Post date:** [February 19, 2024, 9:10am UTC](https://forums.rockylinux.org/t/docker-build-with-rockylinux-9-failed-with-error-not-able-to-resolve-host-name-to-mirrors-site/12568/3 "2024-02-19T09:10:47Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex020/uploads/rockylinux/original/1X/91b7219eec10e30013422e4df76c1d898711a5d5.svg) [@system](https://forums.rockylinux.org/u/system)\
**Post date:** [April 19, 2024, 9:11am UTC](https://forums.rockylinux.org/t/docker-build-with-rockylinux-9-failed-with-error-not-able-to-resolve-host-name-to-mirrors-site/12568/4 "2024-04-19T09:11:21Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
