HUB
Sign inSign up
tomcat logo

dchq/tomcat

By dchq

•Updated almost 11 years ago

Basic Tomcat example with a sample Java WAR file

Image
0

1.2K

dchq/tomcat repository overview

DCHQ

⁠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
⁠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
Tag summary
Recent tags
Content type
Image
Digest
Size
191.5 MB
Last updated
almost 11 years ago
docker pull dchq/tomcat:latest