I created a setup for a wordpress installation with docker-compose:
version: '3'
services:
db:
image: mysql:8.0
container_name: db
restart: unless-stopped
env_file: .env
volumes:
- dbdata-dev:/var/lib/mysql
command: '--default-authentication-plugin=mysql_native_password'
networks:
- rn-dev-network
wordpress:
depends_on:
- db
image: wordpress:5.5.3-fpm-alpine
container_name: wordpress
restart: unless-stopped
env_file: .env
environment:
- WORDPRESS_DB_HOST=db:3306
- WORDPRESS_DB_USER=$MYSQL_USER
- WORDPRESS_DB_PASSWORD=$MYSQL_PASSWORD
- WORDPRESS_DB_NAME=$MYSQL_DATABASE
volumes:
- ./wordpress/wp-content:/var/www/html/wp-content
- ./wordpress/uploads.ini:/usr/local/etc/php/conf.d/uploads.ini
- wordpress-dev:/var/www/html
networks:
- rn-dev-network
webserver:
depends_on:
- wordpress
image: nginx:1.15.12-alpine
container_name: webserver
restart: unless-stopped
ports:
- "80:80"
volumes:
- wordpress-dev:/var/www/html
- ./nginx-conf:/etc/nginx/conf.d
networks:
- rn-dev-network
volumes:
wordpress-dev:
dbdata-dev:
networks:
rn-dev-network:
driver: bridge
Via FTP, I moved a theme into the wp-content/themes folder. The theme shows up on wordpress when starting the container, but it does not show any preview picture and is missing all pictures/assets when loading it.
I don't see what is missing. When I ssh into the container and check the folder, the volume is correctly linked and the wordpress theme is showing up in the correct folder.
You need to mount the image file to the nginx container, because static content is served via the nginx container. The Php container only executes the php.
webserver:
depends_on:
- wordpress
image: nginx:1.15.12-alpine
container_name: webserver
restart: unless-stopped
ports:
- "80:80"
volumes:
- wordpress-dev:/var/www/html
- ./wordpress/wp-content:/var/www/html/wp-content
- ./nginx-conf:/etc/nginx/conf.d
networks:
- rn-dev-network
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.