Mattermost migration from mattermost-docker to a Linux-based operating systems

We are using mattermost-docker for Team Collaboration in our company. Now, we need to switch to a Linux-based operating systems without docker and how can I migrate all data and user from mattermost-docker with postgres database to normal mattermost with mysql database. I’ve tried looking into migration guide but it’s not helping me at all.

Hi @pravin,
if you’re switching Databases your best bet would be the bulk exporter.

Best regards,

1 Like

Thank you @sven.huester , will it export everything from team, users and data?

it should export every team channel and post as well as all users (inactive, active and bot users) as well as attachment data. Feel free to reach out here again in case you run into any issues.

But I cannot do so on docker container. I’m new to docker and when I run the command it cannot connect to database because database is located in different container with different environment.

What docker image did you use to create the deployment?
And also what command are you running for the export?

I cloned mattermost-docker from
and used docker-compose to set it up. Now, there are 3 containers

  1. mattermost-docker_app
  2. mattermost-docker_db
  3. mattermost-docker_web

so I go to the mattermost-docker_app conatainer and go to /bin and run
./mattermost export bulk file.json --all-teams
no sudo because sudo wasn’t working and I got error connecting to database. Ofcourse there would be error because it is in another container

You need to run the command from the /mattermost directory and it should look like this:

bin/mattermost export bulk bulk-export.jsonl

1 Like

Thank you for your reply @sven.huester.
That would work on normal mattermost setup but I need some docker expertise.
That command won’t work on docker because there’s no mattermost directory. It is managed in container

As you can see from the attached image the command runs just fine on that exact docker install you mentioned. (disregard the 2> /dev/null that is only used to surpress the log messages during the import for this screenshot)

1 Like

I’m getting this error

is your Mattermost still running? If you can’t connect to the database then the install shouldn’t work too. Did you change the database connection string?

My mattermost is still running. I haven’t changed anything at all. I just cloned and built image for docker with default configurations.

Then please show the output of docker network list and then docker inspect $(docker network list | grep -i mattermost | cut -f1 -d ' ')

The output for docker network list:


The Output for $(docker network list | grep -i mattermost | cut -f1 -d ’ '):

[ { "Name": "mattermost-docker_default", "Id": "af2b59d5cbed180a7dec93e94e0f3faa635b188587fa111dc4ea6b81cb17a7cc", "Created": "2019-11-03T04:49:44.909116597Z", "Scope": "local", "Driver": "bridge", "EnableIPv6": false, "IPAM": { "Driver": "default", "Options": null, "Config": [ { "Subnet": "", "Gateway": "" } ] }, "Internal": false, "Attachable": true, "Ingress": false, "ConfigFrom": { "Network": "" }, "ConfigOnly": false, "Containers": { "849b741fc050daeec5b491f8c90753768c564cd6619c77ec4ca00b67dd639d2c": { "Name": "mattermost-docker_app_1", "EndpointID": "0187b211cb6f89eb01384e6b0b53e8ccb576e9f885101b39da5b57f062a25d92", "MacAddress": "02:42:ac:13:00:02", "IPv4Address": "", "IPv6Address": "" }, "872fd3993fa293661aab10c6239fe857862d05c0d41bd7f292bfb9326651b3b6": { "Name": "mattermost-docker_db_1", "EndpointID": "a9bb5aef5097ee531b88df0ffdaeb36908fd769b96f546b3fc40428d952693f6", "MacAddress": "02:42:ac:13:00:04", "IPv4Address": "", "IPv6Address": "" }, "c718cce97d842c20815e9a5625db8c5858889c4e48728ddbd87459a4ddfca37b": { "Name": "mattermost-docker_web_1", "EndpointID": "eaba264c82ee6451ffc76c77f6f75d65423f3bd9ec743cc85e05c6bdf4d28bdb", "MacAddress": "02:42:ac:13:00:03", "IPv4Address": "", "IPv6Address": "" } }, "Options": {}, "Labels": { "": "default", "com.docker.compose.project": "mattermost-docker", "com.docker.compose.version": "1.24.1" } } ]

According to the output it can’t work if Mattermost tries to connect to the db on localhost. The containers are in the same docker network but are separated like different computers in an physical network. In the mattermost-docker config Mattermost will connect to db:5432 (DNS is working inside docker netwroks) but your Mattermost tries to connect to Can you please share the redacted connection string from your config.json? If you used the environment variable in the docker-compose.yml then the variable.

This is my docker-compose.yml file
context: app
# uncomment following lines for team edition or change UID/GID
# args:
# - edition=team
# - PUID=1000
# - PGID=1000
restart: unless-stopped
- ./volumes/app/mattermost/config:/mattermost/config:rw
- ./volumes/app/mattermost/data:/mattermost/data:rw
- ./volumes/app/mattermost/logs:/mattermost/logs:rw
- ./volumes/app/mattermost/plugins:/mattermost/plugins:rw
- ./volumes/app/mattermost/client-plugins:/mattermost/client/plugins:rw
- /etc/localtime:/etc/localtime:ro
# set same as db credentials and dbname
- MM_DBNAME=*****
# in case your config is not in default location
#- MM_CONFIG=/mattermost/config/config.json

build: web
- “80:80”
- “443:443”
read_only: true
restart: unless-stopped
# This directory must have cert files if you want to enable SSL
- ./volumes/web/cert:/cert:ro
- /etc/localtime:/etc/localtime:ro
# Uncomment for SSL


I don’t know what version you use but as far as i can see the db configuration only lives in the config.json. Can you paste the corresponding redacted line?

“SqlSettings”: {
“DriverName”: “postgres”,
“DataSource”: “user:pass@tcp(localhost:3306)/mattermost_test?charset=utf8mb4,utf8\u0026readTimeout=30s\u0026writeTimeout=30s”,
“DataSourceReplicas”: ,
“DataSourceSearchReplicas”: ,
“MaxIdleConns”: 20,
“ConnMaxLifetimeMilliseconds”: 3600000,
“MaxOpenConns”: 300,
“Trace”: false,
“AtRestEncryptKey”: “somerandomkey”,
“QueryTimeout”: 30