From c1a03e1b1c513a87941645e461547dc6680e2425 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Fri, 9 Apr 2021 13:47:28 +1000 Subject: [PATCH] socket directory permission fix if volume The socket directory may be a volume with its ownership being that of root. This correct that ownership to be of user mysql to facilitate it starting. Thanks Douglas Silva for the bug report. closes #363. --- 10.2/docker-entrypoint.sh | 2 ++ 10.3/docker-entrypoint.sh | 2 ++ 10.4/docker-entrypoint.sh | 2 ++ 10.5/docker-entrypoint.sh | 2 ++ 10.6/docker-entrypoint.sh | 2 ++ docker-entrypoint.sh | 2 ++ 6 files changed, 12 insertions(+) diff --git a/10.2/docker-entrypoint.sh b/10.2/docker-entrypoint.sh index b0a28588..4870f820 100755 --- a/10.2/docker-entrypoint.sh +++ b/10.2/docker-entrypoint.sh @@ -163,6 +163,8 @@ docker_create_db_directories() { if [ "$user" = "0" ]; then # this will cause less disk access than `chown -R` find "$DATADIR" \! -user mysql -exec chown mysql '{}' + + # See https://github.com/MariaDB/mariadb-docker/issues/363 + find "${SOCKET%/*}" -maxdepth 0 \! -user mysql -exec chown mysql '{}' \; fi } diff --git a/10.3/docker-entrypoint.sh b/10.3/docker-entrypoint.sh index b0a28588..4870f820 100755 --- a/10.3/docker-entrypoint.sh +++ b/10.3/docker-entrypoint.sh @@ -163,6 +163,8 @@ docker_create_db_directories() { if [ "$user" = "0" ]; then # this will cause less disk access than `chown -R` find "$DATADIR" \! -user mysql -exec chown mysql '{}' + + # See https://github.com/MariaDB/mariadb-docker/issues/363 + find "${SOCKET%/*}" -maxdepth 0 \! -user mysql -exec chown mysql '{}' \; fi } diff --git a/10.4/docker-entrypoint.sh b/10.4/docker-entrypoint.sh index b0a28588..4870f820 100755 --- a/10.4/docker-entrypoint.sh +++ b/10.4/docker-entrypoint.sh @@ -163,6 +163,8 @@ docker_create_db_directories() { if [ "$user" = "0" ]; then # this will cause less disk access than `chown -R` find "$DATADIR" \! -user mysql -exec chown mysql '{}' + + # See https://github.com/MariaDB/mariadb-docker/issues/363 + find "${SOCKET%/*}" -maxdepth 0 \! -user mysql -exec chown mysql '{}' \; fi } diff --git a/10.5/docker-entrypoint.sh b/10.5/docker-entrypoint.sh index b0a28588..4870f820 100755 --- a/10.5/docker-entrypoint.sh +++ b/10.5/docker-entrypoint.sh @@ -163,6 +163,8 @@ docker_create_db_directories() { if [ "$user" = "0" ]; then # this will cause less disk access than `chown -R` find "$DATADIR" \! -user mysql -exec chown mysql '{}' + + # See https://github.com/MariaDB/mariadb-docker/issues/363 + find "${SOCKET%/*}" -maxdepth 0 \! -user mysql -exec chown mysql '{}' \; fi } diff --git a/10.6/docker-entrypoint.sh b/10.6/docker-entrypoint.sh index b0a28588..4870f820 100755 --- a/10.6/docker-entrypoint.sh +++ b/10.6/docker-entrypoint.sh @@ -163,6 +163,8 @@ docker_create_db_directories() { if [ "$user" = "0" ]; then # this will cause less disk access than `chown -R` find "$DATADIR" \! -user mysql -exec chown mysql '{}' + + # See https://github.com/MariaDB/mariadb-docker/issues/363 + find "${SOCKET%/*}" -maxdepth 0 \! -user mysql -exec chown mysql '{}' \; fi } diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index b0a28588..4870f820 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -163,6 +163,8 @@ docker_create_db_directories() { if [ "$user" = "0" ]; then # this will cause less disk access than `chown -R` find "$DATADIR" \! -user mysql -exec chown mysql '{}' + + # See https://github.com/MariaDB/mariadb-docker/issues/363 + find "${SOCKET%/*}" -maxdepth 0 \! -user mysql -exec chown mysql '{}' \; fi }