can you describe how you did run the upgrade? If the upgrade you ran also included a new postgresql container version, the data is not being migrated and as long as the container is still there, the data should be there too.
Can you run docker ps -a to verify that the old container is still there and has not been removed as of yet?
Also can you show the contents of your mattemost-docker/backup directory? By default, Mattermost does not take backups so you probably have set up a backup on your own and in order to know how to restore it, we need to see what’s there.
This is not a database consistent backup if being run while the database is running. Using this command on a running database server will most likely result in not all files being copied properly due to locks and (depending on the queries running) also result in half applied transactions or other database corruption. Anyways, if that’s all you got, you can indeed try to just copy over the contents of the db directory to the new container (which should also expose the db folder to the host). Make sure to remove the data in there first, the files should not be merged and check the filesystem structure which should also be the same.
There might be PostgreSQL version numbers used for folder names which also need to be changed then. The source code of the script you linked talks about some of these problems and also tells you what files need to be modified to adjust to the new paths and versions (postgresql.conf, pg_hba.conf, …). Hard to tell what your current situation is now and therefore it’s also impossible to provide tailored remediation steps for you now.
The PostgreSQL database format is tied to the version running, so if you have a copy of the data directory from PostgreSQL 10.1 f.ex., you cannot just copy it over on a 13.1 installation. It will need to be upgraded using the pg_upgrade command which the script you linked does, so I can only suggest to go through the script which contains the recipe for a working upgrade and find out what went wrong on your end.
I’d suggest to dump the database using pg_dump or any other logical database backup tool that supports working with containerized databases as well as a full copy of your data directory (could be a tar.gz f.ex.).