Here is are the original files in the Wordpress Docker container on path /var/www/html
:
$ docker exec 5b957c7b9c5ad054883694afbfb80d3c9df6707458d55011f471be0701f3890c ls -l
total 192
-rw-r--r-- 1 www-data www-data 418 Sep 25 2013 index.php
-rw-r--r-- 1 www-data www-data 19935 Jan 2 18:51 license.txt
-rw-r--r-- 1 www-data www-data 7433 Jan 11 17:46 readme.html
-rw-r--r-- 1 www-data www-data 5447 Sep 27 2016 wp-activate.php
drwxr-xr-x 9 www-data www-data 4096 May 16 21:50 wp-admin
-rw-r--r-- 1 www-data www-data 364 Dec 19 2015 wp-blog-header.php
-rw-r--r-- 1 www-data www-data 1627 Aug 29 2016 wp-comments-post.php
-rw-r--r-- 1 www-data www-data 2764 May 29 22:19 wp-config-sample.php
-rw-r--r-- 1 www-data www-data 3148 May 29 22:19 wp-config.php
drwxr-xr-x 4 www-data www-data 4096 May 16 21:50 wp-content
-rw-r--r-- 1 www-data www-data 3286 May 24 2015 wp-cron.php
drwxr-xr-x 18 www-data www-data 12288 May 16 21:50 wp-includes
-rw-r--r-- 1 www-data www-data 2422 Nov 21 2016 wp-links-opml.php
-rw-r--r-- 1 www-data www-data 3301 Oct 25 2016 wp-load.php
-rw-r--r-- 1 www-data www-data 33939 Nov 21 2016 wp-login.php
-rw-r--r-- 1 www-data www-data 8048 Jan 11 05:15 wp-mail.php
-rw-r--r-- 1 www-data www-data 16255 Apr 6 18:23 wp-settings.php
-rw-r--r-- 1 www-data www-data 29896 Oct 19 2016 wp-signup.php
-rw-r--r-- 1 www-data www-data 4513 Oct 14 2016 wp-trackback.php
-rw-r--r-- 1 www-data www-data 3065 Aug 31 2016 xmlrpc.php
I am trying to start the Wordpress container with a mounted Docker volume to be able to store the custom files persistently:
$ sudo docker run -p 80:80 --link some-mysql:mysql -v /var/www:/var/www/html --name docker-wordpress -d wordpress
The problem is that even when exactly replicating the ownership and priviledges on local files in /var/www
:
$ sudo chown -R www-data:www-data /var/www
$ sudo find /var/www/ -type d -exec chmod 755 {} \;
$ sudo find /var/www/ -type f -exec chmod 644 {} \;
I am still getting an error of this kind, when running Wordpress inside the container:
Could not create directory
How to set the privileges properly to make sure Wordpress is able to write into the mounted Docker volume?