From 887b99c63bd5abf5fcd9f9d818bfae19c7d1eb83 Mon Sep 17 00:00:00 2001 From: Disassembler Date: Sun, 29 Apr 2018 21:48:14 +0200 Subject: [PATCH] Migrate MariaDB to S6 supervisor --- mariadb/Dockerfile | 9 +++++++-- mariadb/docker/etc/services.d/.s6-svscan/finish | 3 +++ mariadb/docker/etc/services.d/mariadb/run | 5 +++++ 3 files changed, 15 insertions(+), 2 deletions(-) create mode 100755 mariadb/docker/etc/services.d/.s6-svscan/finish create mode 100755 mariadb/docker/etc/services.d/mariadb/run 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