I have the docker-compose file at the end of the post
In this file I create a volume to link the custom theme folder.
When I try to run a wp-cli command in a CONTAINER - CLI I have a permission problem because the folder wp-content is owned by root and the container is run as user xfs.
In the CONTAINER - WORDPRESS we can see that the wp-content folder is also owned by root.
But when I unlink my custom theme folders this issue no longer happens.
it is possible to see in the CONTAINER - CLI that the owner of the wp-content folder is xfs as it is correct, as well as in the WORDPRESS - CONTAINER the wp-content folder also belongs to the user www-data as it should be.
This is mine docker-compose.yml
version: "3.9"
services:
wordpress:
image: wordpress:5.2.1-php7.3
environment:
WORDPRESS_DB_HOST: database:3306
WORDPRESS_DB_NAME: ${MYSQL_DATABASE}
WORDPRESS_DB_USER: ${MYSQL_USER}
WORDPRESS_DB_PASSWORD: ${MYSQL_PASSWORD}
WORDPRESS_TABLE_PREFIX: ${WORDPRESS_TABLE_PREFIX}
WORDPRESS_DEBUG: ${WORDPRESS_DEBUG:-false}
env_file: .env
restart: always
volumes:
- ./wp:/var/www/html # Full wordpress project
- ./theme:/var/www/html/wp-content/themes/custom-theme # Theme development
ports:
- ${WORDPRESS_PORT}:80
depends_on:
- database
cli:
image: wordpress:cli-2.3.0
env_file: .env
user: xfs
depends_on:
- database
- wordpress
volumes:
- ./wp:/var/www/html
database:
image: mariadb:10.5.9
environment:
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
MYSQL_DATABASE: ${MYSQL_DATABASE}
MYSQL_USER: ${MYSQL_USER}
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
restart: always
volumes:
- db_data:/var/lib/mysql
healthcheck:
test: mysqladmin ping -h 127.0.0.1 -u root --password=${MYSQL_PASSWORD}
interval: 5s
retries: 5
manage:
image: phpmyadmin:5
environment:
PMA_HOST: database
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
ports:
- ${MANAGE_PORT}:80
restart: always
depends_on:
database:
condition: service_healthy
volumes:
db_data:
wp_data: