ARG) for Tomcat versioning, and demonstrate how to override it at build time.
Table of Contents
- Prerequisites
- Clone the Repository
- Reviewing the Dockerfile
- Dockerfile Instruction Reference
- Building and Running the Default Image
- Building with a Custom Tomcat Version
- Links and References
Prerequisites
- Docker Engine installed (≥ 19.03)
- Basic familiarity with Docker commands
- Internet access to download Tomcat and sample WAR
Ensure you have enough disk space (~500 MB) and proper network connectivity to Apache archives.
Clone the Repository
Get the sample project containing ourDockerfile:
Reviewing the Dockerfile
Below is the completeDockerfile. It installs OpenJDK 8, downloads Tomcat into /opt/tomcat, sets permissions, and deploys a sample WAR file.
Dockerfile Instruction Reference
Building and Running the Default Image
Build with the default Tomcat version (8.5.6):
http://<host>:84 in your browser. You should see the Tomcat welcome page for version 8.5.6.
Building with a Custom Tomcat Version
You can overridetomcat_version at build time to use any release from the Apache Tomcat Archive:
http://<host>:86 to confirm you’re running Tomcat version 8.5.8.
Always verify that the Tomcat version you specify in
--build-arg exists in the archive. Incorrect versions will cause the build to fail.