-
Notifications
You must be signed in to change notification settings - Fork 1.2k
windows 10 FATAL: data directory "/var/lib/postgresql/data" has wrong ownership #558
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The folder you're mounting has insufficient permissions/ownership in the container |
@wglambert Thank for response, but how can i fix it? |
From the perspective of the VM that runs Docker for Windows, any directory shared from the host is owned by root ( docker/for-win#63). If I remember correctly, it allows any user access to read and write anyway. Unfortunately, postgres must be run as the owner of the directory (regardless of whether reads and writes would have succeeded) and will not run as root. So the only solution is to use a named volume rather than a share to the Windows host: volumes:
- postgres-data:/var/lib/postgresql/data
# this name will need to be unique among all your containers |
This comment has been minimized.
This comment has been minimized.
It seems to be a little bit more than that: I suppose the files are involved too.
Here I tried to fake the data volume with a symlink, but no luck. |
Closing, since this appears to be resolved. In the future, these sorts of questions/requests would be more appropriately posted to the Docker Community Forums, the Docker Community Slack, or Stack Overflow. |
Ok, so here is a solution that helped me. First, I ran the command
Note: the volumes block is indented at the same level as services. This apparently helps tell Docker that the particular folder being used for data storage is defined as a volume, which has a different set of access rights versus a folder. I'm not entirely sure if this is the correct way to explain it, but my error of |
@fierytortilla where are you specifying the local directory that you are mapping from? volumes:
- pgdata:/var/lib/postgresql/data |
On Windows 10 is always failed while docker-compose up:
and here is logs
The text was updated successfully, but these errors were encountered: