Skip to content
This repository has been archived by the owner on Mar 27, 2023. It is now read-only.

docker-compose up fails when the database container is not (yet) started #526

Open
maltezacharias opened this issue May 24, 2020 · 0 comments
Assignees
Labels
bug Something isn't working contribution Issues opened from outside contributors :)

Comments

@maltezacharias
Copy link
Collaborator

Describe the bug
When db container is not running the main app container will stop

To Reproduce
Steps to reproduce the behavior:

  1. Introduce a config change that will cause the database to fail to come up
  2. run docker-compose up or deploy.sh
Error 
 django.db.utils.OperationalError: could not translate host name "database" to address: Name or service not known

Expected behavior
the main app container should wait for the database to become available:

The problem of waiting for a database (for example) to be ready is really just a subset of a much larger problem of distributed systems. In production, your database could become unavailable or move hosts at any time. Your application needs to be resilient to these types of failures.

(Docs on https://docs.docker.com/compose/startup-order/)

Additional context
The script should indicate clearly that it's waiting for the database to come up. In Build environments it should probably timeout after a while?

@maltezacharias maltezacharias added bug Something isn't working contribution Issues opened from outside contributors :) labels May 24, 2020
@maltezacharias maltezacharias self-assigned this May 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working contribution Issues opened from outside contributors :)
Projects
None yet
Development

No branches or pull requests

1 participant