Configure PostgreSQL for XWiki Using Docker

Last modified by Eleni Cojocariu on 2026/05/20 16:51

Content

Steps

Warning

WIP

To configure PostgreSQL for XWiki using Docker:

  1. Install Docker.
  2. Start a PostgreSQL container configured for XWiki.
    docker run --name pgtest
    -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"
    -v postgres-data:/var/lib/postgresql/data
    -p 5432:5432
    -d postgres:17
  3. Download the appropriate PostgreSQL JDBC driver.
  4. 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.
  5. Edit the WEB-INF/hibernate.cfg.xml file from the expanded XWiki WAR directory.
  6. Remove or disable the configuration sections related to other databases.
  7. Uncomment the PostgreSQL configuration section.
  8. Configure the PostgreSQL connection URL.
     <property name="connection.url">
    
    jdbc:postgresql://localhost:5432/xwiki
    </property>
  9. Configure the default schema.
    <property name="hibernate.default_schema">public</property>
  10. Save the configuration changes.
  11. Restart XWiki to apply the changes.

Don't forget to replace example values such as environment variables, image tags, etc with values that match your environment.

FAQ

Is there other method of getting the JDBC diriver?

You can also download the JDBC driver directly from the Maven Central Repository and copy the JAR into your container's common lib directory, or in the XWiki webapp (in WEB-INF/lib), or (in TOMCAT_HOME/lib).

Get Connected