Mattermost Peer-to-Peer Forum

sqlstore/supplier.go:221","msg":"Failed to ping DB retrying in 10 seconds


#1

Hi all,

I am trying to install Matter most on Windows 10 with Docker and MySQL as a database.
I tried many options but still it fails with the following error.

The following is the command I am using to start Mattermost:

docker run --name mattermost -d --publish 8065:8065 -e MM_USERNAME=‘root’ -e MM_PASSWORD=‘mysql’ -e MM_DBNAME=‘mattermost’ -e DB_HOST=‘127.0.0.1’ -e DB_PORT_NUMBER=3306 -e MM_SQLSETTINGS_DRIVERNAME=‘mysql’ -e MM_SQLSETTINGS_DATASOURCE=‘root:mysql@tcp(127.0.0.1:3306)/mattermost?charset=utf8mb4,utf8&readTimeout=30s&writeTimeout=30s’ mattermost/mattermost-prod-app:5.5.1

The docker container starts and continues to throw this error in the logs

~ $ tail -f logs/mattermost.log
{“level”:“info”,“ts”:1544630762.8168886,“caller”:“sqlstore/supplier.go:209”,“msg”:“Pinging SQL master database”}
{“level”:“error”,“ts”:1544630762.8177576,“caller”:“sqlstore/supplier.go:221”,“msg”:“Failed to ping DB retrying in 10 seconds err=dial tcp 127.0.0.1:3306: connect: connection refused”}
{“level”:“info”,“ts”:1544630772.8179853,“caller”:“sqlstore/supplier.go:209”,“msg”:“Pinging SQL master database”}
{“level”:“error”,“ts”:1544630772.8183506,“caller”:“sqlstore/supplier.go:221”,“msg”:“Failed to ping DB retrying in 10 seconds err=dial tcp 127.0.0.1:3306: connect: connection refused”}
{“level”:“info”,“ts”:1544630782.8186,“caller”:“sqlstore/supplier.go:209”,“msg”:“Pinging SQL master database”}
{“level”:“error”,“ts”:1544630782.8187604,“caller”:“sqlstore/supplier.go:221”,“msg”:“Failed to ping DB retrying in 10 seconds err=dial tcp 127.0.0.1:3306: connect: connection refused”}
{“level”:“info”,“ts”:1544630792.8189068,“caller”:“sqlstore/supplier.go:209”,“msg”:“Pinging SQL master database”}
{“level”:“error”,“ts”:1544630792.8190837,“caller”:“sqlstore/supplier.go:221”,“msg”:“Failed to ping DB retrying in 10 seconds err=dial tcp 127.0.0.1:3306: connect: connection refused”}
{“level”:“info”,“ts”:1544630802.8192677,“caller”:“sqlstore/supplier.go:209”,“msg”:“Pinging SQL master database”}
{“level”:“error”,“ts”:1544630802.8195567,“caller”:“sqlstore/supplier.go:221”,“msg”:“Failed to ping DB retrying in 10 seconds err=dial tcp 127.0.0.1:3306: connect: connection refused”}
{“level”:“info”,“ts”:1544630812.8197072,“caller”:“sqlstore/supplier.go:209”,“msg”:“Pinging SQL master database”}
{“level”:“error”,“ts”:1544630812.8202488,“caller”:“sqlstore/supplier.go:221”,“msg”:“Failed to ping DB retrying in 10 seconds err=dial tcp 127.0.0.1:3306: connect: connection refused”}

I am able to connect o mysql with userid root and passowrd mysql. So connection to the database is not an issue.

I have spent too much time on this and now struck

Any help in resolving this is appreciated.

Thanks
Rakesh.


#2

Hi @rakeshbalguri,

Feedback from one of our community members: the issue seems to be that 127.0.0.1 inside any Docker container is different from 127.0.0.1 outside that container. In other words, the DB server reachable on Windows’ 127.0.0.1 is unreachable from within the Mattermost Docker container. (You need to use a different listen address for your DB server.)