Skip to content

Commit

Permalink
Only change log-error setting if /etc/my.cnf is not a mount
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ltangvald committed Sep 4, 2017
1 parent 2807d4b commit 79499c1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion changelog
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ Changes in 1.1.1 (not released)
but should be done for all client commands, or group replication will fail
* Add flag for logging to console (#87458)
Setting -e MYSQL_LOG_CONSOLE=true will make the server log to console, so the
server log is available through Docker's log interface.
server log is available through Docker's log interface. If /etc/my.cnf is
mounted from the host system, this has no effect.
* Ensure both MYSQL_USER and MYSQL_PASSWORD are set (#86982)
Before, setting only one would cause the option to be silently ignored.
* Read password file first and throw error if it is empty (#87025)
Expand Down
5 changes: 4 additions & 1 deletion template/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ if [ "$1" = 'mysqld' ]; then
SOCKET="$(_get_config 'socket' "$@")"

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

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

0 comments on commit 79499c1

Please sign in to comment.