Created
March 26, 2014 13:48
-
-
Save goldmann/9783507 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/Dockerfile b/Dockerfile | |
index 24ee598..07cc7a2 100644 | |
--- a/Dockerfile | |
+++ b/Dockerfile | |
@@ -9,5 +9,4 @@ EXPOSE 3306 | |
ADD ./simple.cnf /etc/my.cnf.d/ | |
ADD ./start-mariadb /usr/bin/ | |
-USER mysql | |
- CMD /usr/bin/start-mariadb | |
\ No newline at end of file | |
+CMD /usr/bin/start-mariadb | |
diff --git a/start-mariadb b/start-mariadb | |
index 9ab48c5..cfdb72b 100755 | |
--- a/start-mariadb | |
+++ b/start-mariadb | |
@@ -48,9 +48,9 @@ function initialize_mariadb() { | |
password=$(generate_password) | |
dbname=${APP_NAME:-master} | |
- /usr/bin/mysql_install_db -u root | |
+ /usr/bin/mysql_install_db --user=mysql | |
- /usr/libexec/mysqld & | |
+ /usr/libexec/mysqld -u mysql & | |
pid=$! | |
wait_for_mysqld_start | |
@@ -58,6 +58,7 @@ function initialize_mariadb() { | |
echo "Creating database $dbname ..." | |
echo "Mysql password will be $password" | |
echo "$password" > /var/lib/mysql/.password | |
+ chown -R mysql:mysql /var/lib/mysql/ | |
sql=$(cat <<SQL | |
drop database if exists test; | |
@@ -88,4 +89,4 @@ SQL | |
initialize_mariadb | |
-exec /usr/libexec/mysqld | |
+exec /usr/libexec/mysqld -u mysql |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment