Run XWiki (MariaDB on Tomcat) using Docker Run
Last modified by Eleni Cojocariu on 2026/05/06 13:41
Steps
To run XWiki with MariaDB using Docker Run:
- Create a dedicated Docker network.
docker network create -d bridge xwiki-nw - Create local directories for MariaDB data and initialization files.
mkdir -p /my/path/mariadb mkdir -p /my/path/mariadb-init - Create an initialization SQL file in /my/path/mariadb-init. Name it init.sql
grant all privileges on *.* to xwiki@'%'; - Start the MariaDB container. For example:
docker run --net=xwiki-nw --name mysql-xwiki \ -v /my/path/mariadb:/var/lib/mysql \ -v /my/path/mariadb-init:/docker-entrypoint-initdb.d \ -e MYSQL_ROOT_PASSWORD=xwiki \ -e MYSQL_USER=xwiki \ -e MYSQL_PASSWORD=xwiki \ -e MYSQL_DATABASE=xwiki \ -d mariadb:11.6 \ --character-set-server=utf8mb4 \ --collation-server=utf8mb4_bin \ --explicit-defaults-for-timestamp=1 - Create a local directory for the XWiki permanent directory.
mkdir -p /my/path/xwiki - Start the XWiki container. For example:
docker run --net=xwiki-nw --name xwiki -p 8080:8080 \ -v /my/path/xwiki:/usr/local/xwiki \ -e DB_USER=xwiki \ -e DB_PASSWORD=xwiki \ -e DB_DATABASE=xwiki \ -e DB_HOST=mysql-xwiki \ xwiki:stable-mariadb-tomcat - Open XWiki in your browser at
http://localhost:8080. - Follow the Distribution Wizard to finish the installation.
Don't forget to replace xwiki-nw with the name of your Docker network, the vales of the environment variables, mariadb:11.6 and xwiki:stable-mariadb-tomcat with the actual name you give and tag you want (Supported tags and respective Dockerfile links).
FAQ
Should I change the default passwords used in the examples?
Yes. Replace the example passwords with your own values for both the MySQL root user and the xwiki database user. If you change the xwiki password, make sure to also update the SQL GRANT statement in the initialization file.