2 factor credentials lost after Docker container restart

When running Gitea with Docker as decribed on Installation with Docker | Gitea Documentation , it looks like something breaks the 2FA authentication after the container is restarted.

As long as the container runs, everything works perfectly fine and users can create and use 2FA credentials. However, after the container is stopped/restarted, users who have 2FA set up cannot login any longer.

Deleting their record in the "two_factor " table allows them to log in again.

Is there a way to avoid this ?