# Docker mattermost-team-edition DB connection not working

**URL:** <https://forum.mattermost.com/t/docker-mattermost-team-edition-db-connection-not-working/9696>\
**Category:** Troubleshooting\
**Created:** [May 6, 2020, 3:58pm UTC](https://forum.mattermost.com/t/docker-mattermost-team-edition-db-connection-not-working/9696 "2020-05-06T15:58:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nwm](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/nwm/32/3806_2.png) [@nwm](https://forum.mattermost.com/u/nwm)\
**Post date:** [May 6, 2020, 3:58pm UTC](https://forum.mattermost.com/t/docker-mattermost-team-edition-db-connection-not-working/9696/1 "2020-05-06T15:58:15Z")

</div>

Docker is being deployed with ansible using the offical mattermost-team-edition docker image

Env has  
`MM_SQLSETTINGS_DATASOURCE=postgres://mattermost:xyz@tcp(mattermost-db:5432)/mattermost?sslmode=disable`

Database is official postgres docker image with same username and password as set in `MM_SQLSETTINGS_DATASOURCE`

Within mattermost container I can ping mattermost-db but for whatever reason the mattermost gorm layer leeps returning

```
{"level":"error","ts":1588777892.7252038,"caller":"sqlstore/supplier.go:232","msg":"Failed to ping DB, server will exit.","error":"context deadl
May 06 15:11:22 intrasrv aac62c8c8c6d[20471]: {"level":"info","ts":1588777882.7246943,"caller":"sqlstore/supplier.go:224","msg":"Pinging SQL","database":"master"}
May 06 15:11:12 intrasrv aac62c8c8c6d[20471]: {"level":"error","ts":1588777872.7244122,"caller":"sqlstore/supplier.go:236","msg":"Failed to ping DB","error":"context deadline exceeded","retr
May 06 15:11:02 intrasrv aac62c8c8c6d[20471]: {"level":"info","ts":1588777862.7238927,"caller":"sqlstore/supplier.go:224","msg":"Pinging SQL","database":"master"}

```

netcat smoke test from the mattermost container into the mattermost-db 5432 also works returning  
`EhSFATALVFATALC28P01Mpassword authentication failed for user "username"Fauth.cL330Rauth_failed/`  
Showing that the app can connect to the db

---

<div class="post-metadata">

**Author:** ![amy.blais](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/amy.blais/32/7481_2.png) [@amy.blais](https://forum.mattermost.com/u/amy.blais)\
**Post date:** [May 7, 2020, 11:22pm UTC](https://forum.mattermost.com/t/docker-mattermost-team-edition-db-connection-not-working/9696/2 "2020-05-07T23:22:39Z")

</div>

What Mattermost version are you on?

---

<div class="post-metadata">

**Author:** ![nwm](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/nwm/32/3806_2.png) [@nwm](https://forum.mattermost.com/u/nwm)\
**Post date:** [May 7, 2020, 11:49pm UTC](https://forum.mattermost.com/t/docker-mattermost-team-edition-db-connection-not-working/9696/3 "2020-05-07T23:49:46Z")

</div>

Latest docker mattermost-team-edition from docker hub
