Сброс соединения Django Postgres в Docker

У меня есть приложение Django и БД Postgres, работающие в двух отдельных контейнерах. Соединение DB из Django продолжает устанавливаться всякий раз, когда я запускаю контейнеры. Я пробовал перезапускать Django, но получаю тот же результат. Я могу зайти в psql из контейнера Django и просмотреть таблицы.

Ошибка

Docker Compose

  web:
    build: .
    ports:
      - "8000:80"
    depends_on:
      - db
      - rasa_server
      - rasa_actions_server
      - redis
    extra_hosts:
      - "host.docker.internal:host-gateway" # for docker.host.internal to work on Linus
    volumes:
      - type: bind
        source: .
        target: /code
    command: [ "python", "manage.py", "runserver" ,"0.0.0.0:8000" ]
  ...
  db:
    build: ./databasedata/
    ports:
      - "8003:5432"
    volumes:
      - type: volume
        source: db
        target: /var/lib/postgresql/data
volumes:
  db:
  redis:

Psql root@ddf41bff0bb4:/code# psql -h host.docker.internal -p 8003 -U postgres

Том докера (DB)

docker volume inspect ava_db
[
    {
        "CreatedAt": "2021-09-26T03:14:56-04:00",
        "Driver": "local",
        "Labels": {
            "com.docker.compose.project": "ava",
            "com.docker.compose.version": "1.25.0",
            "com.docker.compose.volume": "db"
        },
        "Mountpoint": "/var/lib/docker/volumes/ava_db/_data",
        "Name": "ava_db",
        "Options": null,
        "Scope": "local"
    }
]

Журналы контейнера Postgres

...
pg_restore: creating FK CONSTRAINT "public.newweb_product_tags newweb_product_tags_tag_id_f6ff674f_fk_newweb_tag_id"
pg_restore: creating ACL "SCHEMA public"

2021-09-26 15:33:42.510 UTC [49] LOG:  received fast shutdown request
waiting for server to shut down....2021-09-26 15:33:42.512 UTC [49] LOG:  aborting any active transactions
2021-09-26 15:33:42.513 UTC [49] LOG:  background worker "logical replication launcher" (PID 56) exited with exit code 1
2021-09-26 15:33:42.514 UTC [51] LOG:  shutting down
2021-09-26 15:33:42.551 UTC [49] LOG:  database system is shut down
 done
server stopped

PostgreSQL init process complete; ready for start up.

2021-09-26 15:33:42.652 UTC [1] LOG:  starting PostgreSQL 13.4 (Debian 13.4-1.pgdg100+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit
2021-09-26 15:33:42.653 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
2021-09-26 15:33:42.653 UTC [1] LOG:  listening on IPv6 address "::", port 5432
2021-09-26 15:33:42.658 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2021-09-26 15:33:42.666 UTC [80] LOG:  database system was shut down at 2021-09-26 15:33:42 UTC
2021-09-26 15:33:42.672 UTC [1] LOG:  database system is ready to accept connections
Вернуться на верх