Skip to content

Correct health check for MySQL 5.7 to prevent connecting to temporary server #930

@scspijker

Description

@scspijker

The MySQL 5.7 image we use (a3d35804fa37) always starts a temporary server, then shutting it down, then starting the real server. We create a completely clean MySQL instance for our systemwide test and this temporary server creates intermittent failures.

We have startup/setup scripts that wait for the MySQL docker instance to be "healthy". The problem is they seem to connect to the "temporary server" which then immediately shuts down.

Is there a health check or another way for our scripts to wait on the real server?

I've already tried the following docker-compose.yml test checks, without success:

  test: ["CMD", "mysqladmin", "ping", "-h", "127.0.0.1", "--silent"]
  test: ["CMD", "mysqladmin", "ping", "--protocol tcp", "-h", "127.0.0.1", "--silent"]
  test: "/usr/bin/mysql --user=root --execute \"SHOW DATABASES;\""

I'd like to not have to write retry logic in our setup scripts and/or have to implement a sleep 😅

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions