Migrate Mastodon from non Docker to Docker

Hey guys,

I have my instance running on a single server, the standalone way. I would like to know if there is a howto to migrate it to a docker based architecture ?
I tried to do so, running into problems because of the Pgsql database. As I already have my DB and DB-user, which are not the same as the docker ones.


Hey @dada,

I just completed a non-docker to docker migration (on a different host as well).

Migrating the database wasn’t that bad. I followed the general steps of:

  • pg_dump mastodon_production > dump.sql
  • make sure that your docker-compose.yml is configured to use a data volume for the db
  • move dump.sql (scp or rsync)
  • cat dump.sql | docker-compose run --rm db psql -U postgres
  • make sure that the username and host are correct in docker-compose.yml (i just needed to change the name of the database to mastodon_production

Might be a little late for this reply, but it might help someone in the future.