I have Wordpress running inside Docker, for local development, and it's super slow. My docker-compose.yml looks like this:
version: '3.3'
services:
db:
image: mysql:5.7
volumes:
- ./db_data:/var/lib/mysql
- ./dbconfig.cnf:/etc/mysql/conf.d/custom.cnf
restart: always
ports:
- "3308:3306"
environment:
MYSQL_ROOT_PASSWORD: root_password
MYSQL_DATABASE: wp_database
MYSQL_USER: db_user
MYSQL_PASSWORD: some_secure_password
wordpress:
depends_on:
- db
image: wordpress:latest
ports:
- "80:80"
- "443:443"
restart: always
volumes:
- ./wp-content:/var/www/html/wp-content
- ./.htaccess:/var/www/html/.htaccess
- ./wp-config.php:/var/www/html/wp-config.php
- ./logs/debug.log:/var/www/html/wp-content/debug.log
volumes:
db_data: {}
wp_content: {}
As far as I read online, it might be the reason I am mounting the wp-content
volume, which causes super slow page loading (takes like half a second to load each file, e.g. a jquery file, and it has to load a ton of files for one page).
Is there a solution for this? I read about NFS, but it didn't work for me to configure NFS with docker-compose, somehow I keep getting "permission errors". On the other hand, the Docker interface of macOS already shows me a "Shared folder" tab but I don't know whether I am using those shared folders at the moment or just mounting them again.
Any help is appreciated.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…