Search code examples
mysqldockerpercona

Why does mysqld shutdown before starting in the official Percona docker image for 5.6 and 5.7


I noticed this because of the question I asked here. With a plain

docker run percona:5.6

or

docker run percona:5.7

the logs show that mysqld shuts down before starting up again for good. There are no errors:

2020-08-02T00:17:56.392322Z 0 [Note] mysqld: ready for connections.
Version: '5.7.30-33'  socket: '/var/lib/mysql/mysql.sock'  port: 0  Percona Server (GPL), Release 33, Revision 6517692
mysql: [Warning] Using a password on the command line interface can be insecure.
Warning: Unable to load '/usr/share/zoneinfo/iso3166.tab' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/leapseconds' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/tzdata.zi' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/zone.tab' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/zone1970.tab' as time zone. Skipping it.
mysql: [Warning] Using a password on the command line interface can be insecure.

2020-08-02T00:17:59.781414Z 0 [Note] Giving 0 client threads a chance to die gracefully
2020-08-02T00:17:59.781467Z 0 [Note] Shutting down slave threads
...
2020-08-02T00:18:02.031635Z 0 [Note] mysqld: Shutdown complete

This behavior is consistent across runs, and across Mac and Ubuntu. Is there anything I can do to prevent this? And what would be a good way to check whether it's up for good? It seems like there might not be one, besides just waiting. It doesn't happen on 8.0.


Solution

  • The first run of mysqld is an initialization of the data directory in a bootstrap mode.

    The second run is mysqld starting as a service will all the authentication and initialization that the boostrap provided.

    Percona dockerhub reference (under: "No connections until MySQL init complete" header) indicates that when a connection is available its ready to start.

    The source code for the entry point is at this github url.