A container with a health check every 30 seconds can sit in “starting” for half a minute after it is ready. Anything that waits for it to be healthy waits too. Docker has an option just for the startup phase.
HEALTHCHECK --interval=30s --start-period=60s --start-interval=5s \
CMD curl -fs http://localhost:8080/health || exit 1
--start-period is a grace period after the container starts. Failed checks during that time do not count towards the retries, so a slow app is not marked unhealthy while it is still booting. --start-interval is the time between checks during that start period. So here Docker checks every 5 seconds for the first minute, and then every 30 seconds.
The docs add one more detail I like: if a check succeeds during the start period, the container counts as started, and from then on the normal interval applies.
The defaults, for reference: interval 30s, timeout 30s, start period 0s, start interval 5s, retries 3.
Caveat: --start-interval needs Docker Engine 25.0 or later, according to the Dockerfile reference. On an older engine, check your version with docker version before you rely on it. Also keep the check itself light. A health check that runs every 5 seconds should not be a heavy database query.
Further reading: Dockerfile reference: HEALTHCHECK