The Apache Tomcat container software is developed in an open-source and participatory environment under the Apache License version 2. The Apache Tomcat project is intended to be a collaboration of the best-of-breed developers from around the world. We invite you to participate in this open development project. To learn more about getting involved, click here or keep reading. You can also check Tomcat 10 installation tutorial.
Pull an image from registry
# podman search tomcat --filter=is-official # podman pull docker.io/library/tomcat
Create Apache tomcat container pod
# podman pod create --name tomcatapp -p 8080:8080 --network bridge
Run a container based on Tomcat image downloaded
Here we have initiated a container for the tomcat image and exposed the port 8080 of the tomcat container on port 8080 of localhost using port forwarding. The list of all containers that are available can be shown using the ps option for podman.
# podman run --pod tomcatapp --name tomcat-server -d tomcat:9.0 # podman ps
Fixing error 404
Here is the solution to fix the issue.
# podman exec -it tomcat-server /bin/bash # mv webapps webapps2 # mv webapps.dist/ webapps # exit
Persisting your application
If you remove the container all your data and configurations will be lost, and the next time you run the image the database will be reinitialized. To avoid this loss of data, you should mount a volume that will persist even after the container is removed.
For persistence, you should mount a directory at the
/usr/local/tomcat path. If the mounted directory is empty, it will be initialized on the first run.
The default Tomcat environment in the image is:
CATALINA_BASE: /usr/local/tomcat CATALINA_HOME: /usr/local/tomcat CATALINA_TMPDIR: /usr/local/tomcat/temp JRE_HOME: /usr CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
The configuration files are available in
/usr/local/tomcat/conf/. No user is included in the “manager-GUI” role to operate the “/manager/html” application. If you wish to use this app, you must define such a user in
Apache Tomcat image maintainers have chosen not to enable the default applications as a security precaution, but with two custom configuration files and overriding the Docker command, it is possible to boot Tomcat with a fully functional manager application.
This post provided example configuration files and the podman command to restore the default applications before running Tomcat.
Unfortinately I have to assume this article is very, very old and obsolete.
Why??? Because YOU DON’T DATE YOUR ARTICLES! I have no way of knowing how ‘recent’ it is and there are tons of 10-year-old articles out there.
Also this doesn’t work – it does *not* initialize – it just gives you an empty /usr/local/tomcat and catalina won’t run:
“For persistence, you should mount a directory at the /usr/local/tomcat path. If the mounted directory is empty, it will be initialized on the first run.”
➜ pman ls tomcat
➜ pman podman container rm tomcat-server
➜ pman podman run –pod tomcatapp –name tomcat-server -v /home3/greg/pman/tomcat:/usr/local/tomcat -d tomcat:9.0
Error: runc: container_linux.go:380: starting container process caused: exec: “catalina.sh”: executable file not found in $PATH: OCI runtime attempted to invoke a command that was not found
➜ pman ls tomcat