Docker Community Forums

Share and learn in the Docker community.

REST web service deployed to Docker will only give 404 errors


(Dwschulze) #1

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?