diff --git a/build.gradle b/build.gradle
index ab6d9e3ab3b8261bce08afd29a11a5b8364b4a2f..9fd7dd1f5943d57ae62cc868edf135f666728d9b 100644
--- a/build.gradle
+++ b/build.gradle
@@ -38,9 +38,12 @@ def variants = ['mysql-tomcat', 'mariadb-tomcat', 'postgres-tomcat']
 //   do the same as for the XWiki sha256.
 // - To compute the MariaDB JDBC sha256, get the JAR at
 //   https://search.maven.org/artifact/org.mariadb.jdbc/mariadb-java-client and  do the same as for the XWiki sha256.
+// - To compute the Postgres JDBC sha256, get the JAR at
+//   https://search.maven.org/artifact/org.postgresql/postgresql and do the same as for the XWiki sha256.
 // - Use the JDBC driver versions found in the XWiki POM for the specified versions:
-//   - mysql: https://github.com/xwiki/xwiki-platform/blob/master/pom.xml#L101 (link for master)
-//   - mariadb: https://github.com/xwiki/xwiki-platform/blob/master/pom.xml#L104 (link for master)
+//   - mysql: https://github.com/xwiki/xwiki-platform/blob/master/pom.xml#L110 (link for master)
+//   - mariadb: https://github.com/xwiki/xwiki-platform/blob/master/pom.xml#L113 (link for master)
+//   - postgresql: https://github.com/xwiki/xwiki-platform/blob/master/pom.xml#L119 (link for master)
 
 def tokens = [
     '16': [
@@ -49,7 +52,9 @@ def tokens = [
         mysqlJDBCVersion: '8.3.0',
         mysqlJDBCSha256: '94e7fa815370cdcefed915db7f53f88445fac110f8c3818392b992ec9ee6d295',
         mariadbJDBCVersion: '3.3.3',
-        mariadbJDBCSha256: '89d71a6ffd800c032b23e588108688d391631f0aba962ba2381cc82cb111b796'
+        mariadbJDBCSha256: '89d71a6ffd800c032b23e588108688d391631f0aba962ba2381cc82cb111b796',
+        postgresJDBCVersion: '42.7.2',
+        postgresJDBCSha256: '0c244ac7d02cf89d8e29852eace6595d75bc4d78581b85b2768460081646a57b'
     ],
     '15': [
         xwikiVersion: '15.10.6',
@@ -57,7 +62,9 @@ def tokens = [
         mysqlJDBCVersion: '8.3.0',
         mysqlJDBCSha256: '94e7fa815370cdcefed915db7f53f88445fac110f8c3818392b992ec9ee6d295',
         mariadbJDBCVersion: '3.3.3',
-        mariadbJDBCSha256: '89d71a6ffd800c032b23e588108688d391631f0aba962ba2381cc82cb111b796'
+        mariadbJDBCSha256: '89d71a6ffd800c032b23e588108688d391631f0aba962ba2381cc82cb111b796',
+        postgresJDBCVersion: '42.7.2',
+        postgresJDBCSha256: '0c244ac7d02cf89d8e29852eace6595d75bc4d78581b85b2768460081646a57b'
     ],
     '14': [
         xwikiVersion: '14.10.21',
@@ -65,7 +72,9 @@ def tokens = [
         mysqlJDBCVersion: '8.3.0',
         mysqlJDBCSha256: '94e7fa815370cdcefed915db7f53f88445fac110f8c3818392b992ec9ee6d295',
         mariadbJDBCVersion: '3.3.3',
-        mariadbJDBCSha256: '89d71a6ffd800c032b23e588108688d391631f0aba962ba2381cc82cb111b796'
+        mariadbJDBCSha256: '89d71a6ffd800c032b23e588108688d391631f0aba962ba2381cc82cb111b796',
+        postgresJDBCVersion: '42.7.2',
+        postgresJDBCSha256: '0c244ac7d02cf89d8e29852eace6595d75bc4d78581b85b2768460081646a57b'
     ]
 ]
 
diff --git a/template/Dockerfile b/template/Dockerfile
index a4813578d1b285a4d7109fe93914935550d8fb90..5a6191936e58db84b5a37555c38a03d16f09889e 100644
--- a/template/Dockerfile
+++ b/template/Dockerfile
@@ -60,9 +60,10 @@ RUN rm -rf /usr/local/tomcat/webapps/* && \\
   rm -f xwiki.war
 
 # Copy the JDBC driver in the XWiki webapp
-<% if (db == 'mysql') {
-  println "# For MYSQL, download the MySQL driver version from the Maven Central repository since there's no up to "
-  println "# date Debian repository for it anymore."
+<%
+println "# We take the database driver version from the Maven Central repository since we want to control the version "
+println "# used and have it being consistent with what is tested in the CI."
+if (db == 'mysql') {
   println "ENV MYSQL_JDBC_VERSION=\"$mysqlJDBCVersion\""
   println "ENV MYSQL_JDBC_SHA256=\"$mysqlJDBCSha256\""
   println "ENV MYSQL_JDBC_PREFIX=\"https://repo1.maven.org/maven2/com/mysql/mysql-connector-j/\${MYSQL_JDBC_VERSION}\""
@@ -71,8 +72,6 @@ RUN rm -rf /usr/local/tomcat/webapps/* && \\
   println "RUN curl -fSL \"\${MYSQL_JDBC_PREFIX}/\${MYSQL_JDBC_ARTIFACT}\" -o \$MYSQL_JDBC_TARGET && \\"
   print "  echo \"\$MYSQL_JDBC_SHA256 \$MYSQL_JDBC_TARGET\" | sha256sum -c -"
 } else if (db == 'mariadb') {
-  println "# For MariaDB, download the MariaDB driver version from the Maven Central repository to control the version "
-  println "# used."
   println "ENV MARIADB_JDBC_VERSION=\"$mariadbJDBCVersion\""
   println "ENV MARIADB_JDBC_SHA256=\"$mariadbJDBCSha256\""
   println "ENV MARIADB_JDBC_PREFIX=\"https://repo1.maven.org/maven2/org/mariadb/jdbc/mariadb-java-client/\${MARIADB_JDBC_VERSION}\""
@@ -81,7 +80,13 @@ RUN rm -rf /usr/local/tomcat/webapps/* && \\
   println "RUN curl -fSL \"\${MARIADB_JDBC_PREFIX}/\${MARIADB_JDBC_ARTIFACT}\" -o \$MARIADB_JDBC_TARGET && \\"
   print "  echo \"\$MARIADB_JDBC_SHA256 \$MARIADB_JDBC_TARGET\" | sha256sum -c -"
 } else if (db == 'postgres') {
-  print 'RUN cp /usr/share/java/postgresql-jdbc4.jar /usr/local/tomcat/webapps/ROOT/WEB-INF/lib/'
+  println "ENV POSTGRES_JDBC_VERSION=\"$postgresJDBCVersion\""
+  println "ENV POSTGRES_JDBC_SHA256=\"$postgresJDBCSha256\""
+  println "ENV POSTGRES_JDBC_PREFIX=\"https://repo1.maven.org/maven2/org/postgresql/postgresql/\${POSTGRES_JDBC_VERSION}\""
+  println "ENV POSTGRES_JDBC_ARTIFACT=\"postgresql-\${POSTGRES_JDBC_VERSION}.jar\""
+  println "ENV POSTGRES_JDBC_TARGET=\"/usr/local/tomcat/webapps/ROOT/WEB-INF/lib/\${POSTGRES_JDBC_ARTIFACT}\""
+  println "RUN curl -fSL \"\${POSTGRES_JDBC_PREFIX}/\${POSTGRES_JDBC_ARTIFACT}\" -o \$POSTGRES_JDBC_TARGET && \\"
+  print "  echo \"\$POSTGRES_JDBC_SHA256 \$POSTGRES_JDBC_TARGET\" | sha256sum -c -"
 } %>
 
 # Configure Tomcat. For example set the memory for the Tomcat JVM since the default value is too small for XWiki