wordpress icon indicating copy to clipboard operation
wordpress copied to clipboard

Permission error on changing workdir with www-data user

Open sajjadG opened this issue 1 year ago • 2 comments

Following this solution https://github.com/docker-library/wordpress/issues/221#issuecomment-356457710 for changing wordpress to a subfolder, if I run the container with default user (root) everything works fine but if I set the user to anything else (whether the user exist in the image or not, or if the user has the permissions to the parent dir that the new dir is going to be created in), it can not create that dir and copy the wordpress files to it.

# docker run -it --rm wordpress ls -l /var/www/
total 4
drwxrwxrwt 3 www-data www-data 4096 Jun  7 07:37 html
# docker run -it --rm --user www-data -w /var/www/html/wordpress wordpress
WordPress not found in /var/www/html/wordpress - copying now...
tar: .: Cannot change mode to rwxr-xr-x: Operation not permitted
tar: ./wp-trackback.php: Cannot open: Permission denied
tar: ./wp-settings.php: Cannot open: Permission denied
tar: ./wp-load.php: Cannot open: Permission denied
tar: ./wp-config-sample.php: Cannot open: Permission denied
tar: ./wp-comments-post.php: Cannot open: Permission denied
tar: ./wp-admin: Cannot mkdir: Permission denied
tar: ./wp-admin: Cannot mkdir: Permission denied
tar: ./wp-admin/images: Cannot mkdir: No such file or directory
tar: ./wp-admin: Cannot mkdir: Permission denied
tar: ./wp-admin/images/post-formats32-vs.png: Cannot open: No such file or directory
...

sajjadG avatar Jun 07 '24 07:06 sajjadG