I dockerize my django backend app. I am using posgresql as db. After doing docker-compose up the last logs are:
db_1 | 2021-12-21 18:39:58.213 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
db_1 | 2021-12-21 18:39:58.213 UTC [1] LOG: listening on IPv6 address "::", port 5432
db_1 | 2021-12-21 18:39:58.310 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
db_1 | 2021-12-21 18:39:58.476 UTC [42] LOG: database system was shut down at 2021-12-21 18:39:58 UTC
db_1 | 2021-12-21 18:39:58.678 UTC [1] LOG: database system is ready to accept connections
I am not getting any other logs after them,I don't know what the issue is maybe its due to postgresql. But django server is not starting. I did docker ps I got following results
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
d92379ca89b7 prodlerbackend_prodler "python manage.py ru…" 20 minutes ago Up 20 minutes 0.0.0.0:8000->8000/tcp, :::8000->8000/tcp prodlerbackend_prodler_1
3364c1cda344 postgres:11.2-alpine "docker-entrypoint.s…" 20 minutes ago Up 20 minutes 0.0.0.0:5432->5432/tcp, :::5432->5432/tcp prodlerbackend_db_1
I think the containers are up, still Django server is not started what can be the issue?
docker-compose.yml
version: "3.9"
services:
db:
image: postgres:11.2-alpine
volumes:
- ./postgres-data:/var/lib/postgresql/data
environment:
- HOST=localhost
- POSTGRES_DB=prodler
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=admin123
ports:
- 5432:5432
prodler:
build:
context: .
dockerfile: Dockerfile
command: python manage.py runserver 0.0.0.0:8000
volumes:
- .:/code
ports:
- "8000:8000"
depends_on:
- db