Use -slim or -alpine variants to reduce the attack surface and speed up deployment times.
FROM tomcat:9.0-jdk11-openjdk-slim COPY ./my-app.war /usr/local/tomcat/webapps/ EXPOSE 8080 CMD ["catalina.sh", "run"] Use code with caution. tomcat 9 docker image download
You can then visit localhost:8080 in your browser. Note that in recent official images, the webapps folder is empty by default for security reasons. You may need to copy the webapps.dist content into webapps or deploy your own WAR file to see a landing page. Deploying Your Application Use -slim or -alpine variants to reduce the
If you require a specific version of the Java Development Kit (JDK) or a slimmer operating system base, you can specify tags: docker pull tomcat:9.0-jdk11 Note that in recent official images, the webapps
Downloading the image is only the first step. To start a live server and map it to your local machine’s port 8080, execute: docker run -d -p 8080:8080 --name my-tomcat tomcat:9.0
When working with Tomcat 9 Docker images, keep these tips in mind:
The most reliable way to get Tomcat 9 is through Docker Hub. The official image is maintained by the community and updated regularly to patch security vulnerabilities.