Skip to content

Fix docker compose postgres volume path#583

Open
MaximilianHausen wants to merge 1 commit intooss-apps:mainfrom
MaximilianHausen:fix-docker-db-volume
Open

Fix docker compose postgres volume path#583
MaximilianHausen wants to merge 1 commit intooss-apps:mainfrom
MaximilianHausen:fix-docker-db-volume

Conversation

@MaximilianHausen
Copy link
Contributor

Description

Partial revert of #488.
Relevant upstream pr: docker-library/postgres#1259

The current compose files use the mountpoint for postgres 18 containers (/var/lib/postgresql) on a postgres 17 container. Since the actual mountpoint, defined in the image as /var/lib/postgresql/data, is still free, a new unnamed volume is created for each container, resetting the database with every docker compose down.

This pr also locks the image version in the dev setup because this path is not compatible with postgres 18 containers and has to be changed back once the modified image is updated.

Updating the ossapps/postgres image and the reference in docker/prod/compose.yml to postgres 18 would also fix the issue.

Demo

Relevant output from docker container inspect:

"Mounts": [
    {
        "Type": "volume",
        "Name": "98e1897f352060c495bfbae2c661b1b8e06696ea7be0d2f8fd32689bd1b7cf9d",
        "Source": "/var/lib/docker/volumes/98e1897f352060c495bfbae2c661b1b8e06696ea7be0d2f8fd32689bd1b7cf9d/_data",
        "Destination": "/var/lib/postgresql/data",
        "Driver": "local",
        "Mode": "",
        "RW": true,
        "Propagation": ""
    },
    {
        "Type": "volume",
        "Name": "splitpro_database",
        "Source": "/var/lib/docker/volumes/splitpro_database/_data",
        "Destination": "/var/lib/postgresql",
        "Driver": "local",
        "Mode": "rw",
        "RW": true,
        "Propagation": ""
    }
],

Checklist

  • I have read CONTRIBUTING.md in its entirety
  • I have performed a self-review of my own code
  • I have added unit tests to cover my changes
  • The last commit successfully passed pre-commit checks
  • Any AI code was thoroughly reviewed by me

Partial revert of ac586b1.

The compose files previously used the mountpoint for postgres 18 containers (/var/lib/postgresql) on a postgres 17 container. Since the actual mountpoint, defined in the image as /var/lib/postgresql/data, is still free, a new unnamed volume was created for each container, resetting the database with every `docker compose down`.

Also locks the container version in the dev setup because the path will need to be changed back once the custom image is updated to postgres 18.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant