From f19a436b030e556119750d40431d27b96c30badd Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Fri, 29 Dec 2017 10:34:31 -0800 Subject: [PATCH] Point to a couple Official Images "wait-for-db" examples --- mysql/content.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mysql/content.md b/mysql/content.md index 63f8bd061..886def621 100644 --- a/mysql/content.md +++ b/mysql/content.md @@ -168,6 +168,8 @@ $ chcon -Rt svirt_sandbox_file_t /my/own/datadir If there is no database initialized when the container starts, then a default database will be created. While this is the expected behavior, this means that it will not accept incoming connections until such initialization completes. This may cause issues when using automation tools, such as `docker-compose`, which start several containers simultaneously. +If the application you're trying to connect to MySQL does not handle MySQL downtime or waiting for MySQL to start gracefully, then a putting a connect-retry loop before the service starts might be necessary. For an example of such an implementation in the official images, see [WordPress](https://github.com/docker-library/wordpress/blob/1b48b4bccd7adb0f7ea1431c7b470a40e186f3da/docker-entrypoint.sh#L195-L235) or [Bonita](https://github.com/docker-library/docs/blob/9660a0cccb87d8db842f33bc0578d769caaf3ba9/bonita/stack.yml#L28-L44). + ## Usage against an existing database If you start your `%%IMAGE%%` container instance with a data directory that already contains a database (specifically, a `mysql` subdirectory), the `$MYSQL_ROOT_PASSWORD` variable should be omitted from the run command line; it will in any case be ignored, and the pre-existing database will not be changed in any way.