[SOLVED] No DB Connection from app to db server after docker installation

Hello, I’m trying to install a test installation via docker. The installation process up to step 3 (https://docs.mattermost.com/install/prod-docker.html) worked without a problem but I can’t use the platform cli on the app server. I alway get the following error when trying to execue a command (e.g. create a user):

[2017/08/12 10:21:30 CEST] [EROR] Failed to ping DB retrying in 10 seconds err=dial tcp 127.0.0.1:5432: getsockopt: connection refused

The webinterface is working and I can create a user with it. I didn’t do any steps after point 3 because this is only a local test installation in a virtual machine with docker.

I tried to open up the 5432 tcp port with the yast firewall but it didn’t help either.

Summary

Host: openSuse Tumbleweed
Installation with docker (https://docs.mattermost.com/install/prod-docker.html)
Trying to execute a command via the platform cli throws the following error:

[2017/08/12 10:21:30 CEST] [EROR] Failed to ping DB retrying in 10 seconds err=dial tcp 127.0.0.1:5432: getsockopt: connection refused

Steps to reproduce

Install mattermost without changing any of the configuration and try to execute a platform command from the app server.

Expected behavior

Connect to the db and execute the command.

I searched but didn’t found any suiting or working solution.

Can anyone help me? Thanks in advance

Seems that your app container try to reach your database on localhost. I’m pretty sure it should not, can you provide your docker-compose.yml file please ? (don’t forget to remove/obfuscate your credentials)

I didn’t change any content of the docker.compose.yml (even the passwords and username, because I just wanted to test the first steps of the installation routine) except for commenting out the enterprise-option for the installtion.

So my docker-compose.yaml looks like this: https://github.com/mattermost/mattermost-docker/blob/master/docker-compose.yml

I don’t understand why your container try to contact your database on localhost, but I think this is the problem. Is there any special DNS configuration on your setup ?

I don’t know why but the problem seems to be gone now (I didn’t change anything, only some reboots of the docker host and docker containers). Maybe it just needed some time to get all the connections correctly.

Thank you very much for your help!

The app container wait for the database to be ready, so I’m not sure if it was the problem.
But if it’s solve, that’s good :slight_smile:

1 Like

Thanks @pichouk for your help :slight_smile: and I’m pleased your issue is resolved now @NewUser!

I’ll close this issue off for now…