Moving to docker

Currently I run erp-next in a virtual machine with the mysql database on the same virtual machine.

I’m looking to move to a docker version of erpnext. What would be the implication with regards to the migration? Can I just backup the mys database and point to that one from the erpnext docker (running mysql in a separate container)? I only did some customization on the documents and such, no python code changes etc.

Would launching the same version of erpnext, in a docker, with the data backup, simply work, or am I overlooking some things?

If you’ve customized doctypes using the customize form tool (rather than editing doctypes directly in development mode), everything should transfer fine. Just take a backup, including public/private files, and load the backup using the restore bench command.

https://www.frappeframework.com/docs/user/en/bench/reference/restore

3 Likes

Thanks for your response. Much appreciated. Will try this weekend.

if your DB is reasonable, you can use this method.

DB and file(s) size matters here because it will backup all files, push to S3 compatible storage, download files from storage and restore automatically using the scripts

1 Like

Sorry to come back on this one. Im not completely sure from the documentation how to go about. Is there a step by step script?

Because I also dont have S3 storage.

Perhaps anybody availbale to support thos migration (against compensation)?

Moving a site.

  1. Take bench --site {site-name} backup --with-files on the running setup.
  2. Copy files from sites/{site-name}/private/backups to new server and optionally stop old server so users don’t create new data.
  3. In case of container setup copy files from server into container using docker cp or placing files in volume location.
  4. Enter any worker container and create site using bench new-site --no-mariadb-socket command. Name the site as per configured domain name. (Note down the db_name from site_config.json created)
  5. Enter mariadb container / use mysql client and execute drop database {db_name}; create database {db_name}. This will clean the site db that was created by new site. We do this so that we have a running site configured without any database resulting in Internal Server Error.
  6. In mysql shell execute, use {db_name}; source /path/to/database.sql. This will restore the database from backup on fresh db. We use source from mysql shell as it re-connects in case of disconnection or timeout during restoration of huge database. Simple alternate command will be mysql -uroot -p{root-password} -h{hostname} {db_name} < /path/to/database.sql
  7. Copy additional keys and encryption_key from backed up site_config.json. (Note, DO NOT change the db_name, db_password keys from newly created site, only copy other keys from backup site_config)
5 Likes

Thanks for the extensive explanation. Going to give it a go.

I’ve tried migrating from easyinstall to docker a few times, but always seem to end up with an internal server error.

I’ve setup a docker host and have a running site using the basic docker compose -f pwd.yml up -d.
I’ve taken a backup on my old instance and copied al the files into the docker containers and followed the steps above including the --no-mariadb-socket flag.

Everything goes perfectly according to plan as long as I use the frontend site name ( i think the nginx config relies on this). I am able to install hmrs and run bench migrate without errors, but I’m left with an Internal Server Error. The db log reports

2025-09-09 18:37:16 0 [Note] mariadbd: ready for connections.

Version: '10.6.23-MariaDB-ubu2204'  socket: '/run/mysqld/mysqld.sock'  port: 3306  mariadb.org binary distribution

2025-09-09 18:37:17 4 [Warning] Aborted connection 4 to db: 'unconnected' user: 'unauthenticated' host: '172.18.0.6' (This connection closed normally without authentication)

2025-09-09 18:37:18 7 [Warning] Aborted connection 7 to db: '_5e5899d8398b5f7b' user: '_5e5899d8398b5f7b' host: '172.18.0.6' (Got an error reading communication packets)

2025-09-09 18:38:55 9 [Warning] Aborted connection 9 to db: '_5e5899d8398b5f7b' user: '_5e5899d8398b5f7b' host: '172.18.0.6' (Got an error reading communication packets)

2025-09-09 20:20:38 504 [Warning] Aborted connection 504 to db: '_5e5899d8398b5f7b' user: '_5e5899d8398b5f7b' host: '172.18.0.3' (Got an error reading communication packets)

2025-09-09 20:20:49 532 [Warning] Aborted connection 532 to db: 'unconnected' user: 'unauthenticated' host: '172.18.0.3' (This connection closed normally without authentication)

2025-09-09 20:28:09 757 [Warning] Aborted connection 757 to db: 'unconnected' user: 'root' host: '172.18.0.3' (Got timeout reading communication packets)

I’ve also tried docker exec-ing into the container and running the bench restore... --with-files... and the restore succeeds but still the Internal Server Error.

I feel like the issue has something to do with nginx, but i can’t seem to spot the issue. I’ve also tried bench set-nginx-port without success.

Any suggestions would be appreciated if anyone has successfully migrated from an easy-install setup to a frappe_docker setup.

Check this frappe_docker/docs/troubleshoot.md at main · frappe/frappe_docker · GitHub

Thanks @revant_one
I gave it a go and was able to get past the database issues since I am receiving email notifications from this new instance, but I just can’t seem to get to the web interface. I think my old instance was configured to use port 80 and the new docker containers seem to be using port 8080.

I’ve tried bench migrate afterward and it seems to succeed, but still ‘Internal Server Error’
If i curl localhost:8080 from within the container and from the host i still get “Internal Server Error”. I’m not sure where to go from here.

Also, after I docker compose up -d again, the newly bench get-app ... apps are no longer there.
I’m probably missing something, but how do we install apps using this docker method?
Do we have to build our own containers? ← It seems like the answer to this is yes based on FAQ

My end goal is to setup a frappe_docker instance that i can run bench restore on and restore the site data from an easy_installed instance. I feel so close!!!

  1. Check existing versions in running system
  2. Build image using above versions
  3. Restore database. (You can just MySQL shell to restore as well). Check various posts on restore on this forum
  4. bench --site all migrate

Above should work.