1

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:
Rice_Crisp
  • 1,242
  • 1
  • 16
  • 33
  • I think this has something to do with ownership of the wp-content folder. When I was in the wp instance I noticed that all files were owned by "www-data" except wp-content which was owned by root. When I was in the wpcli instance, all files were owned by "xfs" except wp-content which was also owned by root. – Rice_Crisp Jan 31 '20 at 20:59
  • I added `- ./wp-content/:/var/www/html/wp-content/` to my wpcli volumes and that fixed it, but I'm getting some php warnings now. – Rice_Crisp Jan 31 '20 at 21:36

1 Answers1

2

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.

Rice_Crisp
  • 1,242
  • 1
  • 16
  • 33