If by βsafeβ you mean βconsistent,β then the exported archive will be a consistent file system .
The docker export , like any other classic backup method, will not solve the problem of application consistency.
Apache and Memcached will not be a problem, as they do not need storage to maintain any state.
But backing up Mysql in this way is likely to cause the database to reboot in recovery mode if you run the container from an image generated by docker export .
In particular, when backing up while performing a write operation (insert, update ..) as with any other backup at the file system level, you will lose several transactions.
If you need backup Mysql data files that should be 100% compatible and reflect the exact state of your data, you must either:
- Stop Mysql before starting
docker export - Stop the entire container
- Before running the export command, connect to Mysql and run
flush tables with read lock; . When the export is complete, you will need to run unlock tables; Files with backup data (usually under / var / lib / mysql) will be consistent. - Use classic mysql backup tools (
mysqldump ...)
mbarthelemy Jun 08 '14 at 9:30 a.m. 2014-06-08 09:30
source share