gpt4 book ai didi

wordpress - Docker Wordpress 无法更新/安装插件

转载 作者:行者123 更新时间:2023-12-05 09:32:12 28 4
gpt4 key购买 nike

我按照 this giude 在容器中安装 wordpress 用于测试目的,但使用 mariadb 和 linux 作为主机。这是我的 docker-compose:

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: {}

现在我可以访问 wp-admin 仪表板,但无法更新/安装任何插件并出现错误:

Could not create directory.

here 所述,我尝试更改文件夹的权限但没有成功:

$ 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 {} \;

这是 ls -l

的输出
-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

我哪里错了?

最佳答案

获取docker容器名称

sudo docker ps
// output wordpress

与容器外壳交互

docker exec -it wordpress /bin/bash

给用户权限

chown -R www-data:www-data /var/www/html

退出外壳

exit

关于wordpress - Docker Wordpress 无法更新/安装插件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68343519/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com