Okay, I tried and failed once. Luckily, the virtual machine snapshot got restored. I also discovered that my mattermost version is 6.3.7, not 5.1.1. The latter was the version number for the Mattermost Apple Store app!
I had installed via mattermost-docker. So I tried to upgrade using the deprecated upgrade-postgres.sh script. That led to several errors, and eventually a failed upgrade.
What should I do now? This?
cd /opt/mattermost-docker/
git stash
git pull (from master of mattermost/mattermost-docker/ in github)
git stash pop
docker-compose down
docker-compose build
docker-compose up -d