WP in Docker – cannot install plugin or upgrade WP

The problem, as the error description indicates, is permissions. Based on that tutorial, nginx is running under the www-data user, but WP folders are owned by deployer. If you change the ownership of your $WP_ROOT to www-data:www-data, you will find that you can update your WP. I’m not amazing at security, so there may be a better way, but this one will work to get it updated. In the comment of the tutorial, they made this security change on purpose, so maybe it’s not a good idea. Not sure on that level of detail.

On top of this change, this update will not persist if you power down the docker instance. You’ll have to update your WP instance each time you restart the container. It might make sense to put the WP files into a volume so that WP can update the files as necessary, and that they persist. This would make sense also since the DB persists, and is part of the upgrade anyway. But these decisions on security are above my pay-grade.

Leave a Comment