docker-library / postgres

Docker Official Image packaging for Postgres
http://www.postgresql.org
MIT License
2.14k stars 1.11k forks source link

postgres data gets deleted when i restart server #1139

Closed feranzie closed 7 months ago

feranzie commented 9 months ago

Docker version 20.10.22, build 3a2c30b windows 10

every time I ingest data it works and I'm able to use the data in pgcli, but once I restart the server its no longer there

winpty docker run -it \ -e POSTGRES_USER="root" \ -e POSTGRES_PASSWORD="root" \ -e POSTGRES_DB="ny_taxi" \ -v /c/Users/DELL/Desktop/data-engineering-zoomcamp/week_1_basics_n_setup/2_docker_sql/ny_taxi_postgres_data:/var/lib/postgresql/data/: \ -p 5432:5432 \ postgres:13

LaurentGoderre commented 9 months ago

That's strange. Restarting doesn't delete files in the volume on the host. Is it possible there is script deleting the content of the folder n startup?

tianon commented 7 months ago

:eyes: /c/Users/DELL/Desktop/data-engineering-zoomcamp/week_1_basics_n_setup/2_docker_sql/ny_taxi_postgres_data

That looks like you're probably using MinGW on Windows, perhaps via Git Bash?

If you convert that to 'C:\Users\DELL\Desktop\data-engineering-zoomcamp\week_1_basics_n_setup\2_docker_sql\ny_taxi_postgres_data', you might have better luck (Docker Desktop should then be able to convert/share it correctly).