upog
upog

Reputation: 5531

Spring boot app not available when deployed in EC2 using docker - Error 404

I'm using spring boot web app. It was working fine in tomcat server 8.0 running on my desktop PC

URL used: http://{desktop_ip}:8080/tennis/

Now i'm trying to deploy the same war using docker running in EC2 instance

i copied the war to EC2 instance and deployed using below command

sudo docker run -it -p 8080:8080 -v tennis.war:/usr/local/tomcat/webapps/tennis.war -d tomcat:8.0

when i try to access the application i'm getting Error 404

url used: http://{EC2_Public_ip}:8080/tennis/ but I'm able to access tomcat default examples app http://{EC2_Public_ip}:8080/examples/

So i'm assuming the IP and port are accessible

In the logs i see the app is deployed with out any error

Logs

    13-Sep-2019 05:33:39.587 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/usr/local/tomcat/webapps/docs] has finished in [53] ms
    13-Sep-2019 05:33:39.590 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/usr/local/tomcat/webapps/examples]
    13-Sep-2019 05:33:40.295 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/usr/local/tomcat/webapps/tennis.war]
    13-Sep-2019 05:33:40.359 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/usr/local/tomcat/webapps/tennis.war] has finished in [64] ms
    13-Sep-2019 05:33:40.369 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"]

Access Log

173.171.238.114 - - [13/Sep/2019:05:34:25 +0000] "GET /tennis/ HTTP/1.1" 404 1085
173.171.238.114 - - [13/Sep/2019:05:34:39 +0000] "GET /tennis/ HTTP/1.1" 404 1085

I have also tried in docker tomcat 9.0 , but no luck

Any suggestions please

Upvotes: 1

Views: 374

Answers (1)

LinPy
LinPy

Reputation: 18578

try to change the -v like this:

-v /full/path/tennis.war:/usr/local/tomcat/webapps/tennis.war

I think Docker create a named volume here with empty folder

Upvotes: 1

Related Questions