Skip to content
Wade Womersley

wade.one

wade womersley – york based software engineer

  • Home
  • 2026
  • October
  • 16
  • Docker Compose Start Order Is Not Database Readiness

Docker Compose Start Order Is Not Database Readiness

Posted on October 16, 2026 By
Programming

Starting the database container before the application container sounds like it should solve startup failures. It only solves part of the problem. The database process can exist before it is ready to accept connections, so an application can still race ahead and fail during an otherwise normal startup.

Docker’s Compose startup-order documentation makes the distinction explicit. A dependency with the service_healthy condition waits for a declared health check to pass. That is more useful than assuming a fixed delay will happen to be long enough on every machine.

I would make the check test the capability the dependent service actually needs. An open socket is not always enough, and a check that relies on unrelated external services can make local startup unnecessarily fragile. Keep it specific, bounded and understandable. Then make the application’s own connection handling sensible, because databases can restart after the initial startup too.

Adding “sleep 30” may hide the issue on your laptop, but it leaves the timing guess in place. A small readiness check expresses what you are waiting for. That is easier to debug, usually quicker when things are healthy, and much less annoying when a slow machine exposes the original assumption.

Share:

  • Share on Facebook (Opens in new window) Facebook
  • Share on X (Opens in new window) X
  • Share on Tumblr (Opens in new window) Tumblr
  • Share on Pinterest (Opens in new window) Pinterest
  • Share on LinkedIn (Opens in new window) LinkedIn
  • Share on Reddit (Opens in new window) Reddit

Related

Comments

comments

Tags: compose docker healthchecks

Post navigation

❮ Previous Post: Read the PostgreSQL Query Plan Before Adding Another Index

You may also like

Programming
C# 14 Extension Members Should Reduce Helper Class Noise
May 19, 2026
Programming
Jetpack Compose 1.11 Testing Changes Deserve Attention
June 10, 2026
Programming
MySQL and Binary(16) – The Reasons/Benefits/Drawbacks (#mysql)
January 31, 2010
News
Windows 10 coming to Raspberry Pi 2 – free!
February 2, 2015
  • AI
  • artificial intelligence
  • Ego-centric
  • Events
  • Films
  • Food
  • Gaming
  • Gym
  • Hardware
  • Holidays
  • News
  • PHP
  • Programming
  • Random Stuff
  • Reviews
  • Science
  • SEO
  • Software
  • Software Engineer
  • Support
  • Uncategorized
  • Work

Copyright © 2026 wade.one.

Theme: Oceanly News Dark by ScriptsTown