|
| 1 | +# Tomcat 10-jre21 container image |
| 2 | + |
| 3 | + |
| 4 | +## Description |
| 5 | +Apache Tomcat (Tomcat for short) is a free and open-source implementation of the |
| 6 | +Jakarta Servlet, Jakarta Expression Language, and WebSocket technologies. It |
| 7 | +provides a pure Java HTTP web server environment that can run Java code. It is a |
| 8 | +Java web application server and not a complete JEE application server. |
| 9 | + |
| 10 | + |
| 11 | +## Usage |
| 12 | +By default, the image launches Tomcat with the same configuration as the one |
| 13 | +that comes with SUSE Linux Enterprise Server. The difference is that logging is |
| 14 | +sent to stdout, meaning that the `podman logs tomcat` command displays Tomcat |
| 15 | +logs. |
| 16 | + |
| 17 | +For security reasons, the image runs as the **tomcat** user. This means that |
| 18 | +additional packages cannot be installed via `zypper`, unless the user becomes |
| 19 | +`root`. |
| 20 | + |
| 21 | +To deploy an application, copy the `.war` file into |
| 22 | +`$CATALINA_BASE/webapps` (either during a container build or by bind-mounting |
| 23 | +the directory), and launch the container using the following command: |
| 24 | +```ShellSession |
| 25 | +$ podman run -d --rm -p 8080:8080 registry.opensuse.org/opensuse/apache-tomcat:10-jre21 |
| 26 | +``` |
| 27 | + |
| 28 | +The deployed webapp is then accessible via `http://localhost:8080/$webapp_name`. |
| 29 | + |
| 30 | + |
| 31 | +### How to use the image with rootless Podman |
| 32 | + |
| 33 | +The container image can be used in rootless mode with Podman. Keep in mind that |
| 34 | +Podman remaps the `tomcat` user in the container to a different user on the |
| 35 | +host. This user does not have write access to the mounted directory. To avoid |
| 36 | +permission issues change permissions of the shared directory to `0777` as |
| 37 | +follows: |
| 38 | + |
| 39 | +```ShellSession |
| 40 | +$ chmod 0777 /path/to/my/app |
| 41 | +$ podman run --rm -d -v /path/to/my/app:/usr/share/tomcat/webapps:z \ |
| 42 | + -p 8080:8080 registry.opensuse.org/opensuse/apache-tomcat:10-jre21 |
| 43 | +``` |
| 44 | + |
| 45 | + |
| 46 | +## Configuration |
| 47 | + |
| 48 | +The main Tomcat configuration files (for example |
| 49 | +`/etc/tomcat/logging.properties`) are stored in `/etc/tomcat/`. |
| 50 | + |
| 51 | +Tomcat's runtime options can be configured using the environment variables |
| 52 | +`JAVA_OPTS` and `CATALINA_OPTS`. `JAVA_OPTS` specifies general options used for |
| 53 | +the JVM, whereas `CATALINA_OPTS` specifies Tomcat's flags. You can pass the |
| 54 | +options to the container runtime using the `-e` flag: |
| 55 | +```ShellSession |
| 56 | +$ podman run -it --rm \ |
| 57 | + -e JAVA_OPTS="-Xmx1024m" -p 8080:8080 \ |
| 58 | + registry.opensuse.org/opensuse/apache-tomcat:10-jre21 |
| 59 | +``` |
| 60 | + |
| 61 | +The image ships with `CATALINA_HOME` set to `/usr/share/tomcat` |
| 62 | +and `CATALINA_BASE` set to `/usr/share/tomcat`. |
| 63 | + |
| 64 | + |
| 65 | +## Samples |
| 66 | + |
| 67 | +By default, the sample applications shipped with Tomcat are not installed in |
| 68 | +the container image. Add them by installing one of the following |
| 69 | +packages: |
| 70 | +- tomcat10-webapps |
| 71 | +- tomcat10-admin-webapps |
| 72 | + |
| 73 | +## Upgrading from Tomcat 9 |
| 74 | + |
| 75 | +Tomcat 9 implements Java EE 8, and Tomcat 10 |
| 76 | +implements Jakarta EE 9. Before upgrading from version 9, consult the |
| 77 | +[upstream migration guide](https://tomcat.apache.org/migration-10.html). |
| 78 | + |
| 79 | +## Licensing |
| 80 | + |
| 81 | +`SPDX-License-Identifier: MIT` |
| 82 | + |
| 83 | +This documentation and the build recipe are licensed as MIT. |
| 84 | +The container itself contains various software components under various open source licenses listed in the associated |
| 85 | +Software Bill of Materials (SBOM). |
| 86 | + |
| 87 | +This image is based on [openSUSE Tumbleweed](https://get.opensuse.org/tumbleweed/). |
0 commit comments