serlingpa
serlingpa

Reputation: 12690

PostgreSQL docker container suddenly failing to start

I have a Docker container (based on timescale/timescaledb-ha:pg14-latest) that I start like this:

docker run -d --name timescaledb -p 127.0.0.1:5432:5432 \
-v /Users/<me>/timescaledb-data:/home/postgres/pgdata/data \
-e POSTGRES_PASSWORD=postgres timescale/timescaledb-ha:pg14-latest

Today, on trying to run this script, Docker complains:

2023-11-05 19:43:48 2023-11-05 19:43:48.439 UTC [1] FATAL:  data directory "/home/postgres/pgdata/data" has wrong ownership
2023-11-05 19:43:48 2023-11-05 19:43:48.439 UTC [1] HINT:  The server must be started by the user that owns the data directory.

I have changed nothing since I successfully launched it yesterday. I have now of course tried to reset the permissions on that folder.

This is on macOS 14.2 with Docker Desktop 4.25.0 (126437)

I am not even sure what the error indicates. Is it referring to the PostgreSQL server?

Upvotes: -1

Views: 322

Answers (1)

serlingpa
serlingpa

Reputation: 12690

I ran the following in the container itself and it has resolved the issue:

chown -R postgres:postgres /home/postgres/pgdata/data

I was pretty sure that would not work, but it did.

Upvotes: 1

Related Questions