Pode me ajudar a rodar o postgres com volume? Estou usando esse código e não está funcionando, eu até vejo os arquivos sendo criados no diretório mas em seguida eles somem.
docker run -d -p 5432:5432 -v "D:\dockervolume\postgres:/var/lib/postgresql/data" -e POSTGRES_PASSWORD=postgres -e PRIMARY_USER=postgres postgres
o erro quando rodo sem o -d está a seguir
λ docker run -p 5432:5432 -v "D:\dockervolume\postgres:/var/lib/postgresql/data" -e POSTGRES_PASSWORD=postgres -e PRIMARY_USER=postgres postgres
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.
The database cluster will be initialized with locale "en_US.utf8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".
Data page checksums are disabled.
fixing permissions on existing directory /var/lib/postgresql/data ... ok
creating subdirectories ... ok
selecting dynamic shared memory implementation ... posix
selecting default max_connections ... 20
selecting default shared_buffers ... 400kB
selecting default time zone ... Etc/UTC
creating configuration files ... ok
running bootstrap script ... 2020-06-22 23:18:01.032 UTC [81] FATAL: data directory "/var/lib/postgresql/data" has wrong ownership
2020-06-22 23:18:01.032 UTC [81] 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"