I created container with command
sudo docker run --rm \
--name selectel-pgdocker_pgdata \
-p 5432:5432 \
-e POSTGRES_USER=selectel \
-e POSTGRES_PASSWORD=selectel \
-e POSTGRES_DB=selectel \
-e PGDATA=/var/lib/postgresql/data/pgdata \
-d \
-v $HOME/docker/volumes/postgres:/var/lib/postgresql/data \
postgres
But after, I used command
psql -h 127.0.0.1 -U selectel -d selectel
and start creating databases and tables in psql
. But my /var/lib/postgresql/data/pgdata
still doesn't exist. If I create the directory manually, it is still empty. What should I do? I want to save my data in the main filesystem, not inside Docker.