dingo-d / wordpress-docker
A blueprint Docker config used for WordPress development on Docker with SSL on latest PHP version
Installs: 0
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 1
Forks: 5
Open Issues: 1
Language:Makefile
Type:docker-template
pkg:composer/dingo-d/wordpress-docker
Requires
- php: >=7.0
This package is auto-updated.
Last update: 2025-10-26 05:36:20 UTC
README
WordPress on Docker
A blueprint Docker configuration used for WordPress development on Docker.
This is a repository for testing out working with WordPress on Docker. You can use it as a base for your project, to play and to use as you wish.
📚 Table of contents
🎒 Requirements
Optional
🚀 Development setup
Development is done locally, using Docker for quick starting the application. In order to start working on the app, once you've cloned the repository locally you should use the make command. This will:
- Copy the
.env.exampleto.env - List all the useful commands you might want to use for kick-starting your project
You'll need to fill the created .env file with the necessary data.
SSL setup
This setup uses locally self signed SSL certificate to make your site run on HTTPS. In order to enable the SSL locally you'll need to set it up first.
Add the value of the APP_HOST variable from the .env file to you hosts file using vim, nano or what ever editor you like. The following is an example how to add it on MacOS using terminal
sudo nano /etc/hosts
Then add
0.0.0.0 APP_HOST GOES HERE
And save it. On Windows, the hosts is located in C:\windows\system32\drivers\etc\hosts.
Generate an openssl key/cert pair from your development folder:
make create-certificate
You will have to fill in the following questions;
* Country Name (2 letter code) * State or Province Name (full name) * Locality Name (eg, city) * Organization Name (eg, company) * Organizational Unit Name (eg, section) * Common Name (eg, fully qualified host name) -> APP_HOST * Email Address
Once this is done, you should have 2 files in the config/certs folder
APP_HOST.crt APP_HOST.key
Add the .crt file to your keychain access and change the Trust settings to Always Trust (on MacOS).
WordPress setup
Before starting the docker up, you'll need to copy the wp-config.php.tmpl to wp-config.php, and ngixn.conf.tmpl to ngixn.conf. If you have set up the .env file type
make copy-configs
You can test if everything is set up correctly for your docker-compose.yml with
make docker-config
This will prefill all the values with environment variables from .env file and resolve the paths.
After all has been set up in the environment file run
make docker-build
This will create the containers for the app. To run them (in a detached state) you need to type
make docker-up
Production settings
Some settings like nginx.conf and php.ini (especially the opcache settings) need to be modified for production. You should coordinate with your devops when working on production environment.
:bullseye: Additional services
You can add additional services in your docker-compose.yml if you want to. The .env.example contains the environment variables for redis and mailhog services. To use them, add them to your docker-compose.yml file under services like
redis: image: redis container_name: ${REDIS_CONTAINER_NAME} environment: REDIS_SCHEME: ${REDIS_SCHEME} REDIS_HOST: ${REDIS_HOST} REDIS_PORT: ${REDIS_PORT} expose: - ${REDIS_PORT} ports: - ${REDIS_PORT}:${REDIS_PORT} mailhog: image: mailhog/mailhog container_name: docker-mailhog ports: - "${MAILHOG_HOST_PORT_SMTP}:1025" - "${MAILHOG_HOST_PORT_WEB}:8025"
📜 License
WordPress on Docker is free software, and may be redistributed under the terms specified in the LICENSE file. Copyright ©2019