Database Configuration Considerations for XWiki with Docker

Last modified by Eleni Cojocariu on 2026/05/06 13:20

Explanation

Warning

WIP

When running XWiki with a relational database in Docker using Docker Run, the configuration depends on the database engine used. MySQL and MariaDB share similar behavior, while PostgreSQL differs in several aspects.

MySQL and MariaDB

Running XWiki on MySQL using Docker Run and Running XWiki on MariaDB using Dokcer Run use a similar initialization and storage model.

When starting a container for the databse, it is common to mount two directories:

  • One directory is used during database initialization to provide SQL files, such as permission setup scripts.
  • One directory is used to store the MySQL data files so that the database content is preserved when the container is stopped, removed, or restarted.

The initialization SQL file (init.sql inside /my/path/mysql-init or /my/path/mariadb-init) grants additional privileges to the XWiki database user. This allows the user to create new schemas, which is required for features such as sub-wikis.

When mounting directories into the container, always use fully-qualified absolute paths. Relative paths may lead to unexpected behavior depending on how Docker is executed.

PostgreSQL

PostgreSQL follows a different approach compared to MySQL and MariaDB.

When running XWiki on PostgreSQL using Docker Run, in most setups, only a single directory is mounted to persist data (for example /var/lib/postgresql/data or /var/lib/postgresql depending on the version). Initialization through mounted SQL scripts is not commonly used in the same way as with MySQL or MariaDB in these examples.

Database initialization and user setup are typically handled through environment variables rather than external SQL scripts.

Get Connected