0
WordPress is running inside a Docker container. I want to create a separate image which will use cron
to automatically create the backup of WordPress files and database. I am confused that what is the best way to access files inside the Docker container in another image using a bash script.
I dont want to mount the volume to host, i am creating a script that will zip the file to sftp server and then delete the zip file. – Web – 2019-07-16T11:51:21.520
1Just suggesting the proper way to do things. You may want to do it otherwise but then you may want to think how to get the data back in the container (or in a new container...). – xenoid – 2019-07-16T12:03:27.257
@Web Do yourself a favor and follow this advice. Don't let the WordPress data stay in the container. If the container gets removed or has to be rebuilt, all your data is lost. Also, no other container can access it. The same for the database: provide a separate volume which can be persisted across container runs, and access it from both the WordPress container as well as the one that runs the backups. – slhck – 2019-07-16T13:37:21.033
@slhck the problem is that i copying custom wordpress theme using dockerfile. when i mount the volume on host, theme file is overrided by empty files from the host, thats why i mounted the volume in container instead of host. and i am creating continous backups so that if i had a problem , i can re run from the backup. – Web – 2019-07-16T13:50:58.257
1@Web You have to first mount the volume (e.g.
./data
to/var/www/html
, and then install the theme. The theme then stays persisted on your host (in./data
). – slhck – 2019-07-16T13:56:14.587