The README says to run:
The base image provides a specific WordPress version, but running sites can upgrade via the wp-admin dashboard or wp-cli, including pre-release versions:
wp core update --version=7.1-RC2
Versions can be rolled back by removing the Docker *_wp volume.
But that fails with permissions errors because /var/www/html is owned by root.
Workaround command:
docker compose exec -u root wordpress wp core update --allow-root --version=7.1-RC2
Possible fixes:
- Run all wp-cli commands as root
- Create a second
wp-cli:root script that runs docker compose with -u root
- Change ownership of the web directory and/or WordPress core files so the
wp user can update. This would probably happen in the entrypoint script.
I like the last one, but needs to be careful not to take over wp-content directories which are mounted user.
chown wp:wp /var/www/html
chmod 775 /var/www/html
The README says to run:
But that fails with permissions errors because
/var/www/htmlis owned by root.Workaround command:
docker compose exec -u root wordpress wp core update --allow-root --version=7.1-RC2Possible fixes:
wp-cli:rootscript that runsdocker composewith-u rootwpuser can update. This would probably happen in the entrypoint script.I like the last one, but needs to be careful not to take over
wp-contentdirectories which are mounted user.