-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
Combining issues and PRs about increasing the timeout into one so we can discuss the best solution.
I think it makes sense to have a configurable timeout for the local-only server (and maybe even a "never timeout" option like -1
). We'll need to ensure that the documentation is clear that this just applies to waiting for the temporary server to be ready and does not apply to the overall time taken by initdb stuff (like the user/db/password, tzinfo, and initdb.d
scripts). Maybe something like MYSQL_TEMP_SERVER_WAIT_TIMEOUT
?
Note: the timeout would not apply to 8.0+
since it has --daemonize
that just takes care of it (only returns when the server is ready for connections).
mysql/.template.Debian/docker-entrypoint.sh
Lines 89 to 115 in d284e15
docker_temp_server_start() { | |
if [ "${MYSQL_MAJOR}" = '5.6' ] || [ "${MYSQL_MAJOR}" = '5.7' ]; then | |
"$@" --skip-networking --socket="${SOCKET}" & | |
mysql_note "Waiting for server startup" | |
local i | |
for i in {30..0}; do | |
# only use the root password if the database has already been initializaed | |
# so that it won't try to fill in a password file when it hasn't been set yet | |
extraArgs=() | |
if [ -z "$DATABASE_ALREADY_EXISTS" ]; then | |
extraArgs+=( '--dont-use-mysql-root-password' ) | |
fi | |
if docker_process_sql "${extraArgs[@]}" --database=mysql <<<'SELECT 1' &> /dev/null; then | |
break | |
fi | |
sleep 1 | |
done | |
if [ "$i" = 0 ]; then | |
mysql_error "Unable to start server." | |
fi | |
else | |
# For 5.7+ the server is ready for use as soon as startup command unblocks | |
if ! "$@" --daemonize --skip-networking --socket="${SOCKET}"; then | |
mysql_error "Unable to start server." | |
fi | |
fi | |
} |
Related issues: MariaDB/mariadb-docker#260, MariaDB/mariadb-docker#272, #159, #288