Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No write permission and no other selectable languages #426

Closed
tanoxyz opened this issue Sep 3, 2019 · 3 comments
Closed

No write permission and no other selectable languages #426

tanoxyz opened this issue Sep 3, 2019 · 3 comments
Labels
question Usability question, not directly related to an error with the image

Comments

@tanoxyz
Copy link

tanoxyz commented Sep 3, 2019

Hi, I'm using this docker-compose.yml file

version: '3'
services:
        wordpress:
                image: wordpress
                restart: always
                ports:
                        - 80:80
                volumes:
                        - ./themes:/var/www/html/wp-content/themes/
                        - ./plugins:/var/www/html/wp-content/plugins/
                environment:
                        WORDPRESS_DB_HOST: mariadb
                        WORDPRESS_DB_USER: testuser
                        WORDPRESS_DB_PASSWORD: testpassword
                        WORDPRESS_DB_NAME: testdb
        mariadb:
                image: mariadb:10.1
                environment:
                        TZ: Europe/Madrid
                        MYSQL_ALLOW_EMPTY_PASSWORD: "no"
                        MYSQL_ROOT_PASSWORD: rootpwd
                        MYSQL_USER: testuser
                        MYSQL_PASSWORD: testpassword
                        MYSQL_DATABASE: testdb

But I can't update wordpress or install themes / plugins from the web interface.
I also cannot change to a language other than English.
Can these things not be done with this kind of images or am I doing something wrong?

@wglambert wglambert added Issue question Usability question, not directly related to an error with the image and removed Issue labels Sep 3, 2019
@wglambert
Copy link

So when just the subdirectories of wp-content/ are mounted it makes wp-content owned by root and docker-entrypoint.sh doesn't do a wordpress install as it detects present files and assumed the wp-content is fully populated, so languages are missing and the permissions on wp-content aren't appropriate which inhibits installing things to it.

However mounting wp-content and ensuring proper permissions works just fine

Also you'll probably want to persist the mariadb database to the host.
https://github.com/docker-library/docs/tree/master/mariadb#where-to-store-data

Changing the wordpress volume to:

volumes:
  - ./wp-content:/var/www/html/wp-content

Checking folders and permissions:

$ mkdir -p wp-content/{plugins,themes} && sudo chown -R 33:33 wp-content

$ docker-compose up -d
Creating network "test_default" with the default driver
Creating test_wordpress_1 ... done
Creating test_mariadb_1   ... done

$ time grep -qi 'apache2 -D FOREGROUND' <(docker-compose logs -f 2>&1)

real    0m20.986s
user    0m0.000s
sys     0m0.009s

$ docker exec test_wordpress_1 ls -al | grep wp-content
drwxrwxr-x  7 www-data www-data  4096 Sep  3 18:20 wp-content

$ docker exec test_wordpress_1 ls -al wp-content
total 32
drwxrwxr-x 7 www-data www-data 4096 Sep  3 18:20 .
drwxrwxrwx 5 www-data www-data 4096 Sep  3 18:18 ..
-rw-r--r-- 1 www-data www-data   28 Jan  8  2012 index.php
drwxrwxrwx 4 www-data www-data 4096 Sep  3 18:19 languages
drwxr-xr-x 3 www-data www-data 4096 Jun 18 17:50 plugins
drwxr-xr-x 5 www-data www-data 4096 Jun 18 17:51 themes
drwxrwxrwx 2 www-data www-data 4096 Sep  3 18:19 upgrade
drwxrwxr-x 3 www-data www-data 4096 Sep  3 18:19 uploads

And then trying with mounting just the subdirectories and ensuring permissions (your docker-compose file):

$ mkdir plugins themes && sudo chown 33:33 plugins themes

$ docker-compose up -d
Creating network "test_default" with the default driver
Creating test_mariadb_1   ... done
Creating test_wordpress_1 ... done

$ time grep -qi 'apache2 -D FOREGROUND' <(docker-compose logs -f 2>&1)

real    0m21.306s
user    0m0.000s
sys     0m0.009s

$ docker exec test_wordpress_1 ls -al | grep wp-content
drwxr-xr-x  4 root     root      4096 Sep  3 18:05 wp-content

$ docker exec test_wordpress_1 ls -al wp-content
total 20
drwxr-xr-x 4 root     root     4096 Sep  3 18:05 .
drwxrwxrwx 5 www-data www-data 4096 Sep  3 18:05 ..
-rw-r--r-- 1 www-data www-data   28 Jan  8  2012 index.php
drwxrwxr-x 3 www-data www-data 4096 Sep  3 18:05 plugins
drwxrwxr-x 5 www-data www-data 4096 Sep  3 18:05 themes

So this should be changed to specify that wp-content needs to be mounted along with its populated subdrectories if users want to mount them as such https://github.com/docker-library/docs/tree/master/wordpress#include-pre-installed-themes--plugins

@wglambert
Copy link

I think the issue is that WordPress says WordPress has been installed. Thank you, and enjoy! in the web install for each instance but doesn't do so since the wp-content is owned by root.

@tanoxyz
Copy link
Author

tanoxyz commented Sep 3, 2019

@wglambert Thank you very much, I have finally mount the wp-content and changed permissions, that has solved my problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Usability question, not directly related to an error with the image
Projects
None yet
Development

No branches or pull requests

2 participants