Deploy war file on Tomcat

In this post, I am going to show how to deploy a war file on Tomcat Server.

For this exercise, I have taken the sample.war file from Tomcat web site. Please refer

Once you have downloaded the sample.war file, then it’s time to create the Dockerfile.

Create Dockerfile and copy the below content in it.

FROM tomcat:8.0
ADD sample.war /usr/local/tomcat/webapps/sample.war

Then it’s time to build and run the docker container.

Build the container:

docker build -t tomcat .

Run the container:

docker run -p 8080:8080 tomcat

Then access the browser and check http://localhost:8080/hello. You will be able to see the welcome message.

One thought on “Deploy war file on Tomcat

  1. Pingback: Docker File to Deploy a WAR file on Tomcat | Bala's Blog

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s