@@ -17,14 +17,7 @@ FROM oraclelinux:{{ .oracle.variant }}
1717
1818RUN set -eux; \
1919 groupadd --system --gid 999 mysql; \
20- useradd --system --uid 999 --gid 999 --home-dir /var/lib/mysql --no-create-home mysql; \
21- \
22- mkdir /var/lib/mysql /var/run/mysqld; \
23- chown mysql:mysql /var/lib/mysql /var/run/mysqld; \
24- # ensure that /var/run/mysqld (used for socket and lock files) is writable regardless of the UID our mysqld instance ends up having at runtime
25- chmod 1777 /var/lib/mysql /var/run/mysqld; \
26- \
27- mkdir /docker-entrypoint-initdb.d
20+ useradd --system --uid 999 --gid 999 --home-dir /var/lib/mysql --no-create-home mysql
2821
2922# add gosu for easy step-down from root
3023# https://github.com/tianon/gosu/releases
@@ -108,7 +101,21 @@ RUN set -eux; \
108101# 5.7 Debian-based images also included "/etc/mysql/mysql.conf.d" so let's include it too
109102 { echo '!includedir /etc/mysql/mysql.conf.d/'; } >> /etc/my.cnf; \
110103 mkdir -p /etc/mysql/mysql.conf.d; \
104+ \
105+ # comment out a few problematic configuration values
106+ find /etc/my.cnf /etc/mysql/ -name '*.cnf' -print0 \
107+ | xargs -0 grep -lZE '^(bind-address|log)' \
108+ | xargs -rt -0 sed -Ei 's/^(bind-address|log)/#&/'; \
109+ \
111110{{ ) else "" end -}}
111+ # ensure these directories exist and have useful permissions
112+ # the rpm package has different opinions on the mode of `/var/run/mysqld`, so this needs to be after install
113+ mkdir -p /var/lib/mysql /var/run/mysqld; \
114+ chown mysql:mysql /var/lib/mysql /var/run/mysqld; \
115+ # ensure that /var/run/mysqld (used for socket and lock files) is writable regardless of the UID our mysqld instance ends up having at runtime
116+ chmod 1777 /var/lib/mysql /var/run/mysqld; \
117+ \
118+ mkdir /docker-entrypoint-initdb.d; \
112119 \
113120 mysqld --version; \
114121 mysql --version
0 commit comments