diff --git a/11/mysql-tomcat/Dockerfile b/11/mysql-tomcat/Dockerfile
index 67c823ac1a743cb19461a5fa1f5d8e3dad20831c..cacf3ee8cb0ad921c181218de2cb885a49d542ea 100644
--- a/11/mysql-tomcat/Dockerfile
+++ b/11/mysql-tomcat/Dockerfile
@@ -37,14 +37,13 @@ RUN apt-get update && \
     curl \
     libreoffice \
     unzip \
-    procps \
-    libmysql-java && \
+    procps && \
   rm -rf /var/lib/apt/lists/*
 
 # Install XWiki as the ROOT webapp context in Tomcat
 # Create the Tomcat temporary directory
 # Configure the XWiki permanent directory
-ENV XWIKI_VERSION=11.10.5
+ENV XWIKI_VERSION="11.10.5"
 ENV XWIKI_URL_PREFIX "https://maven.xwiki.org/releases/org/xwiki/platform/xwiki-platform-distribution-war/${XWIKI_VERSION}"
 ENV XWIKI_DOWNLOAD_SHA256 b08c8a9f0abbbf2bef5c61852688165dd4b2a9a7217da29047647e81c1ec3058
 RUN rm -rf /usr/local/tomcat/webapps/* && \
@@ -56,7 +55,13 @@ RUN rm -rf /usr/local/tomcat/webapps/* && \
   rm -f xwiki.war
 
 # Copy the JDBC driver in the XWiki webapp
-RUN cp /usr/share/java/mysql-connector-java-*.jar /usr/local/tomcat/webapps/ROOT/WEB-INF/lib/
+# For MYSQL, download the MySQL driver version from the Maven Central repository since there's no up to 
+# date Debian repository for it anymore.
+ENV MYSQL_JDBC_VERSION="8.0.20"
+ENV MYSQL_JDBC_PREFIX="https://repo1.maven.org/maven2/mysql/mysql-connector-java/${MYSQL_JDBC_VERSION}"
+ENV MYSQL_JDBC_ARTIFACT="mysql-connector-java-${MYSQL_JDBC_VERSION}.jar"
+ENV MYSQL_JDBC_TARGET="/usr/local/tomcat/webapps/ROOT/WEB-INF/lib/${MYSQL_JDBC_ARTIFACT}"
+RUN curl -fSL "${MYSQL_JDBC_PREFIX}/${MYSQL_JDBC_ARTIFACT}" -o $MYSQL_JDBC_TARGET
 
 # Configure Tomcat. For example set the memory for the Tomcat JVM since the default value is too small for XWiki
 COPY tomcat/setenv.sh /usr/local/tomcat/bin/
diff --git a/11/postgres-tomcat/Dockerfile b/11/postgres-tomcat/Dockerfile
index 7161cdb2388f7bb4a8453cc6229bc7c0f41a0713..3abed1efc9c0da348a66be8f94e1e556c6c33e4e 100644
--- a/11/postgres-tomcat/Dockerfile
+++ b/11/postgres-tomcat/Dockerfile
@@ -44,7 +44,7 @@ RUN apt-get update && \
 # Install XWiki as the ROOT webapp context in Tomcat
 # Create the Tomcat temporary directory
 # Configure the XWiki permanent directory
-ENV XWIKI_VERSION=11.10.5
+ENV XWIKI_VERSION="11.10.5"
 ENV XWIKI_URL_PREFIX "https://maven.xwiki.org/releases/org/xwiki/platform/xwiki-platform-distribution-war/${XWIKI_VERSION}"
 ENV XWIKI_DOWNLOAD_SHA256 b08c8a9f0abbbf2bef5c61852688165dd4b2a9a7217da29047647e81c1ec3058
 RUN rm -rf /usr/local/tomcat/webapps/* && \
diff --git a/12/mysql-tomcat/Dockerfile b/12/mysql-tomcat/Dockerfile
index c8c7b4b467683b25f5d28fb20b5d5fa96b79e137..7153d54f811115bdda3677d732b8a84d41a1d410 100644
--- a/12/mysql-tomcat/Dockerfile
+++ b/12/mysql-tomcat/Dockerfile
@@ -37,14 +37,13 @@ RUN apt-get update && \
     curl \
     libreoffice \
     unzip \
-    procps \
-    libmysql-java && \
+    procps && \
   rm -rf /var/lib/apt/lists/*
 
 # Install XWiki as the ROOT webapp context in Tomcat
 # Create the Tomcat temporary directory
 # Configure the XWiki permanent directory
-ENV XWIKI_VERSION=12.4
+ENV XWIKI_VERSION="12.4"
 ENV XWIKI_URL_PREFIX "https://maven.xwiki.org/releases/org/xwiki/platform/xwiki-platform-distribution-war/${XWIKI_VERSION}"
 ENV XWIKI_DOWNLOAD_SHA256 f42fe7b84a323b0f637c0e9c60e885741821b2fd05f0196d4d41729d5888d2cc
 RUN rm -rf /usr/local/tomcat/webapps/* && \
@@ -56,7 +55,13 @@ RUN rm -rf /usr/local/tomcat/webapps/* && \
   rm -f xwiki.war
 
 # Copy the JDBC driver in the XWiki webapp
-RUN cp /usr/share/java/mysql-connector-java-*.jar /usr/local/tomcat/webapps/ROOT/WEB-INF/lib/
+# For MYSQL, download the MySQL driver version from the Maven Central repository since there's no up to 
+# date Debian repository for it anymore.
+ENV MYSQL_JDBC_VERSION="8.0.20"
+ENV MYSQL_JDBC_PREFIX="https://repo1.maven.org/maven2/mysql/mysql-connector-java/${MYSQL_JDBC_VERSION}"
+ENV MYSQL_JDBC_ARTIFACT="mysql-connector-java-${MYSQL_JDBC_VERSION}.jar"
+ENV MYSQL_JDBC_TARGET="/usr/local/tomcat/webapps/ROOT/WEB-INF/lib/${MYSQL_JDBC_ARTIFACT}"
+RUN curl -fSL "${MYSQL_JDBC_PREFIX}/${MYSQL_JDBC_ARTIFACT}" -o $MYSQL_JDBC_TARGET
 
 # Configure Tomcat. For example set the memory for the Tomcat JVM since the default value is too small for XWiki
 COPY tomcat/setenv.sh /usr/local/tomcat/bin/
diff --git a/12/postgres-tomcat/Dockerfile b/12/postgres-tomcat/Dockerfile
index 428d41dc42361a1ef6bb25db315106075fdaa307..3b317d12a1edf965b30bb412b66c6c4add39d053 100644
--- a/12/postgres-tomcat/Dockerfile
+++ b/12/postgres-tomcat/Dockerfile
@@ -44,7 +44,7 @@ RUN apt-get update && \
 # Install XWiki as the ROOT webapp context in Tomcat
 # Create the Tomcat temporary directory
 # Configure the XWiki permanent directory
-ENV XWIKI_VERSION=12.4
+ENV XWIKI_VERSION="12.4"
 ENV XWIKI_URL_PREFIX "https://maven.xwiki.org/releases/org/xwiki/platform/xwiki-platform-distribution-war/${XWIKI_VERSION}"
 ENV XWIKI_DOWNLOAD_SHA256 f42fe7b84a323b0f637c0e9c60e885741821b2fd05f0196d4d41729d5888d2cc
 RUN rm -rf /usr/local/tomcat/webapps/* && \
diff --git a/template/Dockerfile b/template/Dockerfile
index ab5167862bc2b23495898d8fb2af8f8cac5ae05d..48808c8a1e8310e0986ff896439f5e67c1d36eca 100644
--- a/template/Dockerfile
+++ b/template/Dockerfile
@@ -41,15 +41,13 @@ RUN apt-get update && \\
     curl \\
     libreoffice \\
     unzip \\
-    procps \\
-    <% if (db == 'mysql') print 'libmysql-java'
-       if (db == 'postgres') print 'libpostgresql-jdbc-java' %> && \\
+    procps <% if (db == 'postgres') print '\\\n    libpostgresql-jdbc-java ' %>&& \\
   rm -rf /var/lib/apt/lists/*
 
 # Install XWiki as the ROOT webapp context in Tomcat
 # Create the Tomcat temporary directory
 # Configure the XWiki permanent directory
-ENV XWIKI_VERSION=$xwikiVersion
+ENV XWIKI_VERSION="$xwikiVersion"
 ENV XWIKI_URL_PREFIX "https://maven.xwiki.org/releases/org/xwiki/platform/xwiki-platform-distribution-war/\${XWIKI_VERSION}"
 ENV XWIKI_DOWNLOAD_SHA256 $xwikiSha256
 RUN rm -rf /usr/local/tomcat/webapps/* && \\
@@ -61,10 +59,17 @@ RUN rm -rf /usr/local/tomcat/webapps/* && \\
   rm -f xwiki.war
 
 # Copy the JDBC driver in the XWiki webapp
-<% if (db == 'mysql')
-      print 'RUN cp /usr/share/java/mysql-connector-java-*.jar /usr/local/tomcat/webapps/ROOT/WEB-INF/lib/'
-   else if (db == 'postgres')
-      print 'RUN cp /usr/share/java/postgresql-jdbc4.jar /usr/local/tomcat/webapps/ROOT/WEB-INF/lib/' %>
+<% 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 "ENV MYSQL_JDBC_VERSION=\"8.0.20\""
+  println "ENV MYSQL_JDBC_PREFIX=\"https://repo1.maven.org/maven2/mysql/mysql-connector-java/\${MYSQL_JDBC_VERSION}\""
+  println "ENV MYSQL_JDBC_ARTIFACT=\"mysql-connector-java-\${MYSQL_JDBC_VERSION}.jar\""
+  println "ENV MYSQL_JDBC_TARGET=\"/usr/local/tomcat/webapps/ROOT/WEB-INF/lib/\${MYSQL_JDBC_ARTIFACT}\""
+  print "RUN curl -fSL \"\${MYSQL_JDBC_PREFIX}/\${MYSQL_JDBC_ARTIFACT}\" -o \$MYSQL_JDBC_TARGET"
+} else if (db == 'postgres') {
+  print 'RUN cp /usr/share/java/postgresql-jdbc4.jar /usr/local/tomcat/webapps/ROOT/WEB-INF/lib/'
+} %>
 
 # Configure Tomcat. For example set the memory for the Tomcat JVM since the default value is too small for XWiki
 COPY tomcat/setenv.sh /usr/local/tomcat/bin/