I am using docker desktop 4.17.1 on windows 11 and I needed to save my db data on host machine.
I used "./postgres_data:/var/lib/postgresql"
volume and it created a folder postgres_data/data
in my project's directory, but this folder was empty, and when I created tables in my db and deleted containers with docker compose down
, docker compose up
started containers like they were new and empty. When I started to use "./postgres_data:/var/lib/postgresql/"
everything became ok, but I still want to understand why it works so. Simple examples of postgres_data content below