Skip to main content

Tomcat

What is Tomcat?

Apache Tomcat is a Java Servlet container that runs Java web applications packaged as WAR files. Laradock runs it from the official tomcat Docker image.

Start Tomcat

docker compose up -d tomcat

Stop Tomcat

docker compose stop tomcat

Configuration

Settings live in tomcat/defaults.env and can be overridden in your own .env:

VariableDefaultWhat it does
TOMCAT_VERSION9.0Image tag from the official tomcat Docker Hub page.
TOMCAT_HOST_HTTP_PORT8080Host port Tomcat is published on (container always listens on 8080 internally).

Deploy a WAR file

Drop a .war file into DATA_PATH_HOST/tomcat/webapps, it's mounted straight into Tomcat's own webapps directory, so Tomcat picks it up and auto-deploys it without a rebuild:

cp your-app.war "${DATA_PATH_HOST}/tomcat/webapps/"

Open http://localhost:8080 to reach the Tomcat welcome page, or http://localhost:8080/your-app once your WAR has deployed. Logs are written to DATA_PATH_HOST/tomcat/logs, also mounted from the host.

Common issues

  • WAR file doesn't deploy. Check DATA_PATH_HOST/tomcat/logs for deployment errors, malformed WAR files or Java errors surface there, not in docker compose logs tomcat.
  • Changing TOMCAT_VERSION doesn't take effect. Tomcat runs from a prebuilt image (no local Dockerfile to rebuild), so a plain restart after changing .env is enough: docker compose up -d tomcat.
  • Port already in use on your host. Change TOMCAT_HOST_HTTP_PORT in .env and restart: docker compose up -d tomcat.

New to Laradock? Start at Getting Started.