In this video we’ll cover how to backup files from your docker container as well as a MySQL database. This is done with an installation of WordPress.
Original source
Link to this post!
In this video we’ll cover how to backup files from your docker container as well as a MySQL database. This is done with an installation of WordPress.
Original source
11 responses to “Docker Tutorial: Backing Up and Restoring MySQL and WordPress in Docker”
what is difference between this tutorial process, and simply doing a docker export (contianer id) for the wordpress container and mysql container?
Nice one….it helped… on;y if you have used non default user name and DB name that would be perfect from security point….
Excellent tutorial, This is all I needed to create a new wordpress from existing wordpress container. I like the simple approach; no fancy tools are involved. Of-course it can be automate using tools like Ansible or similar. Thanks again 🙂
Hey
Im currently getting rather nuts since im trying to get this thing in to a cronjob:
shouldn't it be something like:
docker run –rm -v $(pwd):/backups/ –link=mywrodpress_db_1:dz mysql /usr/bin/mysqldump –host$DZ_PORT_3306_TCP_ADDR -uroot -psecret wordpress > /backups/wordpress.sql
I have seen other people doing it with already fixed containers but now im to stubborn…
I can't get it to use my DZ_PORT_3306_TCP_ADDR variabel…
How do get it to use it's own variabel?
Since it's already linked i shouldn't have to define a -e DZ_PORT_3306_TCP_ADDR, half the point is to use the linked one ^^
For scripting reasons I'd lean on the "exec" option. For a mysql dump from your host just run something like
docker exec wpfig_db_1 mysqldump –all-databases –password=secret > /backups/wordpress.sql
Should result in you having your .sql file where you expect it 🙂 Keep up the vid's they're a great help!
As someone who's just getting started with Docker, this was a terrific tour through basic navigation of containers. I'm going to put this to good use as I figure out how to migrate my local WordPress sites to containers
Doood – if you could create a video about how to create Mid-High level videos – the world could benefit from thiis. 🙂
after running the below command… why would the var/www/html directory be empty?
docker run -it –rm -v $(pwd):/backups –volumes-from=wpfig_file_1 busybox
Would it be possible to map the file system to some container that supports incremental file system (preventing possible issues that could arrise if a user is working on the WP environment, between the dumping of the sql and the backup of the files)?
Thanks for this tutorial. You've helped me understand a great deal. Now I have to learn fig.
It would be great if you could show us a diagram like on the "Setting Up a WordPress Site Using Docker" that diagram really helped. It is a little difficult to mentally map what you are doing ( going in to container, exporting mysql, sharing volumes…)