Here's the docker-compose.yml file I use to bootstrap WordPress:
version: "3"
services:
wordpress:
image: wordpress
ports: ["80:80"]
volumes: ["wp_test:/var/www/html"]
environment:
WORDPRESS_DB_NAME: wordpress
WORDPRESS_DB_USER: root
WORDPRESS_DB_PASSWORD: secret
mysql:
image: mysql
environment:
MYSQL_ROOT_PASSWORD: secret
cli:
image: wordpress:cli
volumes: ["wp_test:/var/www/html"]
command: sh -c "sleep 20 && wp core install --path=/var/www/html --url=localhost --title=test --admin_user=test --admin_password=test [email protected]"
volumes:
wp_test:
I start it with docker-compose up and when wp-cli sets up the installation, there is a warning:
cli_1 | Warning: Unable to create directory wp-content/uploads/2018/02. Is its parent directory writable by the server?
So, WP-CLI in cli container is not able to manipulate files on the volume attached to the main wordpress container.
I'm running docker compose 1.18.0 and and docker engine 17.12.0-ce on a mac.
馃憤 Having the same exact problem myself in the same environment.
I see! Thank you.
So this looks like the same issue reported in https://github.com/docker-library/wordpress/issues/256. I was able to work around this temporarily by running commands as the specific user ID 33, which is normally associated with www-data, but is actually xfs in the cli image.
docker-compose run -u 33 ...
So I'll close this as a duplicate, let's continue in #256.
Most helpful comment
I see! Thank you.
So this looks like the same issue reported in https://github.com/docker-library/wordpress/issues/256. I was able to work around this temporarily by running commands as the specific user ID
33, which is normally associated withwww-data, but is actuallyxfsin thecliimage.