Last modified by superadmin on 2026/11/25 20:41

Show last authors
1 To configure PostgreSQL for XWiki using Docker:
2
3 1. Make sure you have already installed and [[configured a servlet container>>doc:documentation.xs.admin.installation.deploy-servlet-container.WebHome]] for XWiki (e.g. [[Tomcat>>doc:documentation.xs.admin.installation.deploy-servlet-container.configure-tomcat.WebHome]] or [[Jetty>>doc:documentation.xs.admin.installation.deploy-servlet-container.configure-jetty.WebHome]]), with the [[XWiki WAR>>doc:documentation.xs.admin.installation.methods.install-xwiki-war.WebHome]] file extracted/deployed.
4 1. Install [[Docker>>https://docs.docker.com/engine/]].
5 1. Start a PostgreSQL container configured for XWiki.(((
6 {{code language="bash"}}
7 docker run --name xwiki-postgres \
8 -e POSTGRES_USER=xwiki \
9 -e POSTGRES_PASSWORD=xwiki \
10 -e POSTGRES_DB=xwiki \
11 -e "POSTGRES_INITDB_ARGS=--encoding=UTF8 --locale-provider=builtin --locale=C.UTF-8" \
12 -v postgres-data:/var/lib/postgresql/data \
13 -p 5432:5432 \
14 -d postgres:17
15 {{/code}}
16
17 Replace ##postgres:17## with a [[supported PostgreSQL version>>dev:Community.SupportStrategy.DatabaseSupportStrategy]]. Replace ##POSTGRES_PASSWORD## with a strong password for production environments. The container automatically creates the ##xwiki## database and user on first startup.
18 )))
19 1. Download the appropriate [[PostgreSQL JDBC driver>>https://jdbc.postgresql.org/download/]].
20 1. Copy the JDBC driver JAR into the XWiki web application's ##WEB-INF/lib## directory, the container's common library directory, or ##TOMCAT_HOME/lib##.
21 1. Edit the ##WEB-INF/hibernate.cfg.xml## file from the expanded XWiki WAR directory.
22 1. Remove or disable the configuration sections related to other databases.
23 1. Uncomment the PostgreSQL configuration section.
24 1. Configure the PostgreSQL connection URL, using ##localhost## if XWiki runs directly on the host, or the PostgreSQL container/service name if XWiki also runs in Docker on a shared network.(((
25 {{code language="xml"}}
26 <property name="hibernate.connection.url">jdbc:postgresql://localhost:5432/xwiki</property>
27 {{/code}}
28 )))
29 1. Save the configuration changes.
30 1. Restart XWiki to apply the changes.
31 1. Open your wiki in a browser. XWiki connects to the PostgreSQL container, creates its tables on first start, and serves the wiki without a database error.

Get Connected