Problem deploying Container Instance of PostgreSQL database server mounted on file share

Pablo Schor 0 Reputation points
2025-03-01T22:46:38.5133333+00:00

I'm creating a PostgreSQL container instance with this command line

az container create  --resource-group sofresgroup  --name sofpostgres  --image sofacr.azurecr.io/postgres:17.4 --ports 5432  --environment-variables POSTGRES_PASSWORD=xxxxxx --azure-file-volume-account-name sofstorageacct  --azure-file-volume-account-key xxxxxx--azure-file-volume-share-name soffileshare --azure-file-volume-mount-path /var/lib/postgresql/data  --dns-name-label sofpostgres --registry-login-server sofacr.azurecr.io  --registry-username sofacr  --registry-password xxxxx --restart-policy Never  

When I deploy the container, this is what I see in the logs, apparently there's a problem with the ownership of the data directory, how to fix this?

2025-03-01 22:34:17.008 UTC [135] FATAL: data directory "/var/lib/postgresql/data" has wrong ownership

2025-03-01 22:34:17.008 UTC [135] HINT: The server must be started by the user that owns the data directory. child process exited with exit code 1

initdb: removing contents of data directory "/var/lib/postgresql/data" running bootstrap script ...

Azure Container Instances
Azure Container Instances
An Azure service that provides customers with a serverless container experience.
741 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.