fix(docker): resolve permission denied error for PG18+ volume mounts
All checks were successful
🚀 Docker Build and Push / build-and-push (15) (push) Successful in 4m59s
🚀 Docker Build and Push / build-and-push (16) (push) Successful in 4m56s
🚀 Docker Build and Push / build-and-push (17) (push) Successful in 4m56s
🚀 Docker Build and Push / build-and-push (18) (push) Successful in 4m42s
All checks were successful
🚀 Docker Build and Push / build-and-push (15) (push) Successful in 4m59s
🚀 Docker Build and Push / build-and-push (16) (push) Successful in 4m56s
🚀 Docker Build and Push / build-and-push (17) (push) Successful in 4m56s
🚀 Docker Build and Push / build-and-push (18) (push) Successful in 4m42s
PostgreSQL 18+ Docker images changed the data directory structure to use versioned subdirectories (e.g., /var/lib/postgresql/18/main) instead of the traditional /var/lib/postgresql/data path. Changes: - Dockerfile: Add mkdir and chown to ensure /var/lib/postgresql has correct permissions for the postgres user before volume mount - README.md: Update Quick Start with volume mount example - README.md: Add 'Data Persistence' section explaining PG18+ requirements This fixes the 'mkdir: cannot create directory: Permission denied' error that occurred when mounting volumes at /var/lib/postgresql. See: https://github.com/docker-library/postgres/pull/1259
This commit is contained in:
@@ -23,12 +23,19 @@ Docker image combining **PostgreSQL** with three powerful extensions:
|
||||
docker run -d \
|
||||
--name my-postgres \
|
||||
-e POSTGRES_PASSWORD=mysecretpassword \
|
||||
-v postgres_data:/var/lib/postgresql \
|
||||
-p 5432:5432 \
|
||||
gitea.killinger.fr/maxime.killinger/postgres-ts-vectors:latest
|
||||
```
|
||||
|
||||
All extensions are **automatically created** on first startup.
|
||||
|
||||
## Data Persistence
|
||||
|
||||
> [!IMPORTANT]
|
||||
> Starting with PostgreSQL 18, mount volumes at `/var/lib/postgresql` (not `/var/lib/postgresql/data`).
|
||||
> Data will be stored in a versioned subdirectory (e.g., `/var/lib/postgresql/18/main`), which facilitates future upgrades with `pg_upgrade`.
|
||||
|
||||
## Environment Variables
|
||||
|
||||
| Variable | Description | Default |
|
||||
|
||||
Reference in New Issue
Block a user