1

I have created a Spring Boot web API. With the help of Docker the web API is containerized. The Dockerfile you can find below.

When I build the Dockerfile and run it with this command: docker container run -p 8080:8080 --name backend b7908762020, the container is being created. When I navigate to http://localhost:8080/mywar then it shows "HTTP Status 404 – Not Found".

Why is that the case? Is my Dockerfile correct?

FROM maven:3.3.9-jdk-8-alpine as build-env
COPY pom.xml /tmp/
COPY settings.xml /root/.m2/settings.xml
COPY src /tmp/src/

WORKDIR /tmp/
RUN mvn package -Dmaven.test.skip=true

FROM tomcat:8.0

COPY --from=build-env /tmp/target/cbm-server-0.0.1-SNAPSHOT.war $CATALINA_HOME/webapps/cbm-server.war
# The env variabel to pickup the correct environment properties file
ADD setenv.sh $CATALINA_HOME/bin/setenv.sh 
ADD tomcat-users.xml $CATALINA_HOME/conf/tomcat-users.xml

EXPOSE 8009
EXPOSE 8080
CMD ["catalina.sh", "run"]
halfer
  • 19,824
  • 17
  • 99
  • 186
M Yil
  • 877
  • 1
  • 14
  • 35

0 Answers0