wordpress:cli container is not able to manipulate files

Created on 2 Feb 2018  路  4Comments  路  Source: docker-library/wordpress

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.

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 with www-data, but is actually xfs in the cli image.

docker-compose run -u 33 ...

All 4 comments

馃憤 Having the same exact problem myself in the same environment.

Seems like UIDs (numbers that stand behind linux user names) are out of sync, more details here, here and here.

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.

Was this page helpful?
0 / 5 - 0 ratings