Tools like docker-volume-backup and docker-backup do this but I’ve not tried them.

In theory this is generally straightforward: back up volumes and bind mounts which the containers use.

Databases

Doing a naive backup by copying the files for a database while its running could cause files to be inconsistent, so you should use the database’s dump tool instead to get a consistent copy (e.g, Mysqldump).

Its safe to do a copy while the database is not running.

There are also some tools to automate the process of doing regular database dumps:

MySQL