Keep data save through re-install

I am currently planning to re-install my homeserver because I messed up a few settings pretty badly. I run nextcloud as a docker container and connect it to a mariadb container. Would the following be enough to save my data?

1, Stop docker containers and backup connected volumes to an external HDD.
2, Disconnect HDD with the actual files
3, re-install
4, Restore docker volumes from external HDD and give them the same names
5, Re-connect HDD and mount it to path with the same name as the old system path
6, Re-create containers with the same arguments as the old ones

Bumping one time. Anyone can confirm this?