This example demonstrates how to set up a test environment for a Wordpress website with a custom theme. This can be very useful to test a theme in a staging environment and sharing it with other people.
See the complete example code on GitHub
services:db:image: mysql:5.7environment:- MYSQL_ROOT_PASSWORD=somewordpress- MYSQL_DATABASE=wordpress- MYSQL_USER=wordpress- MYSQL_PASSWORD=wordpresswordpress:dockerfile: Dockerfilepublic: trueport: 80environment:- WORDPRESS_DB_HOST=db:3306- WORDPRESS_DB_USER=wordpress- WORDPRESS_DB_PASSWORD=wordpress- WORDPRESS_DB_NAME=wordpressdepends_on:- db
This uses a custom Dockerfile which is using the default Wordpress image but also copies over a custom theme to the folder holding the themes in Wordpress.
FROM wordpress:latestCOPY theme /var/www/html/wp-content/themes/customtheme