Skip to content

Commit 16e9448

Browse files
committed
fix(restore): chown wp-content to uid 1000 after docker cp
docker cp copies files owned by root. PHP-FPM in the Minimus image runs as uid=1000 (wordpress) and cannot write to root-owned directories, causing plugin/theme updates to fail with 'Could not create directory'. Fix: after docker cp, exec into the container as root to chown and chmod the wp-content tree (dirs 755, files 644, owner 1000:1000). Applied to both remote_restore() and local_restore().
1 parent 2d89a00 commit 16e9448

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

  • wordpress-docker/sites/burnedout-xyz/scripts

wordpress-docker/sites/burnedout-xyz/scripts/restore.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,9 @@ local_restore() {
107107
WP_CONTAINER="$(docker compose -f compose.local.yaml ps -q wordpress)"
108108
docker cp "${restore_dir}/wp-content" "${WP_CONTAINER}:/var/www/html/"
109109
fi
110+
# Fix ownership and permissions — docker cp copies as root; PHP-FPM runs as uid 1000
111+
docker exec -u root "$WP_CONTAINER" sh -c \
112+
"chown -R 1000:1000 /var/www/html/wp-content && find /var/www/html/wp-content -type d -exec chmod 755 {} + && find /var/www/html/wp-content -type f -exec chmod 644 {} +"
110113
echo " ✓ wp-content restored"
111114

112115
echo "==> Starting full stack..."
@@ -185,6 +188,9 @@ fi
185188
186189
echo "==> Restoring wp-content..."
187190
docker cp "${RESTORE_DIR}/wp-content" "${PROJECT_NAME}-wordpress-1:/var/www/html/"
191+
# Fix ownership and permissions — docker cp copies as root; PHP-FPM runs as uid 1000
192+
docker exec -u root "${PROJECT_NAME}-wordpress-1" sh -c \
193+
"chown -R 1000:1000 /var/www/html/wp-content && find /var/www/html/wp-content -type d -exec chmod 755 {} + && find /var/www/html/wp-content -type f -exec chmod 644 {} +"
188194
echo " ✓ wp-content restored"
189195
190196
echo "==> Starting stack..."

0 commit comments

Comments
 (0)