Run XWiki (PostgreSQL on Tomcat) using Docker Run
Last modified by Eleni Cojocariu on 2026/05/06 13:41
Steps
To run XWiki with PostgreSQL using Docker Run:
- Create a dedicated Docker network.
docker network create -d bridge xwiki-nw - Create a local directory for PostgreSQL data.
mkdir -p /my/path/postgres - Start the PostgreSQL container. For example:
docker run --net=xwiki-nw --name postgres-xwiki \ -v /my/path/postgres:/var/lib/postgresql/data \ -e POSTGRES_USER=xwiki \ -e POSTGRES_PASSWORD=xwiki \ -e POSTGRES_DB=xwiki \ -e POSTGRES_INITDB_ARGS="--encoding=UTF8 --locale-provider=builtin --locale=C.UTF-8" \ -d postgres:17 - 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=postgres-xwiki \ xwiki:stable-postgres-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, postgres:17 and xwiki:stable-postgres-tomcat with the actual name you give and tag you want (Supported tags and respective Dockerfile links).
FAQ
Which PostgreSQL data path should I mount?
The required mount path depends on the PostgreSQL image version. For versions up to 17 use mount path: /var/lib/postgresql/data, for version 18 and later /var/lib/postgresql. Use the path that matches the PostgreSQL image tag you are using.