docker-library / postgres

Docker Official Image packaging for Postgres
http://www.postgresql.org
MIT License
2.14k stars 1.11k forks source link

Database gets corrupted after running for a while #1133

Closed kyesil closed 7 months ago

kyesil commented 9 months ago

I have basic docker compose file. It work 1-2 day after i see my app can't connect to db.

pgdb:
    image: postgres:15
    environment:
      - POSTGRES_DB=app
      - POSTGRES_USER=app
      - POSTGRES_PASSWORD=app
    ports:
      - "5432:5432"
    volumes:
      - ./_pgdata:/var/lib/postgresql/data

I try remove all images and containers and start. I try alpine and debian image. It does not run. I remove _pgdata folder and start again I work. But i lost all data. I don't understand what is change after time?

Can i use postgresql in production with docker ?

folder permision: drwx------ 19 999 root 4096 Oct 2 10:43 _pgdata

docker inspect pgdb (borken): https://hastebin.com/share/xeyadefuve.json

DB container logs here:

LOG:  database system is ready to accept connections
pgdb | 2023-10-02 10:14:50.097 +03 [35377] FATAL:  password authentication failed for user "app"
pgdb | 2023-10-02 10:14:50.097 +03 [35377] DETAIL:  Connection matched file "/var/lib/postgresql/data/pg_hba.conf" line 128: "host all pgdb all scram-sha-256"
pgdb | 2023-10-02 10:14:52.511 +03 [35378] FATAL:  password authentication failed for user "app"
pgdb | 2023-10-02 10:14:52.511 +03 [35378] DETAIL:  Connection matched file "/var/lib/postgresql/data/pg_hba.conf" line 128: "host all all all scram-sha-256"
pgdb | 2023-10-02 10:14:53.927 +03 [35379] FATAL:  password authentication failed for user "app"
pgdb | 2023-10-02 10:14:53.927 +03 [35379] DETAIL:  Connection matched file "/var/lib/postgresql/data/pg_hba.conf" line 128: "host all all all scram-sha-256"
rranjangupta commented 7 months ago

Hi @kyesil Have you fix this issue?