Let’s see how to perform the backup and restore for snipeit.
Follow these steps to backup the Snipe-IT database:
Creating a database backup
Access the snipe-it_snipedb_1 container:
docker exec -it -u root snipe-it_snipedb_1 /bin/bash
Extract a dump of the database using the command:
mysqldump -u snipeit -p snipeit > var/lib/mysql/dump_file.sql
Access the volume on the host and save the dump to a secure location:
cd /var/lib/docker/volumes/snipe-it_db/_data/
Database Restoration
Use the dump extracted in the previous step.
Access the snipe-it_snipedb_1 container:
docker exec -it -u root snipe-it_snipedb_1 /bin/bash
Execute the command to import the backup from the dump file:
mysql -uroot -p snipeit < var/lib/mysql/dump_file.sql
Leave a Reply