"Failed to ping DB" when trying to start mattermost server

Hello, I am having the same issue but I cannot resolve by changing the ip address to localhost and removing the port number.

I am using the docker-compose from this repo —> GitHub - mattermost/docker: Install Mattermost server via Docker
and launching it on a Ubuntu EC2 ami. The only thing I am editing is the env.example where I set the domain to my machine’s ip address and changing the image to the “team” edition.

I get the same error when Mattermost goes to ping the DB on postgres

`"timestamp":"2023-03-21 15:15:49.867 Z","level":"error","msg":"Failed to ping DB","caller":"sqlstore/store.go:250","error":"dial tcp 127.0.0.1:5432: connect: connection refused","retrying in seconds":10}`

This is the env var responsible for talking to the DB

`MM_SQLSETTINGS_DATASOURCE=postgres:${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB}?sslmode=disable&connect_timeout=10`

I have replaced @postgres:5432 with the eth0 ip of the postgres container . I have tried the localhost address. I have also tried using @localhost:5432.

I don’t know what the magical incantation is and I don’t know why it runs perfectly fine on my local machine.