Skip to content

Commit 9358323

Browse files
authored
Merge pull request #336 from infosiftr/comment-cnf
MySQL system provided cnf's keep moving, ensure that any system provided cnf does not set bind-address or log
2 parents d8e7c8b + 883703d commit 9358323

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

5.6/Dockerfile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,12 @@ RUN { \
5252
&& rm -rf /var/lib/mysql && mkdir -p /var/lib/mysql /var/run/mysqld \
5353
&& chown -R mysql:mysql /var/lib/mysql /var/run/mysqld \
5454
# 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
55-
&& chmod 777 /var/run/mysqld
56-
55+
&& chmod 777 /var/run/mysqld \
5756
# comment out a few problematic configuration values
57+
&& find /etc/mysql/ -name '*.cnf' -print0 \
58+
| xargs -0 grep -lZE '^(bind-address|log)' \
59+
| xargs -rt -0 sed -Ei 's/^(bind-address|log)/#&/' \
5860
# don't reverse lookup hostnames, they are usually another container
59-
RUN sed -Ei 's/^(bind-address|log)/#&/' /etc/mysql/my.cnf \
6061
&& echo '[mysqld]\nskip-host-cache\nskip-name-resolve' > /etc/mysql/conf.d/docker.cnf
6162

6263
VOLUME /var/lib/mysql

5.7/Dockerfile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,12 @@ RUN { \
5858
&& rm -rf /var/lib/mysql && mkdir -p /var/lib/mysql /var/run/mysqld \
5959
&& chown -R mysql:mysql /var/lib/mysql /var/run/mysqld \
6060
# 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
61-
&& chmod 777 /var/run/mysqld
62-
61+
&& chmod 777 /var/run/mysqld \
6362
# comment out a few problematic configuration values
63+
&& find /etc/mysql/ -name '*.cnf' -print0 \
64+
| xargs -0 grep -lZE '^(bind-address|log)' \
65+
| xargs -rt -0 sed -Ei 's/^(bind-address|log)/#&/' \
6466
# don't reverse lookup hostnames, they are usually another container
65-
RUN sed -Ei 's/^(bind-address|log)/#&/' /etc/mysql/mysql.conf.d/mysqld.cnf \
6667
&& echo '[mysqld]\nskip-host-cache\nskip-name-resolve' > /etc/mysql/conf.d/docker.cnf
6768

6869
VOLUME /var/lib/mysql

0 commit comments

Comments
 (0)