Configure Tomcat for XWiki in Docker

Last modified by Eleni Cojocariu on 2026/08/13 13:21

Steps

To customize the Tomcat configuration used by the XWiki Docker image, mount a host directory over /usr/local/tomcat/conf inside the container:

  1. Make sure you already have XWiki running using the official Docker image (see XWiki in Docker), including the database container and the Docker network.
  2. Create a temporary container from the XWiki image.
    docker create --name xwiki xwiki:stable-mysql-tomcat
  3. Copy the default Tomcat configuration to the host machine, to start with some existing configuration files.
    docker cp xwiki:/usr/local/tomcat/conf /tmp/tomcat
  4. Modify the configuration files in the copied /tmp/tomcat directory to bring the changes you need.
  5. Remove the temporary container since it was only used to copy the configuration files and we'll need to create a new one with different parameters.
    docker rm xwiki
  6. Start XWiki with the customized Tomcat configuration mounted into the container.
    docker run --net=xwiki-nw --name xwiki -p 8080:8080 \
    -v /tmp/xwiki:/usr/local/xwiki \
    -v /tmp/tomcat:/usr/local/tomcat/conf \
    -e DB_USER=xwiki \
    -e DB_PASSWORD=xwiki \
    -e DB_DATABASE=xwiki \
    -e DB_HOST=mysql-xwiki \
    xwiki:stable-mysql-tomcat

    Replace xwiki-nw with the name of your Docker network, xwiki:stable-mysql-tomcat with the tag you want, and the environment variables with the values matching your environment.

  7. Open your wiki in a browser. XWiki restarts with the mounted configuration, and the Tomcat settings you changed in /tmp/tomcat are now in effect.

FAQ

Where is the Tomcat configuration used by the XWiki Docker Image located?

The Tomcat configuration used by the XWiki Docker image is located in /usr/local/tomcat/conf.

Why would I customize the Tomcat configuration?

For example, to serve XWiki through a reverse proxy, or to terminate TLS inside the container.

How can I modify the default Tomcat configuration instead of creating a new one?

To modify the existing Tomcat configuration, copy the default configuration files from the container to the host machine using the docker cp command. You can then update the copied files locally and mount them back into the container when starting XWiki.

Related

Get Connected