📝 Issue for TimescaleDB Repository
Problem Summary
The official documentation for timescale/timescaledb-ha Docker image does not document critical requirements for volume permissions and PGDATA configuration, leading to data loss and initialization failures that are difficult to troubleshoot.
Current Documentation Gap
The official installation guide at https://docs.tigerdata.com/self-hosted/latest/install/installation-docker/ does not mention:
- Volume Permissions: The HA image requires volumes with
1000:1000 ownership (hardcoded postgres UID/GID)
- PGDATA Configuration: When using custom volume mounts,
PGDATA must be explicitly set to match the mount point
- Differences from Standard Image: The HA image behaves differently from
timescale/timescaledb regarding permissions and paths
Issues Encountered
Without this documentation, developers encounter these problems:
1. Permission Errors on Initialization
initdb: error: could not change permissions of directory "/var/lib/postgresql/data": Operation not permitted
2. Data Loss After Container Recreate
- Data appears to persist but is actually stored in container layer (not volume)
- When container recreates, all data is lost
- Alembic/Flyway migrations re-run from scratch
3. Volume Not Used
- Volume mounted at
/var/lib/postgresql/data
- HA image actually uses
/home/postgres/pgdata/data by default
- Volume remains empty, data stored ephemerally
Related Issues
This has been reported multiple times but never addressed in official docs:
Proposed Documentation Improvements
1. Add "Volume Permissions" Section
# ⚠️ IMPORTANT: HA image requires specific permissions
services:
# Initialize volume with correct permissions (UID 1000:1000)
db-init:
image: alpine
volumes:
- timescale-data:/data
command: sh -c "chown -R 1000:1000 /data && chmod -R 700 /data"
restart: "no"
timescaledb:
image: timescale/timescaledb-ha:pg16
depends_on:
db-init:
condition: service_completed_successfully
environment:
POSTGRES_PASSWORD: password
PGDATA: /var/lib/postgresql/data # ← Must match volume mount
volumes:
- timescale-data:/var/lib/postgresql/data
volumes:
timescale-data:
2. Add "Common Issues" Section
Problem: Data lost after docker compose up --build
Cause: Volume permissions incorrect or PGDATA misconfigured
Solution: Use init container (see above) or manually set permissions:
docker run --rm -v timescale-data:/data alpine chown -R 1000:1000 /data
3. Add "HA vs Standard Image" Comparison Table
| Feature |
timescaledb |
timescaledb-ha |
| Postgres UID |
999 (configurable) |
1000 (hardcoded) |
| Default PGDATA |
/var/lib/postgresql/data |
/home/postgres/pgdata/data |
| Volume permissions |
Flexible |
Requires 1000:1000 |
| Init complexity |
Simple |
Requires init container |
Impact
Without this documentation:
- ✗ Developers waste hours debugging permission errors
- ✗ Data loss in production due to misconfiguration
- ✗ Poor developer experience with HA image
- ✗ Users switch to standard image to avoid issues
Suggested Documentation Locations
- Installation Docker page - Add "Prerequisites" section about permissions
- Configuration page - Add "Volume Management" section
- Troubleshooting page - Add "Permission Denied Errors" section
- README in timescaledb-docker-ha repo - Add prominent warning
Additional Context
- This issue affects Docker Compose, Docker Swarm, and Kubernetes deployments
- The standard
timescale/timescaledb image does not have these issues
- Community has documented workarounds in various blog posts and Stack Overflow
References
Would appreciate if this could be added to official documentation to help other developers avoid data loss.
📝 Issue for TimescaleDB Repository
Problem Summary
The official documentation for
timescale/timescaledb-haDocker image does not document critical requirements for volume permissions and PGDATA configuration, leading to data loss and initialization failures that are difficult to troubleshoot.Current Documentation Gap
The official installation guide at https://docs.tigerdata.com/self-hosted/latest/install/installation-docker/ does not mention:
1000:1000ownership (hardcoded postgres UID/GID)PGDATAmust be explicitly set to match the mount pointtimescale/timescaledbregarding permissions and pathsIssues Encountered
Without this documentation, developers encounter these problems:
1. Permission Errors on Initialization
2. Data Loss After Container Recreate
3. Volume Not Used
/var/lib/postgresql/data/home/postgres/pgdata/databy defaultRelated Issues
This has been reported multiple times but never addressed in official docs:
Proposed Documentation Improvements
1. Add "Volume Permissions" Section
2. Add "Common Issues" Section
Problem: Data lost after
docker compose up --buildCause: Volume permissions incorrect or PGDATA misconfigured
Solution: Use init container (see above) or manually set permissions:
3. Add "HA vs Standard Image" Comparison Table
/var/lib/postgresql/data/home/postgres/pgdata/dataImpact
Without this documentation:
Suggested Documentation Locations
Additional Context
timescale/timescaledbimage does not have these issuesReferences
Would appreciate if this could be added to official documentation to help other developers avoid data loss.