I want to ensure my Postgres data (using Linux based image) persist, even after my Windows host machine restart.
I tried to follow the steps How to persist data in a dockerized postgres database using volumes
docker-compose.yml
volumes:
- ./postgres_data:/var/lib/postgresql/data
However, I'm getting error
waiting for server to start....FATAL: data directory "/var/lib/postgresql/data/pgdata" has wrong ownership
HINT: The server must be started by the user that owns the data directory.
stopped waiting
pg_ctl: could not start server
Then, I tried to follow step in https://forums.docker.com/t/trying-to-get-postgres-to-work-on-persistent-windows-mount-two-issues/12456/5
The suggested method are
docker volume create --name postgres_data --driver local
docker-compose.yml
services:
postgres:
volumes:
- postgres_data:/var/lib/postgresql/data
volumes:
postgres_data:
external: true
However, I'm confused on the command docker volume create --name postgres_data --driver local
. As, it doesn't mention the exact path of Windows host machine.
I tried
C:\celery-hello-world>docker volume create postgres_data
postgres_data
C:\celery-hello-world>docker volume inspect postgres_data
[
{
"CreatedAt": "2018-02-06T14:54:48Z",
"Driver": "local",
"Labels": {},
"Mountpoint": "/var/lib/docker/volumes/postgres_data/_data",
"Name": "postgres_data",
"Options": {},
"Scope": "local"
}
]
May I know where is the Windows directory location, which VOLUME postgres_data
mount to?