From 1279fd0a95811a655cfe27f83b075af11c2ab89b Mon Sep 17 00:00:00 2001
From: Vincent Massol <vincent@massol.net>
Date: Fri, 24 Feb 2017 16:09:37 +0100
Subject: [PATCH]  XDOCKER-11: Stop using Docker link feature
 (legacy/deprecated)  XDOCKER-10: Cannot change database name * Add leftover
 that was forgotten

---
 8/mysql-tomcat/Dockerfile | 8 +++++++-
 9/mysql-tomcat/Dockerfile | 8 +++++++-
 template/Dockerfile       | 8 +++++++-
 3 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/8/mysql-tomcat/Dockerfile b/8/mysql-tomcat/Dockerfile
index c72d1cc..73f05dc 100644
--- a/8/mysql-tomcat/Dockerfile
+++ b/8/mysql-tomcat/Dockerfile
@@ -80,6 +80,11 @@ VOLUME /usr/local/xwiki
 #               xwiki's hibernate.cfg.xml file.
 # - MYSQL_PASSWORD: the password for the user configured for XWiki in the DB. Default is "xwiki". This is used to
 #                   configure xwiki's hibernate.cfg.xml file.
+# - MYSQL_DATABASE: the name of the database to use. Default is "xwiki". This is used to configure xwiki's
+#                   hibernate.cfg.xml file.
+# - DB_CONTAINER_NAME: The name of the docker container containing the database. Default is "db". This is used to
+#                      configure xwiki's hibernate.cfg.xml file.
+
 # Example:
 #   docker run -it -e "MYSQL_USER=xwiki" -e "MYSQL_PASSWORD=xwiki" <imagename>
 
@@ -88,6 +93,7 @@ VOLUME /usr/local/xwiki
 # container executes and Tomcat will be started. If some other parameter is passed then it'll be executed to comply
 # with best practices defined at https://github.com/docker-library/official-images#consistency.
 ENV MYSQL_USER=xwiki \
-    MYSQL_PASSWORD=xwiki
+    MYSQL_PASSWORD=xwiki \
+    DB_CONTAINER_NAME
 ENTRYPOINT ["docker-entrypoint.sh"]
 CMD ["xwiki"]
diff --git a/9/mysql-tomcat/Dockerfile b/9/mysql-tomcat/Dockerfile
index 461c994..d64a492 100644
--- a/9/mysql-tomcat/Dockerfile
+++ b/9/mysql-tomcat/Dockerfile
@@ -80,6 +80,11 @@ VOLUME /usr/local/xwiki
 #               xwiki's hibernate.cfg.xml file.
 # - MYSQL_PASSWORD: the password for the user configured for XWiki in the DB. Default is "xwiki". This is used to
 #                   configure xwiki's hibernate.cfg.xml file.
+# - MYSQL_DATABASE: the name of the database to use. Default is "xwiki". This is used to configure xwiki's
+#                   hibernate.cfg.xml file.
+# - DB_CONTAINER_NAME: The name of the docker container containing the database. Default is "db". This is used to
+#                      configure xwiki's hibernate.cfg.xml file.
+
 # Example:
 #   docker run -it -e "MYSQL_USER=xwiki" -e "MYSQL_PASSWORD=xwiki" <imagename>
 
@@ -88,6 +93,7 @@ VOLUME /usr/local/xwiki
 # container executes and Tomcat will be started. If some other parameter is passed then it'll be executed to comply
 # with best practices defined at https://github.com/docker-library/official-images#consistency.
 ENV MYSQL_USER=xwiki \
-    MYSQL_PASSWORD=xwiki
+    MYSQL_PASSWORD=xwiki \
+    DB_CONTAINER_NAME
 ENTRYPOINT ["docker-entrypoint.sh"]
 CMD ["xwiki"]
diff --git a/template/Dockerfile b/template/Dockerfile
index ca41aac..94eb0be 100644
--- a/template/Dockerfile
+++ b/template/Dockerfile
@@ -80,6 +80,11 @@ VOLUME /usr/local/xwiki
 #               xwiki's hibernate.cfg.xml file.
 # - MYSQL_PASSWORD: the password for the user configured for XWiki in the DB. Default is "xwiki". This is used to
 #                   configure xwiki's hibernate.cfg.xml file.
+# - MYSQL_DATABASE: the name of the database to use. Default is "xwiki". This is used to configure xwiki's
+#                   hibernate.cfg.xml file.
+# - DB_CONTAINER_NAME: The name of the docker container containing the database. Default is "db". This is used to
+#                      configure xwiki's hibernate.cfg.xml file.
+
 # Example:
 #   docker run -it -e "MYSQL_USER=xwiki" -e "MYSQL_PASSWORD=xwiki" <imagename>
 
@@ -88,6 +93,7 @@ VOLUME /usr/local/xwiki
 # container executes and Tomcat will be started. If some other parameter is passed then it'll be executed to comply
 # with best practices defined at https://github.com/docker-library/official-images#consistency.
 ENV MYSQL_USER=xwiki \
-    MYSQL_PASSWORD=xwiki
+    MYSQL_PASSWORD=xwiki \
+    DB_CONTAINER_NAME
 ENTRYPOINT ["docker-entrypoint.sh"]
 CMD ["xwiki"]
-- 
GitLab