Giter Club home page Giter Club logo

basic-docker-tomcat-example's Introduction

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.