Mattermost docker refuses to connect after reboot

I installed MM via docker-compose (Ubuntu 20.04), and it was working fine via url, and locally via localhost:8065, that is until I decided to reboot my proxy server (apache) and reboot the docker container. Now, whenever I start the docker container, I cannot longer access my mattermost. When testing for the port using telnet, it looks like it gets connected but then the connection is closed.

From host server:

$ telnet localhost 8065
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Connection closed by foreign host.

From local network:

$ telnet mylanIP 8065
Trying mylanIP ...
telnet: Unable to connect to remote host: Connection refused

From the web:

Proxy Error
The proxy server received an invalid response from an upstream server.
The proxy server could not handle the request

Reason: Error reading from remote server

The docker logs show this:

matter-mattermost-1  | {"timestamp":"2023-03-06 16:53:40.096 -05:00","level":"info","msg":"Server is listening on 127.0.0.1:8065","caller":"app/server.go:952","address":"127.0.0.1:8065"}

Can someone please help me solve this issue?

I was able to find a temporary workaround by deleting the config file config/config.json in the docker container. However, I have to do this everytime I stop the docker container.

I found a post having the same issue 5 years ago ([SOLVED] Mattermost suddenly crashed and after reboot Web Container doesn't response - #12 by rikrdo89 , still unsolved)

Hopefully someone can find a long term solution to this issue. I don’t know what type of configuration I am losing by erasing the config file every time, if it is nothing important, then the conf file should be made a tmp file that is removed when stopping the container.

How do you restart the Mattermost application container?
What’s the output of docker ps before and after you restart it?

I restart it by using docker-compose down and docker-compose up. The output shows the containers for MM loaded after restart, but they are not accessible as I mentioned earlier.

Can you please share the output? I’m interested in the port mappings and the health status, f.ex.
If you missed the port mapping config file when starting the containers, f.ex., they will only listen internally:

# docker-compose up
[...]
# docker ps
CONTAINER ID   IMAGE                                       COMMAND                  CREATED         STATUS                            PORTS                               NAMES
afb18b589605   mattermost/mattermost-team-edition:latest   "/entrypoint.sh matt…"   4 seconds ago   Up 2 seconds (health: starting)   8065/tcp, 8067/tcp, 8074-8075/tcp   mm-780-mattermost-1
4f689b0faf35   postgres:13-alpine                          "docker-entrypoint.s…"   4 seconds ago   Up 3 seconds                      5432/tcp                            mm-780-postgres-1

vs.

# docker-compose -f docker-compose.yml -f docker-compose.without-nginx.yml up -d
[...]
# docker ps
CONTAINER ID   IMAGE                                       COMMAND                  CREATED         STATUS                           PORTS                                                                                                           NAMES
14a84b3cdcf6   mattermost/mattermost-team-edition:latest   "/entrypoint.sh matt…"   3 seconds ago   Up 1 second (health: starting)   8067/tcp, 0.0.0.0:8065->8065/tcp, :::8065->8065/tcp, 8074-8075/tcp, 0.0.0.0:8443->8443/udp, :::8443->8443/udp   mm-780-mattermost-1
9eede1bdfc55   postgres:13-alpine                          "docker

I assume you did just use docker-compose up without specifying both yml files, right?