I’m using docker-compose to install wordpress. I see different approaches:
– the official documentation doesn’t create any volume at all so an update of wordpress will just delete your wp_content data
– creating a volume with /var/www/html/wp_content (and the database) which I understand being the right way as all changes are there and when updating wordpress by pulling the new images, everything else will be properly replaced with the new version
– creating a volume with /var/www/html in which case updating the docker image to the latest version will not update the wordpress files themselves. So I have the impression this isn’t the right approach, or you should not update the image but update wordpress from it’s built-in admin interface, I’m not sure.
I’m surprised to see so many examples using the third approach but also that adding wp-cli needs to share the whole wordpress volume with the cli container so in that case only the third approach could work for wp-cli but the second approach looks to be the right one to me. I’m probably missing something, could someone help clarify?