In this post, I am going to show how to deploy a war file on Jetty Server.
For this exercise, I have taken the sample.war file from Tomcat web site. Please refer https://tomcat.apache.org/tomcat-6.0-doc/appdev/sample/
Once you have downloaded the sample.war file, then it’s time to create the Dockerfile.
Create a Dockerfile and copy the below content in it.
FROM jetty ADD sample.war /var/lib/jetty/webapps/root.war EXPOSE 8080
Then it’s time to build and run the docker container.
Build the container:
docker build -t jetty .
Run the container:
docker run -p 8080:8080 jetty
Then access the browser and check http://localhost:8080/hello. You will be able to see the welcome message.