containers / containers/podman-compose
depends_on wrong starting order
- Dominant language
- Python
- Stars
- 6.2k
- Forks
- 622
- PR merge metrics
- No merged PRs in 30d
Description
I've noticed that the following `compose.yml` configuration starts the **django service** before the **db service**, even though it should be the other way around. The `depends_on` configuration does not seem to affect the start order.
```yaml
version: '3.7'
services: # both services run on the same network
db:
container_name: postgres
image: docker.io/library/postgres:15.3
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres_db
ports:
- 5432:5432
volumes:
- ./init.sql:/docker-entrypoint-initdb.d/init.sql
django:
container_name: django
build:
context: .
dockerfile: Containerfile.django
depends_on:
- "db"
ports:
- "8000:8000"
```
This results in the error `could not translate host name "db" to address: Name or service not known` because the **db service** is not up and running at the time when the **django service** is trying to communicate.
Contributor guide
Assessment
This issue has not been assessed yet.