I am using the official tomcat latest docker image. I have created a docker file to use this tomcat image and deploy the war files directly to tomcat webapps. When I run this docker image to start the container the spring boot app is not starting up as I don't see any application startup logs. The same war file when deployed to a local tomcat server is working fine but only when I use sudo
to run the catalina.sh run
command.
Here is the docker file I used:
##### Use the official Tomcat base image
FROM tomcat:latest
##### Env variable for log path
ENV LOG_PATH=/usr/local/tomcat/logs
##### Copy the WAR file into the webapps directory
COPY service-2.1.6.war /usr/local/tomcat/webapps/
##### Create necessary directories for Tomcat web applications
RUN mv /usr/local/tomcat/webapps.dist/* /usr/local/tomcat/webapps/
##### Set the environment variable for the active Spring profile
#####ENV SPRING_PROFILES_ACTIVE=prod
##### Copy the tomcat-users.xml file to configure the manager users
COPY tomcat-users.xml /usr/local/tomcat/conf/tomcat-users.xml
COPY context.xml /usr/local/tomcat/webapps/manager/META-INF/context.xml
#####Install sudo
RUN apt-get update && apt-get install -y sudo
##### Start Tomcat with sudo
#####CMD ["sudo", "/usr/local/tomcat/bin/catalina.sh", "run"]
Tomcat startup logs from docker container:
Tomcat startup logs from local tomcat setup:
What could be wrong or missing here?
2.4.5
built using jdk17
version and I was using tomcat:latest
image which is using jdk21.8.5.98-jre17-temurin
.9.0.90-jre17-temurin-jammy
as this also used JDK17.