Thanks for the feedback. For the files I might just go with Dropbox sync as you are saying it shouldn’t impact performance.
For the db I think a docker container backup (and restore) sounds good. I just did some reading about it and tried it out but I’m running into some issues.
First of all, I wasn’t entirely sure which container to backup to make sure I backup any database changes/updates. I assumed this is the “devkinsta_db” container (which is running the mariadb:10.5.5 image), is that correct?
I can make a snapshot of it using this command in Windows Powershell:
docker commit -p devkinsta_db devkinsta_db_backup
I can save it to the drive of my Windows machine for example then using:
docker save -o C:\Temp\devkinsta_db_backup.tar devkinsta_db_backup
After that, I got stuck though when trying a restore. First, I stopped and removed the current container using:
docker stop devkinsta_db
docker rm devkinsta_db
Then I wanted to run the container again from my “backup image”. (in reality you might need to restore the image first from the .tar file but I skipped that step for now as a first test)
I tried the following, to run it detached and with the correct container name:
docker run -d --name devkinsta_db devkinsta_db_backup
Which didn’t work in the sense that the local test website was not loading after that and returning an error page related to no connection to mysql/mariadb.
I thought the issue might be in the port config and I tried also:
docker run -d --name devkinsta_db devkinsta_db_backup -p 0.0.0.0:15100:3306/tcp
which also didn’t work, with this latter command it seemed that the container didn’t even start properly as it doesn’t show when using:
After that I also tried simply to close DevKinsta after removing the devkinsta_db container via Powershell, and then restarting DevKinsta after that. It then starts/runs automatically the devkinsta_db container again and the local website is loading again. However, it is loading including my most recent change, which was a simple update in one post in Wordpress to see if I could restore to the state of the db from before I made that change.
My questions are:
- Is taking a snapshot of the “devkinsta_db” container and restoring it the right approach to backup and restore the database?
- What is the correct run command to properly run the container when restoring from a backup image?
- Anything else that I’m doing wrong?