i am using dockerfile
FROM redhat/ubi8
MAINTAINER "[email protected]"
RUN yum update -y
RUN yum install java-devel -y
RUN yum install unzip -y
RUN mkdir /server
COPY Dockerfile /server
COPY apache-tomcat-10.1.19.tar.gz /server
WORKDIR /server
ADD apache-tomcat-10.1.19.tar.gz /server
RUN tar xfh /server/apache-tomcat-10.1.19.tar.gz
CMD ["/server/apache-tomcat-10.1.19/bin/catalina.sh","run"]
EXPOSE 8080 8085 8081
In this file docker build is successful but facing error at the time of container build
# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
49ca5c2108bb cc606115c681 "/server/apache-tomc…" 11 seconds ago Exited (1) 10 seconds ago t1
[root@ip-devil. ~]# docker logs 49ca5c2108bb
Using CATALINA_BASE: /server/apache-tomcat-10.1.19
Using CATALINA_HOME: /server/apache-tomcat-10.1.19
Using CATALINA_TMPDIR: /server/apache-tomcat-10.1.19/temp
Using JRE_HOME: /usr
Using CLASSPATH: /server/apache-tomcat-10.1.19/bin/bootstrap.jar:/server/apache-tomcat-10.1.19/bin/tomcat-juli.jar
Using CATALINA_OPTS:
Unrecognised option: --add-opens=java.base/java.lang=ALL-UNNAMED
# Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
please suggest how to solve and run the container
Use the
openjdkimage since it already has the Java development environment. Also download the Apache Tomcat distribution rather than using a local copy.