In this document we're going to explain how to backup the data (database and files) of a Team Password Manager installation in Docker containers.
For reference, here's our general backup document: How to make a backup of Team Password Manager
Backing up the database
If your database runs in a Docker container, which is the case if you're using Docker Compose, execute this command from the host to make a backup copy of your Team Password Manager database:
docker exec -it mysql_container mysqldump -utpm_user -ptpm_password tpm_database > backup_file.sql
Where:
mysql_containeris the container that runs the database. You can see the running containers in your system with this command:docker ps.tpm_databaseis the Team Password Manager database.tpm_userandtpm_passwordare the credentials of the user that has access to thetpm_database.
Basically this command executes mysqldump inside the container and returns the backup_file.sql to the host.
Backing up the files
Execute this command from the host to copy the software files (including the uploads folder) into the host:
docker cp teampasswordmanager_container:/var/www/html/site/. ./backup/
Where teampasswordmanager_container is the container that runs Team Password Manager. You can see the running containers in your system with this command: docker ps.
This command copies the /var/www/html/site/ folder and its subfolders and files to the host, in the backup folder in the current folder. This copies all the software files, if you want to copy only the uploads folder, use this instead:
docker cp teampasswordmanager_container:/var/www/html/site/uploads/. ./backup/
Document changelog
| Nov 18, 2020: | Document created |