My Question is if I use a docker container (say postgres) and have a named volume created to store the data from container to local as implied here (any many more articles and forums). The data remains as long as the volume is up, even if I stop the container or even remove the image. But if I remove the volume it self the entire data is wiped clean. Is it possible to prevent this? if yes, how? also is it possible to take the back up of /var/lib/postgresql/data
from container to local without it being effected by volume removal?
Asked
Active
Viewed 43 times
1

Akash Jain
- 684
- 9
- 23
-
You can use a mount, to mount a local directory. Your data would then be written to the host directly. – Rick Rackow May 02 '23 at 12:45
-
can you please elaborate on this? – Akash Jain May 30 '23 at 18:27