Dockerfile - java installation breaks the code

Gm all, pls I need help. java installation is breaking my Dockerfile. I cant figure our this error. i was able to manually install java on the docker-host server but java installation wont run in Dockerfile.

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
244579cc929b tomcat:latest “catalina.sh run” 11 hours ago Up 14 seconds 0.0.0.0:8082->8080/tcp, :::8082->8080/tcp tomcat2
[root@dockerhost ~]# ls
Dockerfile
[root@dockerhost ~]# vi dockerfile
[root@dockerhost ~]# docker build -t tomcat2 .
Sending build context to Docker daemon 19.46kB
Step 1/9 : FROM centos
—> 5d0da3dc9764
Step 2/9 : RUN yum install java -y
—> Running in 2f9d99ddc011
CentOS Linux 8 - AppStream 115 B/s | 38 B 00:00
Error: Failed to download metadata for repo ‘appstream’: Cannot prepare internal mirrorlist: No URLs in mirrorlist
The command ‘/bin/sh -c yum install java -y’ returned a non-zero code: 1
[root@dockerhost ~]# cat Dockerfile
FROM centos
RUN yum install java -y
RUN mkdir /opt/tomcat/
WORKDIR /opt/tomcat
ADD https://dlcdn.apache.org/tomcat/tomcat-9/v9.0.63/bin/apache-tomcat-9.0.63.tar.gz /opt/tomcat
RUN tar xvfz apache-tomcat-9.0.63.tar.gz
RUN mv apache-tomcat-9.0.63/* /opt/tomcat
EXPOSE 8080

CMD ["/opt/tomcat/bin/catalina.sh", “run”]
[root@dockerhost ~]#

Thank you.