Setting Up Focalboard Docker

For troubleshooting questions, please post in the following format:

Summary
I setup focalboard using docker however when I try and sign in it wipes my login details as if it’s reloading the page constantly.

Steps to reproduce
I installed docker and ran the command:

docker run -it -p 80:8000 mattermost/focalboard

This worked fine for the 2 minutes I played with it but then I ran it via this command:

docker run -d -p 80:8000 mattermost/focalboard

Since I wanted to make it headless. After that is when I began to have the issues and now I’m running it the way I initially ran it to see what was going on.

Expected behavior
The page continues to “refresh” in a sense, it wipes all the text I place into the login page boxes trying to sign in. I’m unsure if it’s an database issue or not.

Observed behavior
Something about the database not working properly and the websocket?

debug [2022-09-13 17:36:23.634 Z] attachSession                            caller="api/auth.go:459" single_user=false
debug [2022-09-13 17:36:23.635 Z] API DEBUG                                caller="api/api.go:4881" code=401 error="unable to get the session for the token: sql: no rows in result set" msg= api=/api/v2/users/me
debug [2022-09-13 17:36:23.647 Z] Command: AUTH                            caller="ws/server.go:149" client="192.168.1.81:63947"
debug [2022-09-13 17:36:23.647 Z] authenticateListener                     caller="ws/server.go:436" token=kezhxa1hjopy79jx71unks7iraa wsSession.userID=
error [2022-09-13 17:36:23.647 Z] ERROR WebSocket                          caller="ws/server.go:130" client="192.168.1.81:63947" error="read tcp 172.17.0.2:8000->192.168.1.81:63947: use of closed network connection"
debug [2022-09-13 17:36:23.647 Z] DISCONNECT WebSocket                     caller="ws/server.go:119" client="192.168.1.81:63947"
debug [2022-09-13 17:36:35.485 Z] attachSession                            caller="api/auth.go:459" single_user=false
debug [2022-09-13 17:36:35.486 Z] API DEBUG                                caller="api/api.go:4881" code=401 error="unable to get the session for the token: sql: no rows in result set" msg= api=/api/v2/users/me
debug [2022-09-13 17:36:35.500 Z] Command: AUTH                            caller="ws/server.go:149" client="192.168.1.81:50012"
debug [2022-09-13 17:36:35.500 Z] authenticateListener                     caller="ws/server.go:436" token=kezhxa1hjopy79jx71unks7iraa wsSession.userID=
error [2022-09-13 17:36:35.500 Z] ERROR WebSocket                          caller="ws/server.go:130" client="192.168.1.81:50012" error="read tcp 172.17.0.2:8000->192.168.1.81:50012: use of closed network connection"
debug [2022-09-13 17:36:35.500 Z] DISCONNECT WebSocket                     caller="ws/server.go:119" client="192.168.1.81:50012"
debug [2022-09-13 17:36:38.524 Z] Command: AUTH                            caller="ws/server.go:149" client="192.168.1.81:50013"
debug [2022-09-13 17:36:38.524 Z] authenticateListener                     caller="ws/server.go:436" token=kezhxa1hjopy79jx71unks7iraa wsSession.userID=
error [2022-09-13 17:36:38.524 Z] ERROR WebSocket                          caller="ws/server.go:130" client="192.168.1.81:50013" error="read tcp 172.17.0.2:8000->192.168.1.81:50013: use of closed network connection"
debug [2022-09-13 17:36:38.525 Z] DISCONNECT WebSocket                     caller="ws/server.go:119" client="192.168.1.81:50013"
debug [2022-09-13 17:36:41.554 Z] Command: AUTH                            caller="ws/server.go:149" client="192.168.1.81:50014"
debug [2022-09-13 17:36:41.554 Z] authenticateListener                     caller="ws/server.go:436" token=kezhxa1hjopy79jx71unks7iraa wsSession.userID=
error [2022-09-13 17:36:41.554 Z] ERROR WebSocket                          caller="ws/server.go:130" client="192.168.1.81:50014" error="read tcp 172.17.0.2:8000->192.168.1.81:50014: use of closed network connection"
debug [2022-09-13 17:36:41.554 Z] DISCONNECT WebSocket                     caller="ws/server.go:119" client="192.168.1.81:50014"
debug [2022-09-13 17:37:08.722 Z] attachSession                            caller="api/auth.go:459" single_user=false
debug [2022-09-13 17:37:08.723 Z] API DEBUG                                caller="api/api.go:4881" code=401 error="unable to get the session for the token: sql: no rows in result set" msg= api=/api/v2/users/me
debug [2022-09-13 17:37:08.732 Z] Command: AUTH                            caller="ws/server.go:149" client="192.168.1.81:50017"
debug [2022-09-13 17:37:08.732 Z] authenticateListener                     caller="ws/server.go:436" token=kezhxa1hjopy79jx71unks7iraa wsSession.userID=
error [2022-09-13 17:37:08.733 Z] ERROR WebSocket                          caller="ws/server.go:130" client="192.168.1.81:50017" error="read tcp 172.17.0.2:8000->192.168.1.81:50017: use of closed network connection"
debug [2022-09-13 17:37:08.733 Z] DISCONNECT WebSocket                     caller="ws/server.go:119" client="192.168.1.81:50017"
debug [2022-09-13 17:37:11.758 Z] Command: AUTH                            caller="ws/server.go:149" client="192.168.1.81:50019"
debug [2022-09-13 17:37:11.758 Z] authenticateListener                     caller="ws/server.go:436" token=kezhxa1hjopy79jx71unks7iraa wsSession.userID=
error [2022-09-13 17:37:11.758 Z] ERROR WebSocket                          caller="ws/server.go:130" client="192.168.1.81:50019" error="read tcp 172.17.0.2:8000->192.168.1.81:50019: use of closed network connection"
debug [2022-09-13 17:37:11.758 Z] DISCONNECT WebSocket                     caller="ws/server.go:119" client="192.168.1.81:50019"
debug [2022-09-13 17:37:14.785 Z] Command: AUTH                            caller="ws/server.go:149" client="192.168.1.81:50020"
debug [2022-09-13 17:37:14.785 Z] authenticateListener                     caller="ws/server.go:436" token=kezhxa1hjopy79jx71unks7iraa wsSession.userID=
error [2022-09-13 17:37:14.786 Z] ERROR WebSocket                          caller="ws/server.go:130" client="192.168.1.81:50020" error="read tcp 172.17.0.2:8000->192.168.1.81:50020: use of closed network connection"
debug [2022-09-13 17:37:14.786 Z] DISCONNECT WebSocket                     caller="ws/server.go:119" client="192.168.1.81:50020"

Hi Bloodshot_pico, welcome to the Mattermost forums and sorry for the late reply!

The problem here is that the database is inside the container and whenever you start the command again, it will create a new container with a new database file for you.
You can verify that by running docker ps -a, you will probably have more than one mattermost/focalboard container:

# docker ps -a
CONTAINER ID   IMAGE                                          COMMAND                  CREATED              STATUS                      PORTS                                                 NAMES
27efc59d17a9   mattermost/focalboard                          "/opt/focalboard/bin…"   12 seconds ago       Up 12 seconds               9092/tcp, 0.0.0.0:8065->8000/tcp, :::8065->8000/tcp   trusting_colden
5ba810676945   mattermost/focalboard                          "/opt/focalboard/bin…"   About a minute ago   Exited (2) 15 seconds ago                                                         quirky_shamir

In my example you can see that the container with ID 5ba810676945 has been stopped after I signed up and created a board there and the one with ID 27efc59d17a9 is a new one with an empty database.
There are several things you can do about that now. You can, f.ex., not pull a new version everytime but start the existing container (docker start 5ba810676945 in my case).
This will still not fix the issue that the focalboard.db database file is part of the container and when it goes poof, your data is gone too, so it’s not a bad idea to map the focalboard.db and there are several ways to do that. You could maybe use docker-compose to achieve that and there are some sample configurations available at the focalboard github space: