-
Notifications
You must be signed in to change notification settings - Fork 1.1k
How to use bind volume with FS_METHOD direct on Windows? #982
-
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?
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 1 comment 1 reply
-
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.
Beta Was this translation helpful? Give feedback.
All reactions
-
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
Beta Was this translation helpful? Give feedback.