Skip to content

Commit 79499c1

Browse files
committed
Only change log-error setting if /etc/my.cnf is not a mount
If the file is mounted the command to comment out the setting can fail, causing container failure. Also, we do not wish to override user customizations.
1 parent 2807d4b commit 79499c1

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

changelog

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ Changes in 1.1.1 (not released)
44
but should be done for all client commands, or group replication will fail
55
* Add flag for logging to console (#87458)
66
Setting -e MYSQL_LOG_CONSOLE=true will make the server log to console, so the
7-
server log is available through Docker's log interface.
7+
server log is available through Docker's log interface. If /etc/my.cnf is
8+
mounted from the host system, this has no effect.
89
* Ensure both MYSQL_USER and MYSQL_PASSWORD are set (#86982)
910
Before, setting only one would cause the option to be silently ignored.
1011
* Read password file first and throw error if it is empty (#87025)

template/docker-entrypoint.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,10 @@ if [ "$1" = 'mysqld' ]; then
4747
SOCKET="$(_get_config 'socket' "$@")"
4848

4949
if [ -n "$MYSQL_LOG_CONSOLE" ] || [ -n "%%DEFAULT_LOG%%" ]; then
50-
sed -i 's/^log-error=/#&/' /etc/my.cnf
50+
# Don't touch bind-mounted config files
51+
if ! cat /proc/1/mounts | grep "etc/my.cnf"; then
52+
sed -i 's/^log-error=/#&/' /etc/my.cnf
53+
fi
5154
fi
5255

5356
if [ ! -d "$DATADIR/mysql" ]; then

0 commit comments

Comments
 (0)