I am new to Docker and have just got a taste of how volatile things are when I had to downgrade Docker for Windows to a previous version to get port forwarding to localhost working again (as per this issue).
I intend to run postgresql in a container and use an data volume to persist the db’s data independently from the container.
Having had to update (in this case backwards) the engine I notices the Moby VM gets destroyed and re-created which effectively means everything in it (including the data volumes) evaporates.
That seems impossibly scary!
Am I missing something here? How does one set up a persistent data volume that lives across Docker engine updates?
the persistent data volume must be on the host media, and mounted into the containers for use.
that way, when the containers stop, the data doesn’t go away
Please note that I am not asking about how to persist data when containers stop/start but how to do so without worrying about updates to Docker for Windows itself causes the volumes to be deleted (as part of re-creating the MobyLinux VM)
Yes, they live inside the VHDX disk that contains the MobyLinuxVM which is created by Docker for Windows as part of the installation process.
So, you can start, stop and re-create containers at will and your data volumes are safe.
BUT, if you now want to upgrade Docker for Windows itself to a new version, that VHDX gets thrown away and replaced by a new one and with it goes all your data.
It wouldn’t care when you install but would fail when syncing to disk at runtime. It expects ext.
I realize that the context for my question is outside the scope of this topic but still maybe someone can point to an alternative solution. for example, is it possible to setup and connect a second virtual disk (i.e other than the MobyLinuxVM one) and mount volumes to containers from it ?