How to persist MySQL container on Windows 10 between reboots

I did some additional investigation and I think the problem I asked about never existed. It was actually a Docker for Windows issue of a different kind: https://github.com/docker/for-win/issues/584.

Here is what was happening.

  1. When machine was rebooted, all persistent MySQL data was in fact saved correctly.
  2. But after computer restart Docker was not able to mount a volume because the volume became available a few seconds after container was autostarted (please see a comment here: https://github.com/docker/for-win/issues/584#issuecomment-286792858). As a result of this, MySQL database was empty (volume was not mounted, no data can be read).

If to restart a container manually, all persistent data will become loaded properly. So it was not the issue I thought of, but a different issue that is, luckily, a much less severe one.