I have a test web application that I can run locally on localhost:8080. I build my application with maven:
mvn clean install -U
I run the application with the following maven command:
mvn org.codehaus.mojo:tomcat-maven-plugin:run
Then I can hit localhost url: http://localhost:8080/pokemon/healthcheck This is a simple test app that I want to dockarize just for a learning experience. I was able to run the python "Hello World" example, so i think i have everything installed in right places. My Dockerfile has the following:
FROM tomcat:alpine
RUN ["/bin/rm", "-fr", "/usr/local/tomcat/webapps/ROOT"]
RUN ["/bin/mkdir", "/var/log/tomcat8/"]
COPY target/pokemon.war /usr/local/tomcat/webapps/pokemon.war
Then I stop my locally running localhost, I assume I need to do that, and then I build the image with the following command:
docker build -t pokesheets .
Then I try running it with this command:
docker run -it pokesheets:latest
The log looks good to me, I see the message in the log that the service has started. The container is running, I can see it. But I cannot get to http://localhost:8080/pokemon/healthcheck. So I tried running the docker image with the following as well:
docker run -it -p 8080:8080 pokesheets:latest
docker run -d --name pokesheets -p 8090:8090 -p 8091:8091 pokesheets:latest
docker run --rm -p 8080:8080 pokesheets:latest
docker container run -d --name pokesheets -p 8080:8080 pokesheets:latest
I have a suspicion that maybe there is something very basic that I'm not aware of. I would very much appreciate input from someone who has some experience with the docker and could shed light on the issue.