Mattermost is unable to connect to Postgres database when using Docker

I eventually managed to fix this by deleting the ./volumes/db directory and regenerating it, so it seems to have been corrupted.