Healthchecks with a start period, or a slow boot is an incident

A database that takes forty seconds to initialise is marked unhealthy during every normal start, which trains everyone to ignore health status.

healthcheck:
  test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
  interval: 10s
  timeout: 5s
  retries: 5
  start_period: 40s        # failures before this do not count

start_period is the flag that makes a healthcheck usable on anything with a real boot sequence, and it is missing from most copied configurations. The check runs inside the container, so it needs whatever it calls to be installed — adding curl purely for a healthcheck is a common and slightly annoying reason for an image to grow. A compose-level healthcheck overrides the image’s, which is useful when a stack needs a stricter one than the image author chose.