Compose service starts before the service it depends on is ready

The service project-backend-api-1 did not start (unhealthy), so the application was not started either. It printed: The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 734, in lifespan async with self.lifespan_context(app) as maybe_state: File "/usr/local/lib/python3.10/contextlib.py", line 199, in __aenter__… The full output is in the deploy log.

Seen1 times
WhereDocker Compose

Why it happens

The repository's compose file lets a service start as soon as its dependency's container exists, not when it is healthy. The service calls the dependency during boot, finds nothing listening yet, and exits.

What the log looks like

Deploy log
error: service project-backend-api-1 did not start (unhealthy): The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 734, in lifespan async with self.lifespan_context(app) as maybe_state: File "/usr/local/lib/python3.10/contextlib.py", line 199, in __aenter__ return await anext(self.gen)Container project-backend-api-1 Error dependency backend-api failed to startContainer project-backend-web-1 Error dependency backend-web failed to startdependency failed to start: cont…

Try PanelAlpha Engine yourself.

The easiest way to turn your server into a safe, controlled environment for your AI agent. Deploy, manage and maintain any project from Claude Code, Cursor, Codex or any other MCP client. Open source under Apache 2.0, free to run.

Requires Ubuntu 24.04 or 26.04 · 2 GB RAM · 1 CPURead the documentation