Docker Export from Docker Desktop

I have been successfully running Docker Wordpress service on my laptop. The docker compose file I wrote, set up Volumes on my D: drive for web pages folder and metadata folder.
The system hard drive got corrupted (thank god for Docker) so I reinstalled Windows 10 and Docker.
To my surprise when I reran the docker compose file it over wrote the Web pages folder and the Database metadata folder BUT IT STILL KEEP ALL MY WEB PAGES AND DATABASE INFO.

Was this just pure luck or is it a design feature of Docker?

Thanks Frank

It’s a design feature, not just of Docker, but also the wordpress and mysql/mariadb images. For example, you can create a mysql container which stores its data in a volume. If that container gets deleted, you can create a new container and mount the same volume. If data is found in the volume, the new container will simply re-use that data instead of initialising a new database.

Thank you (rajchaudhuri) for your excellent reply. This gives me confidence that I can use Wordpress in a Docker environment and not lose all my work (potentially 1TB of info). I also noticed that Wordpress/Docker some how know that I had previously added a Wordpress plugin to use Latex in my webpages. Amazing
Regards Frank