{"id":1435,"date":"2026-10-16T18:00:00","date_gmt":"2026-10-16T17:00:00","guid":{"rendered":"https:\/\/wade.one\/blog\/?p=1435"},"modified":"2026-10-16T18:00:00","modified_gmt":"2026-10-16T17:00:00","slug":"docker-compose-start-order-is-not-database-readiness","status":"publish","type":"post","link":"https:\/\/wade.one\/blog\/2026\/10\/16\/docker-compose-start-order-is-not-database-readiness\/","title":{"rendered":"Docker Compose Start Order Is Not Database Readiness"},"content":{"rendered":"<p>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.<\/p>\n<p>Docker&#8217;s <a href=\"https:\/\/docs.docker.com\/compose\/how-tos\/startup-order\/\">Compose startup-order documentation<\/a> 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.<\/p>\n<p>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&#8217;s own connection handling sensible, because databases can restart after the initial startup too.<\/p>\n<p>Adding &#8220;sleep 30&#8221; 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.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Starting the database container before the application container sounds like it should solve startup failures.<\/p>\n","protected":false},"author":0,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[13],"tags":[260,126,261],"class_list":["post-1435","post","type-post","status-publish","format-standard","hentry","category-programming","tag-compose","tag-docker","tag-healthchecks"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Docker Compose Start Order Is Not Database Readiness - wade.one<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/wade.one\/blog\/2026\/10\/16\/docker-compose-start-order-is-not-database-readiness\/\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Docker Compose Start Order Is Not Database Readiness - wade.one\" \/>\n<meta property=\"og:description\" content=\"Starting the database container before the application container sounds like it should solve startup failures.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/wade.one\/blog\/2026\/10\/16\/docker-compose-start-order-is-not-database-readiness\/\" \/>\n<meta property=\"og:site_name\" content=\"wade.one\" \/>\n<meta property=\"article:published_time\" content=\"2026-10-16T17:00:00+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/wade.one\/blog\/wp-content\/uploads\/2015\/02\/Wade-Logo-cropped.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1518\" \/>\n\t<meta property=\"og:image:height\" content=\"1506\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@wadewomersley\" \/>\n<meta name=\"twitter:site\" content=\"@wadewomersley\" \/>\n<meta name=\"twitter:label1\" content=\"Estimated reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/wade.one\\\/blog\\\/2026\\\/10\\\/16\\\/docker-compose-start-order-is-not-database-readiness\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/wade.one\\\/blog\\\/2026\\\/10\\\/16\\\/docker-compose-start-order-is-not-database-readiness\\\/\"},\"author\":{\"name\":\"\",\"@id\":\"\"},\"headline\":\"Docker Compose Start Order Is Not Database Readiness\",\"datePublished\":\"2026-10-16T17:00:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/wade.one\\\/blog\\\/2026\\\/10\\\/16\\\/docker-compose-start-order-is-not-database-readiness\\\/\"},\"wordCount\":207,\"publisher\":{\"@id\":\"https:\\\/\\\/wade.one\\\/blog\\\/#\\\/schema\\\/person\\\/8b4739f8f8bb2cff5d792d4b8779fcc3\"},\"keywords\":[\"compose\",\"docker\",\"healthchecks\"],\"articleSection\":[\"Programming\"],\"inLanguage\":\"en-GB\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/wade.one\\\/blog\\\/2026\\\/10\\\/16\\\/docker-compose-start-order-is-not-database-readiness\\\/\",\"url\":\"https:\\\/\\\/wade.one\\\/blog\\\/2026\\\/10\\\/16\\\/docker-compose-start-order-is-not-database-readiness\\\/\",\"name\":\"Docker Compose Start Order Is Not Database Readiness - wade.one\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/wade.one\\\/blog\\\/#website\"},\"datePublished\":\"2026-10-16T17:00:00+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/wade.one\\\/blog\\\/2026\\\/10\\\/16\\\/docker-compose-start-order-is-not-database-readiness\\\/#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/wade.one\\\/blog\\\/2026\\\/10\\\/16\\\/docker-compose-start-order-is-not-database-readiness\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/wade.one\\\/blog\\\/2026\\\/10\\\/16\\\/docker-compose-start-order-is-not-database-readiness\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/wade.one\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Docker Compose Start Order Is Not Database Readiness\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/wade.one\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/wade.one\\\/blog\\\/\",\"name\":\"wade.one\",\"description\":\"wade womersley - york based software engineer\",\"publisher\":{\"@id\":\"https:\\\/\\\/wade.one\\\/blog\\\/#\\\/schema\\\/person\\\/8b4739f8f8bb2cff5d792d4b8779fcc3\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/wade.one\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-GB\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/wade.one\\\/blog\\\/#\\\/schema\\\/person\\\/8b4739f8f8bb2cff5d792d4b8779fcc3\",\"name\":\"Wade Womersley\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\\\/\\\/wade.one\\\/blog\\\/wp-content\\\/uploads\\\/2015\\\/02\\\/200px.png\",\"url\":\"https:\\\/\\\/wade.one\\\/blog\\\/wp-content\\\/uploads\\\/2015\\\/02\\\/200px.png\",\"contentUrl\":\"https:\\\/\\\/wade.one\\\/blog\\\/wp-content\\\/uploads\\\/2015\\\/02\\\/200px.png\",\"width\":202,\"height\":200,\"caption\":\"Wade Womersley\"},\"logo\":{\"@id\":\"https:\\\/\\\/wade.one\\\/blog\\\/wp-content\\\/uploads\\\/2015\\\/02\\\/200px.png\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Docker Compose Start Order Is Not Database Readiness - wade.one","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/wade.one\/blog\/2026\/10\/16\/docker-compose-start-order-is-not-database-readiness\/","og_locale":"en_GB","og_type":"article","og_title":"Docker Compose Start Order Is Not Database Readiness - wade.one","og_description":"Starting the database container before the application container sounds like it should solve startup failures.","og_url":"https:\/\/wade.one\/blog\/2026\/10\/16\/docker-compose-start-order-is-not-database-readiness\/","og_site_name":"wade.one","article_published_time":"2026-10-16T17:00:00+00:00","og_image":[{"width":1518,"height":1506,"url":"https:\/\/wade.one\/blog\/wp-content\/uploads\/2015\/02\/Wade-Logo-cropped.png","type":"image\/png"}],"twitter_card":"summary_large_image","twitter_creator":"@wadewomersley","twitter_site":"@wadewomersley","twitter_misc":{"Estimated reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/wade.one\/blog\/2026\/10\/16\/docker-compose-start-order-is-not-database-readiness\/#article","isPartOf":{"@id":"https:\/\/wade.one\/blog\/2026\/10\/16\/docker-compose-start-order-is-not-database-readiness\/"},"author":{"name":"","@id":""},"headline":"Docker Compose Start Order Is Not Database Readiness","datePublished":"2026-10-16T17:00:00+00:00","mainEntityOfPage":{"@id":"https:\/\/wade.one\/blog\/2026\/10\/16\/docker-compose-start-order-is-not-database-readiness\/"},"wordCount":207,"publisher":{"@id":"https:\/\/wade.one\/blog\/#\/schema\/person\/8b4739f8f8bb2cff5d792d4b8779fcc3"},"keywords":["compose","docker","healthchecks"],"articleSection":["Programming"],"inLanguage":"en-GB"},{"@type":"WebPage","@id":"https:\/\/wade.one\/blog\/2026\/10\/16\/docker-compose-start-order-is-not-database-readiness\/","url":"https:\/\/wade.one\/blog\/2026\/10\/16\/docker-compose-start-order-is-not-database-readiness\/","name":"Docker Compose Start Order Is Not Database Readiness - wade.one","isPartOf":{"@id":"https:\/\/wade.one\/blog\/#website"},"datePublished":"2026-10-16T17:00:00+00:00","breadcrumb":{"@id":"https:\/\/wade.one\/blog\/2026\/10\/16\/docker-compose-start-order-is-not-database-readiness\/#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/wade.one\/blog\/2026\/10\/16\/docker-compose-start-order-is-not-database-readiness\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/wade.one\/blog\/2026\/10\/16\/docker-compose-start-order-is-not-database-readiness\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/wade.one\/blog\/"},{"@type":"ListItem","position":2,"name":"Docker Compose Start Order Is Not Database Readiness"}]},{"@type":"WebSite","@id":"https:\/\/wade.one\/blog\/#website","url":"https:\/\/wade.one\/blog\/","name":"wade.one","description":"wade womersley - york based software engineer","publisher":{"@id":"https:\/\/wade.one\/blog\/#\/schema\/person\/8b4739f8f8bb2cff5d792d4b8779fcc3"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/wade.one\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-GB"},{"@type":["Person","Organization"],"@id":"https:\/\/wade.one\/blog\/#\/schema\/person\/8b4739f8f8bb2cff5d792d4b8779fcc3","name":"Wade Womersley","image":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/wade.one\/blog\/wp-content\/uploads\/2015\/02\/200px.png","url":"https:\/\/wade.one\/blog\/wp-content\/uploads\/2015\/02\/200px.png","contentUrl":"https:\/\/wade.one\/blog\/wp-content\/uploads\/2015\/02\/200px.png","width":202,"height":200,"caption":"Wade Womersley"},"logo":{"@id":"https:\/\/wade.one\/blog\/wp-content\/uploads\/2015\/02\/200px.png"}}]}},"jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":1247,"url":"https:\/\/wade.one\/blog\/2026\/05\/01\/docker-mcp-shows-why-agent-tools-need-boring-infrastructure\/","url_meta":{"origin":1435,"position":0},"title":"Docker MCP Shows Why Agent Tools Need Boring Infrastructure","author":"","date":"May 1, 2026","format":false,"excerpt":"The more agents use real tools, the more they need boring infrastructure: isolation, versioning, profiles, credentials, and repeatable setup.","rel":"","context":"In &quot;AI&quot;","block_context":{"text":"AI","link":"https:\/\/wade.one\/blog\/category\/ai\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1181,"url":"https:\/\/wade.one\/blog\/2026\/04\/13\/what-i-check-before-i-trust-a-mobile-release\/","url_meta":{"origin":1435,"position":1},"title":"What I Check Before I Trust a Mobile Release","author":"","date":"April 13, 2026","format":false,"excerpt":"A mobile release can look fine in the app store and still be a bad idea. I usually trust it only after I have checked crash risk, permissions, API compatibility, startup behavior, rollout safety, and what happens after the update lands.","rel":"","context":"In &quot;Programming&quot;","block_context":{"text":"Programming","link":"https:\/\/wade.one\/blog\/category\/programming\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1343,"url":"https:\/\/wade.one\/blog\/2026\/06\/10\/jetpack-compose-1-11-testing-changes-deserve-attention\/","url_meta":{"origin":1435,"position":2},"title":"Jetpack Compose 1.11 Testing Changes Deserve Attention","author":"Wade","date":"June 10, 2026","format":false,"excerpt":"Jetpack Compose 1.11's testing changes are worth planning for because timing assumptions can quietly break mobile test suites.","rel":"","context":"In &quot;Programming&quot;","block_context":{"text":"Programming","link":"https:\/\/wade.one\/blog\/category\/programming\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1115,"url":"https:\/\/wade.one\/blog\/2023\/03\/26\/mongodb-vs-documentdb\/","url_meta":{"origin":1435,"position":3},"title":"MongoDB vs DocumentDB","author":"Wade","date":"March 26, 2023","format":false,"excerpt":"I've been working on a new as-fast-as-possible platform for a specific situation I can't go in to right now but I wanted to use MongoDB, however, I needed to reduce costs and use AWS so I wanted to use DocumentDB and needed to compare. Sadly DocumentDB does not cover 100%\u2026","rel":"","context":"In &quot;Programming&quot;","block_context":{"text":"Programming","link":"https:\/\/wade.one\/blog\/category\/programming\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1431,"url":"https:\/\/wade.one\/blog\/2026\/10\/12\/postgresql-14-support-ends-in-november-plan-the-upgrade-now\/","url_meta":{"origin":1435,"position":4},"title":"PostgreSQL 14 Support Ends in November: Plan the Upgrade Now","author":"Wade","date":"October 12, 2026","format":false,"excerpt":"PostgreSQL 14 reaches the end of community support on 12 November 2026.","rel":"","context":"In &quot;Programming&quot;","block_context":{"text":"Programming","link":"https:\/\/wade.one\/blog\/category\/programming\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1118,"url":"https:\/\/wade.one\/blog\/2023\/03\/26\/expanding-on-performance-of-redis-vs-mongodb-for-a-push-pull-system\/","url_meta":{"origin":1435,"position":5},"title":"Expanding on performance of Redis vs MongoDB for a push\/pull system","author":"Wade","date":"March 26, 2023","format":false,"excerpt":"When it comes to building a push\/pop system, both Redis and MongoDB can be used as effective solutions. However, there are a few key differences between these two databases that can impact which one you choose for your system. Redis is an in-memory data structure store that can be used\u2026","rel":"","context":"In &quot;PHP&quot;","block_context":{"text":"PHP","link":"https:\/\/wade.one\/blog\/category\/php\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/wade.one\/blog\/wp-json\/wp\/v2\/posts\/1435","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wade.one\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wade.one\/blog\/wp-json\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/wade.one\/blog\/wp-json\/wp\/v2\/comments?post=1435"}],"version-history":[{"count":1,"href":"https:\/\/wade.one\/blog\/wp-json\/wp\/v2\/posts\/1435\/revisions"}],"predecessor-version":[{"id":1456,"href":"https:\/\/wade.one\/blog\/wp-json\/wp\/v2\/posts\/1435\/revisions\/1456"}],"wp:attachment":[{"href":"https:\/\/wade.one\/blog\/wp-json\/wp\/v2\/media?parent=1435"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wade.one\/blog\/wp-json\/wp\/v2\/categories?post=1435"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wade.one\/blog\/wp-json\/wp\/v2\/tags?post=1435"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}