Custom Configuration Files in Docker

Last modified by superadmin on 2026/11/25 21:32

Override configuration files by bind-mounting your own versions from the host, as shown for Docker Run and Docker Compose.

Explanation

It is recommended to mount only the configuration files that you need to customize. During upgrades, any overridden files may need to be merged with the newer default versions provided by XWiki. If a file has not been customized, no merge is required.

Example with Docker Run

If your config files are in a local /my/xwiki/config/path directory, you would use the following for docker run:

docker run ... -v /my/xwiki/config/path/xwiki.cfg:/usr/local/tomcat/webapps/ROOT/WEB-INF/xwiki.cfg -v ... xwiki

Example with Docker Compose

Each configuration file must be mounted as a bind mount from a path on the host, exactly as in the docker run example above. A named volume cannot be used for a single file: Docker always mounts a named volume as a directory, so the container fails to start with "not a directory". Only xwiki-data, which maps the permanent directory, is a named volume.

[...]
services:
  web:
    image: "xwiki:stable-mysql-tomcat"
    [...]
    volumes:
      - xwiki-data:/usr/local/xwiki
      - /my/xwiki/config/path/xwiki.cfg:/usr/local/tomcat/webapps/ROOT/WEB-INF/xwiki.cfg
      - /my/xwiki/config/path/xwiki.properties:/usr/local/tomcat/webapps/ROOT/WEB-INF/xwiki.properties
      - /my/xwiki/config/path/hibernate.cfg.xml:/usr/local/tomcat/webapps/ROOT/WEB-INF/hibernate.cfg.xml
      - /my/xwiki/config/path/jgroups:/usr/local/tomcat/webapps/ROOT/WEB-INF/observation/remote/jgroups
      - /my/xwiki/config/path/logback.xml:/usr/local/tomcat/webapps/ROOT/WEB-INF/classes/logback.xml
      - /my/xwiki/config/path/web.xml:/usr/local/tomcat/webapps/ROOT/WEB-INF/web.xml
    [...]
volumes:
  [...]
  xwiki-data: {}

Related

Get Connected