Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

How to use bind volume with FS_METHOD direct on Windows? #982

Destroy666x started this conversation in General
Discussion options

services:
 wordpress:
 image: wordpress:6-php8.4
 depends_on:
 - db
 ports:
 - ${WP_PORT}:80
 environment:
 WORDPRESS_DB_HOST: ${DB_HOST}
 WORDPRESS_DB_NAME: ${DB_NAME}
 WORDPRESS_DB_USER: ${DB_USER}
 WORDPRESS_DB_PASSWORD: ${DB_PASSWORD}
 WORDPRESS_CONFIG_EXTRA: define('FS_METHOD','direct');
 WORDPRESS_DEBUG: 1
 volumes:
 - wordpress:/var/www/html
 restart: unless-stopped
 db:
 image: mysql:8
 environment:
 MYSQL_DATABASE: ${DB_NAME}
 MYSQL_USER: ${DB_USER}
 MYSQL_PASSWORD: ${DB_PASSWORD}
 MYSQL_RANDOM_ROOT_PASSWORD: 1
 volumes:
 - db:/var/lib/mysql
 restart: unless-stopped
volumes:
 wordpress:
 driver: local
 driver_opts:
 type: none
 device: .
 o: bind
 db:

results in Installation failed: Could not create directory. /var/www/html/wp-content/upgrade when trying to install a plugin through admin panel.

I found some workarounds for Linux, such as APACHE_RUN_USER, but they don't seem to work on Windows. How can I ensure proper permissions exist for the mounted directories in Windows?

Running sh -c "chown -R www-data:www-data /var/www/html" seems to fix it temprarily, is that the best solution that can be made permament through command? Or is there e.g. some way to do it through env vars?

You must be logged in to vote

Replies: 1 comment 1 reply

Comment options

Unfortunately, permissions issues with bind-mounting across the VM boundary from Windows is not unusual or unexpected. What I would suggest is that you use a named volume instead of a bind-mount to the VM host so that the directory contents stay inside the VM and standard Linux permissions can apply.

You must be logged in to vote
1 reply
Comment options

I prefer mounted volume to e.g. edit media files directly with system tools, I guess I'll go for executing the mentioned chown command every time then ifthere's nothing better

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /