Skip to content

This is the most basic Docker Tomcat example to demonstrate how an image is built using a Dockerfile that copies a sample Java WAR file

Notifications You must be signed in to change notification settings

rss04/basic-docker-tomcat-example

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

DCHQ - Basic Docker Tomcat Example

This is the most basic Docker Tomcat example to demonstrate how an image is built using a Dockerfile that copies a sample Java WAR file. Once you build your own Tomcat image, you can push it to your Docker Hub repository and then run a container using this image on any Linux host that is Docker-enabled.

Clone this project

You can clone this project:

git clone https://github.com/dchqinc/basic-docker-tomcat-example.git

Build an image using the cloned project

cd into the directory of the cloned GitHub project

docker build -t <your-username>/tomcat:latest .

Sign up for an account on Docker Hub and create a public tomcat repository

  • Sign up for a free account on Docker Hub – https://hub.docker.com/

  • Create a public repository called “tomcat”

Push the created image to your Docker Hub repository

docker login
docker push <your-username>/tomcat:latest

Run the container on a Docker-enabled Linux host

docker run -p 8080:8080 -d --name tomcat  <your-username>/tomcat:latest

Access the sample application

You can access the sample application on this URL: http://:8080/sample

Access the logs

You can use this simple command to check the catalina logs of the Tomcat container

docker logs tomcat

Check the files inside the container

You can run this command to enter the container and check the files under the webapps directory

docker exec -it tomcat bash
ls -lrt /usr/local/tomcat/webapps

About

This is the most basic Docker Tomcat example to demonstrate how an image is built using a Dockerfile that copies a sample Java WAR file

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published