I've connected my wpcli container to my wp container, but only some functionality works. I can edit posts, menus, etc., but themes and plugins are not working. If I run docker-compose run --rm wpcli wp theme list
or docker-compose run --rm wpcli wp plugin list
I get an empty table. Some similar question answers have recommended setting attributes -u 33 -e HOME=/tmp
or setting user: xfs
in the docker-compose file, but it doesn't seem to help. Any direction would be appreciated.
Here's my docker-compose.yml file:
version: "3.7"
services:
db:
image: mysql:5.7
restart: always
environment:
MYSQL_ROOT_PASSWORD: password
ports:
- "3306:3306"
volumes:
- db_data:/var/lib/mysql
networks:
- back
wp:
image: wordpress:latest
depends_on:
- db
restart: always
ports:
- "80:80"
environment:
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_PASSWORD: password
WORDPRESS_DEBUG: 1
volumes:
- ./wp-content/:/var/www/html/wp-content/
- wp_data:/var/www/html/
networks:
- back
wpcli:
image: wordpress:cli
volumes:
- wp_data:/var/www/html
networks:
- back
networks:
back:
volumes:
db_data:
wp_data:
Figured it out. Added ./wp-content/:/var/www/html/wp-content/
to the volumes. Docker defaults any named volumes to root, so by binding it dropped the root owner.