Did you click the link in the first reply that says “How do I manually update Discourse and docker image to latest”? It includes this:
So those are the commands that you use to upgrade. You won’t lose anything.
But if it was two years ago, it’s a bit more complicated because the database needs to get upgraded too, so you’ll want to have a look at PostgreSQL 13 update. (But usually, you just rebuild twice and it works.)