REST web service deployed to Docker will only give 404 errors

I have a simple REST web service with one endpoint that works when deployed to a local Tomcat 9.0.12 instance:

http://localhost:8080/rest/hello

works.

When I deploy it to Tomcat 9.0.16 in a Docker container all I get are 404 errors. Here is my command to deploy to Docker:

docker run -v /FULL_PATH_TO_PROJECT/target/simple.rest.web.service.war:/usr/local/tomcat/webapps/simple.rest.web.service.war -it -p 8080:8080 tomcat:9.0.16-jre11

The output from Docker indicates that the .war file deployed correctly, and when I check with

sudo docker exec -it CONTAINER_NAME bash

I can see the deployment and logs/ directory with no problems indicated.

When I check with

http://localhost:8080/rest/hello

I get a 404 error (same thing if I use the docker container IP address). If I do

http://localhost:8080

I see the Tomcat splash screen for the dockerized version of Tomcat

What am I missing?

Hello,
I ran into the same issue and couldn’t find any solution yet on this.
Did you by any chance got this figured out ?

Thanks
Sri

I am having the same issue. Any solutions?

I’m having the same issue. Was there ever a solution to this problem?

None of you have ever shared a docker-compose.yml file, how should we help with so little vague information?