Dockerized WebApp - which URL to use?

Hi together

Goal: I am trying to deploy a webApp which uses a postgreSQL (running on a seperate WebServer) into a Docker container. In a further step this container should be uploaded to DockerHub for further deployment.

The building process took place and the container (including images) is visible under “Services” in the Docker-Tree. The Build Log shows success but I lost orientation of how to proceed in order to get the application running. After struggeling around with all sources of documentation, I am still looking for a pathway to make my application (in a container) available through an URL and bring it alive in my browser.

My Dockerfile is very simple so far:

FROM openjdk:jdk
COPY build/libs/ build/tmp
WORKDIR /tmp

Any hint is highly appreciated.

Thx in advance

Michael

Hi all, looks like I gained some experience in the meanwhile. I finally was able to create my container which also considers a tomcat 9 and JDK17. The buildlog of the container states, that my War-File got copied to the tomcat/webapps directory. Everything in the log seems to be right and the container is up and running. Also the war file seem to be processed in the expected manner: (“org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive [/usr/local/tomcat/webapps/eHC-0.0.1-SNAPSHOT.war] has finished in [4,626] ms”

But when trying to call up the app with “localhost:8080/ehC-0.0.1-SNAPSHOT” I receive the tomcat error message (404):
“The requested resource [/eHC-0.0.1-SNAPSHOT/]” is not available.

The more detailed desription states: “The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.”

The application is referring to a postgreSQL which is running on a seperate WebServer. But trying it with an embedded H2 database instead brought no other result.

Any help is highly appreciated - thx in advance.

Best regards

Michael

One more thing to add here. A lot of hints found in various forums pointed out a solution to regain the “webapps” directory. I considered this already in my dockerfile.

Apache Tomcat 9 (9.0.69) - Security Considerations

mv webapps webapps.dist; \
mkdir webapps; \

In the meantime I was able to mount catalina logs to a host directory which shows no errors. Nor does it give any hint in which direction to search any further. So therefore I consider my original question not being relevant any more and will start another thread.

This message alone does not indicate that the application was deployed and run successfully.
In the console output must be messages from Spring Boot like you see in the Terminal when running the app from the IDE:

.   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::                (v2.7.4)

2022-11-30 18:11:43.661  INFO 69418 --- [           main] c.c.onboarding.OnboardingApplication     : Starting OnboardingApplication using Java 11.0.16.1 on ...

If you don’t see such messages, make sure your main application class extends SpringBootServletInitializer as explained here and you build the WAR file with the same JDK version (or below) as used for Tomcat in your image.

Thank you Konstantin

Finally I was able to make everything work. Thx for your last hint (which I already considered).

happy coding

Michael