Skip to content

fix(docker): Pin PostgreSQL image version to prevent data volume compatibility crashes #387

Closed

Description

@CKodidela

Describe the bug
The docker-compose.yml and test/integration/docker-compose.yml files currently use the generic postgres image tag, which defaults to latest. When Docker pulls a new major version of PostgreSQL (like the recent release of v18), the container crashes because it is incompatible with existing local .nostr/data volumes created by older Postgres versions. Using latest for databases causes breaking changes in local development environments.

To Reproduce
Steps to reproduce the behavior:

  1. Have an existing local .nostr/data volume populated by an older version of Postgres (e.g., v14 or v15).
  2. Run ./scripts/start_local (which pulls the latest Postgres 18+ image).
  3. The nostream-db container crashes continuously and the backend fails to start.

Expected behavior
The Postgres image should be pinned to a specific major version (e.g., postgres:15 or postgres:14) in the docker-compose files. This ensures the database version remains deterministic and prevents data volume compatibility crashes for developers.

Screenshots
N/A

System (please complete the following information):

  • OS: Windows (via Git Bash/WSL) and Arch Linux
  • Platform: Docker Compose
  • Version: main branch

Logs

nostream-db     | Error: in 18+, these Docker images are configured to store database data in a
nostream-db     |        format which is compatible with "pg_ctlcluster" (specifically, using
nostream-db     |        major-version-specific directory names).  This better reflects how                           
nostream-db     |        PostgreSQL itself works, and how upgrades are to be performed.                               
nostream-db     |                                                                                                     
nostream-db     |        See also https://github.com/docker-library/postgres/pull/1259                                
nostream-db     |                                                                                                     
nostream-db     |        Counter to that, there appears to be PostgreSQL data in:                                     
nostream-db     |          /var/lib/postgresql/data (unused mount/volume)                                             
nostream-db     | 
nostream-db     |        This is usually the result of upgrading the Docker image without                             
nostream-db     |        upgrading the underlying database using "pg_upgrade" (which requires both                    
nostream-db     |        versions). 
...
dependency failed to start: container nostream-db is unhealthy

Activity

  1. added
    bug
    on Apr 8, 2026
  2. CKodidela commented on Apr 8, 2026

    @CKodidela
    ContributorAuthor

    @cameri can i work on this?

  3. CKodidela commented on Apr 8, 2026

    @CKodidela
    ContributorAuthor

    Fix:
    A few changes in docker-compose.yml:

    1. Pin the database image to postgres:15
    2. Switch from a local bind mount to a named Docker volume (this also fixes the WSL/Windows file permission crashes).
  4. cameri commented on Apr 8, 2026

    @cameri
    Owner

    @CKodidela Yes, this is perfect. I caught a few people off guard in the past.

  5. assigned and unassigned on Apr 8, 2026
  6. added
    good first issue
    on Apr 8, 2026
  7. YashIIT0909 commented on Apr 8, 2026

    @YashIIT0909
    Contributor

    @CKodidela, the README mentions postgres 14.0, i think that should be postgres:14

    Fix: A few changes in docker-compose.yml:

    1. Pin the database image to postgres:15
    2. Switch from a local bind mount to a named Docker volume (this also fixes the WSL/Windows file permission crashes).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

buggood first issue

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions