docker-library / wordpress

Docker Official Image packaging for WordPress
https://wordpress.org/
GNU General Public License v2.0
1.79k stars 1.07k forks source link

What's the reason of VOLUME-ing the `/var/www/html` #924

Closed ttodua closed 1 month ago

ttodua commented 1 month ago

I am about this line: https://github.com/docker-library/wordpress/blob/bd76dc3a667476fb94b7e6d10cfafb0aba40cc38/latest/php8.2/apache/Dockerfile#L172 should there be /usr/src/wordpress instead of /var/www/html, or is that intentional? if so, why does it volume that directory, if that dir is nowhere referenced/used in DOCKERFILE or entrypoint

tianon commented 1 month ago

See https://github.com/docker-library/wordpress/issues/6#issuecomment-51536740 -- in short, the whole of /var/www/html is the "WordPress-managed" directory. On initial container startup, we copy /usr/src/wordpress into it, and then it's expected that WordPress manages it directly via auto-update / updates through the UI. There are other issues that describe how to circumvent that behavior if you'd like a more "traditional" container experience where WordPress is updated via container redeployments, but I really cannot recommend that (those WordPress auto-updates are your primary line of defense against WordPress security issues).

tianon commented 1 month ago

As for why that specific directory, see the php image we're FROM for details (that's the default directory over there for both Apache and FPM variants).

ttodua commented 1 month ago

Thanks for reply!