Docker Wordpress can't update/install plugins

admin

Administrator
Staff member
I followed <a href="https://docs.docker.com/samples/wordpress/" rel="nofollow noreferrer">this</a> giude to install wordpress in a container for test purposes but using
Code:
mariadb
and linux as a host. Here is my docker-compose:
Code:
version: '3.8'

services: 
    database:
        image: mariadb
        restart: always
        environment: 
            MYSQL_ROOT_PASSWORD: password
            MYSQL_DATABASE: wordpressDB
            MYSQL_USER: user
            MYSQL_PASSWORD: password
        volumes:
            - mysql:/var/lib/mysql
    
    wordpress:
        depends_on: 
            - database
        links: 
            - database
        image: wordpress:latest
        restart: always
        ports: 
            - '8000:80'
        environment: 
            WORDPRESS_DB_HOST: database:3306
            WORDPRESS_DB_USER: user
            WORDPRESS_DB_PASSWORD: password
            WORDPRESS_DB_NAME: wordpressDB
        volumes: 
            - ./wordpress:/var/www/html
            - ./wordpress/plugins:/var/www/html/wp-content/plugins
            - ./wordpress/themes:/var/www/html/wp-content/themes
            - ./wordpress/uploads:/var/www/html/wp-content/uploads
            - ./wordpress/wp-content:/var/www/html/wp-content

volumes: 
    mysql: {}
For now I can access the
Code:
wp-admin
dashboard but can't update/install any plugin with error:
Code:
Could not create directory.
As mentioned <a href="https://stackoverflow.com/questions...-could-not-create-directory-on-mounted-volume">here</a> I've tried to change the permissions of the folders but with no success:
Code:
$ mkdir /var/www/html/wp-content/plugins
$ mkdir /var/www/html/wp-content/uploads
$ chown -R www-data:www-data /var/www
$ find /var/www/ -type d -exec chmod 0755 {} \;
$ find /var/www/ -type f -exec chmod 644 {} \;
Here is the output from
Code:
ls -l
Code:
-rwxrwxr-x 1 1000 985   405 Jul 12 06:30 index.php
-rwxrwxr-x 1 1000 985 19915 Jul 12 06:30 license.txt
drwxrwxr-x 1 1000 985     0 Jul 12 06:30 plugins
-rwxrwxr-x 1 1000 985  7345 Jul 12 06:30 readme.html
drwxrwxr-x 1 1000 985     0 Jul 12 06:30 themes
drwxrwxr-x 1 1000 985     0 Jul 12 06:30 uploads
-rwxrwxr-x 1 1000 985  7165 Jul 12 06:30 wp-activate.php
drwxrwxr-x 1 1000 985 20480 Jul 12 06:30 wp-admin
-rwxrwxr-x 1 1000 985   351 Jul 12 06:30 wp-blog-header.php
-rwxrwxr-x 1 1000 985  2328 Jul 12 06:30 wp-comments-post.php
-rwxrwxr-x 1 1000 985  5456 Jul 12 06:30 wp-config-docker.php
-rwxrwxr-x 1 1000 985  2913 Jul 12 06:30 wp-config-sample.php
-rwxrwxr-x 1 1000 985  5592 Jul 12 07:03 wp-config.php
drwxrwxr-x 1 1000 985     0 Jul 12 06:30 wp-content
-rwxrwxr-x 1 1000 985  3939 Jul 12 06:30 wp-cron.php
drwxrwxr-x 1 1000 985 40960 Jul 12 06:30 wp-includes
-rwxrwxr-x 1 1000 985  2496 Jul 12 06:30 wp-links-opml.php
-rwxrwxr-x 1 1000 985  3313 Jul 12 06:30 wp-load.php
-rwxrwxr-x 1 1000 985 44994 Jul 12 06:30 wp-login.php
-rwxrwxr-x 1 1000 985  8509 Jul 12 06:30 wp-mail.php
-rwxrwxr-x 1 1000 985 21125 Jul 12 06:30 wp-settings.php
-rwxrwxr-x 1 1000 985 31328 Jul 12 06:30 wp-signup.php
-rwxrwxr-x 1 1000 985  4747 Jul 12 06:30 wp-trackback.php
-rwxrwxr-x 1 1000 985  3236 Jul 12 06:30 xmlrpc.php
Where am I mistaken?