Mattermost:
{"timestamp":"2022-08-29 08:20:55.900 Z","level":"info","msg":"Server is listening on [::]:8065","caller":"app/server.go:1307","address":"[::]:8065"}
So this looks good in my opinion, the 502 could have been given to you because you might have been too fast; it takes up to a minute for the first start because all the databases need to be populated.
If you still cannot access the Mattermost webinterface, please provide the output of:
sudo docker ps