10up / wp-local-docker

****** WP Local Docker V2 is now available - https://github.com/10up/wp-local-docker-v2
MIT License
749 stars 152 forks source link

WP CLI cannot create local cache inside Docker Container #107

Closed JodiWarren closed 6 years ago

JodiWarren commented 6 years ago

When running ./bin/setup.sh the following error can be observed: Warning: Failed to create directory '/var/www/.wp-cli/cache/': mkdir(): Permission denied.

This is because /var/www is owned by root and has drwxr-xr-x permissions, whereas WP CLI is being run as www-data

Off the top of my head, there are two solutions:

I'm no sysadmin though!

FWIW this doesn't seem to be actually causing any problems, this is entirely in service to making the error message go away.

tlovett1 commented 6 years ago

@JodiWarren what operating system is this?

pattonwebz commented 6 years ago

This same thing happens for me on Ubuntu 18.04

JodiWarren commented 6 years ago

@tlovett1 I'm on MacOS 10.13.3, using Docker 18.03.1-ce-mac65.

tlovett1 commented 6 years ago

@cmmarslender mind taking a look?

cmmarslender commented 6 years ago

This message has been showing up when using WP-CLI to install WP inside the containers for a while, but it shouldn't actually break anything. I believe the only impact is that we can't cache a copy of the archive of WordPress inside the container, but since its installed once, and then persisted to the filesystem outside of the container and the cache would be deleted once the container was turned off anyways, it was never high on the priority list to fix.

I can look into fixing the message at some point, but it shouldn't be breaking anything in the meantime :)

tlovett1 commented 6 years ago

@cmmarslender that would be great. Thanks

cmmarslender commented 6 years ago

This was fixed in https://github.com/10up/wp-local-docker-images/commit/348f9ef4d6df9a7dacb637026bfa6963dc105b92

You'll need to docker pull 10up/phpfpm:latest to get the latest image that has the directory present.

So far, 7.2/latest are done building, and the rest are in queue.