Docker Backup best practices

Hi,
I’m testing the software and trying to backup and restore.

First of all, doing a backup from settings, creates a json file. Is this a backup of all the trades, all data or only partial app config?

Second, trying to backup entire database with command: “docker exec tradetally-db pg_dump -U trader tradetally > tradetally_backup_$(date +%Y%m%d).sql”, not working. System says:

”pg_dump: error: too many command-line arguments (first is “+%Y%m%d).sql”)
pg_dump: hint: Try “pg_dump --help” for more information.”

I understand that with entire database backup, there is all info, images, trades, etc.

With a Database backup, is it recommended to backup anything else? Docker volume backup is required? Container?

Thank you very much for your work.

The backup feature from the UI that gives you JSON will give you all of the account data, trades data, etc. for all users in the application.

Try this instead
docker exec tradetally-db pg_dump -U trader tradetally > “tradetally_backup_$(date +%Y%m%d).sql”

Thanks. I understant without any imagesb backup, correct?

(UI backup)

That is correct. You would need to do a separate file system backup if you want the images included.
docker cp tradetally-app:/app/uploads ./uploads_backup_$(date +%Y%m%d)

Hi,
Tried your command, system respond:

pg_dump: error: too many command-line arguments (first is “+%Y%m%d).sql””)
pg_dump: hint: Try “pg_dump --help” for more information.

Thanks

Hi, tried your command too, on Windows Server:

docker: ‘docker cp’ requires 2 arguments

Where are the images saved on docker?

Thanks.

For the DB:
docker exec tradetally-db pg_dump -U trader tradetally > “tradetally_backup_$(date +%Y%m%d).sql”

For the images:
docker cp tradetally-app-dev:/app/backend/uploads ./uploads_backup_$(date +%Y%m%d)

I had the images folder as the incorrect path at first.

I did also add a backup and restore script in the scripts folder on the github repo that you could try.

Hi,
Thank you very much for your effort.
My main OS is Windows Server, are .sh scripts able to run on Windows without any problem?

Thanks.

Oh I see. I am not sure about Windows

OK, wich linux os do you recommend, I’ll migrate.
Thanks.

I generally run Ubuntu 22.04 or 24.04

1 Like

Hi there,
Installed and tested on Ubuntu 24.04.4 and working fine. Thank you very much!

1 Like