diff --git a/mariadb/Dockerfile b/mariadb/Dockerfile index b3b58e0..2a3f965 100644 --- a/mariadb/Dockerfile +++ b/mariadb/Dockerfile @@ -6,9 +6,14 @@ RUN \ addgroup -S -g 3306 mysql \ && adduser -S -u 3306 -h /var/lib/mysql -s /bin/nologin -g mysql -G mysql mysql \ # Install MariaDB - && apk --no-cache add mariadb mariadb-client + && apk --no-cache add mariadb mariadb-client s6 \ + # Create socket directory + && mkdir /run/mysqld \ + && chown mysql:mysql /run/mysqld + +COPY docker/ / VOLUME ["/etc/mysql", "/var/lib/mysql"] EXPOSE 3306 -CMD ["mysqld_safe"] +CMD ["s6-svscan", "/etc/services.d"] diff --git a/mariadb/docker/etc/services.d/.s6-svscan/finish b/mariadb/docker/etc/services.d/.s6-svscan/finish new file mode 100755 index 0000000..78d5fdc --- /dev/null +++ b/mariadb/docker/etc/services.d/.s6-svscan/finish @@ -0,0 +1,3 @@ +#!/bin/sh + +/bin/true diff --git a/mariadb/docker/etc/services.d/mariadb/run b/mariadb/docker/etc/services.d/mariadb/run new file mode 100755 index 0000000..a8d26ef --- /dev/null +++ b/mariadb/docker/etc/services.d/mariadb/run @@ -0,0 +1,5 @@ +#!/bin/execlineb -P + +fdmove -c 2 1 +s6-setuidgid 3306:3306 +/usr/bin/mysqld