Reputation: 51
I would like to use Docker for local development. When I create a container with Wordpress using Docker Compose, everything loads very quickly in the browser. It's much faster than using Local by Flywheel. The problem is that I do not have access to Wordpress files. To access these files, I added volumes to docker-compose.yml:
volumes:
- ./wp-content:/var/www/html/wp-content
I can access the files now, but everything loads so slowly in the browser that using Docker loses its meaning. Is it possible to speed it up in any way?
Upvotes: 5
Views: 4891
Reputation: 21
In Windows there is a big performance hit if you set bind mounts on the Windows file system and not on the WSL file system:
volumes:
- //wsl$/path-to/wp-content:/var/www/html/wp-content
"We recommend against working across operating systems with your files, ..... For the fastest performance speed, store your files in the WSL file system if you are working in a Linux..."
https://learn.microsoft.com/en-us/windows/wsl/setup/environment?source=recommendations
"Files can be accessed across the operating systems, but it may significantly slow down performance."
https://learn.microsoft.com/en-us/windows/wsl/setup/environment?source=recommendations#file-storage
Upvotes: 1
Reputation: 9137
The problem is about "consistency type" in volume. Set it up as "cached"
services:
wordpress:
...
volumes:
- ./data:/data
- ./scripts:/docker-entrypoint-initwp.d
#- ./wp-content:/app/wp-content
- type: bind
source: ./wp-content
target: /app/wp-content
consistency: cached
#- ./php-conf:/usr/local/etc/php
- type: bind
source: ./php-conf
target: /usr/local/etc/php
consistency: cached
Upvotes: 2