Error 524 - A timeout occurred

Yes, you can run a backup from the command line with

discourse backup

Inside the container. There are topics here about backup and restore from the command line.