Raja's Exocortex

Running Tomcat Applications in Docker

Follows the cohesion-coupling-composition documentation on how to run Tomcat applications in Docker.

The app.war file is bind mounted from the host.

Sample Tomcat App for testing, direct war download. Visit app.example.com/sample

# Filename: docker-compose.yaml
# Run tomcat applications in docker.
# The tomcat/java run time is from docker, the application war file is bind
# mounted from the host folder.
#
# Copy app.war to ./webapps/app.war
# Tomcat runs by default on tcp:8080

name: app-example-com

services:
  app:
    image: tomcat:10-jre11
    container_name: app.example.com
    restart: always

    mem_limit: 16G

    volumes:
      - ./webapps/app.war:/usr/local/tomcat/webapps/app.war:ro

    labels:
      - com.centurylinklabs.watchtower.enable=true
      - traefik.enable=true
      - traefik.http.routers.app.rule=Host(`app.example.com`)
      - traefik.http.routers.app.tls=true
      - traefik.http.routers.app.tls.certresolver=lets-encrypt

TODO