I am trying to deploy a spring boot war file on docker container
This is my docker file:
FROM tomcat:alpine
RUN wget -O /usr/local/tomcat/webapps/ROOT.war -U admin:Learning http://localhost:8082/artifactory/demoArtifactory/com/demo/0.0.1-SNAPSHOT/demo-0.0.1-SNAPSHOT.war
EXPOSE 8080
CMD ["catalina.sh", "run"]
I am unable to connect to localhost:7000
UPDATE: This is the docker run command:
docker run -it --name demo-application -d -p 8080:8080 hmt/demo-application:49
"PortBindings": {
"8080/tcp": [
{
"HostIp": "",
"HostPort": "8080"
}
]
}
Now my tomcat is up on localhost:8080 but I am unable to access my application
UPDATE:
@SpringBootApplication
public class DemoApplication{
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
}
1.You need to extend SpringBootServletInitializer.Spring Boot Servlet Initializer class file allows you to configure the application when it is launched by using Servlet Container Reference: https://www.tutorialspoint.com/spring_boot/spring_boot_tomcat_deployment.htm
2.Rename your war file from ROOT.war to something like sample.war .ROOT default app is usually Tomcat Manager