WordPress Docker
A WordPress installation using Docker, Traefik & mkcert.
Presentation
This is a WordPress installation method using Docker, Traefik & mkcert for local usage. It allows you to install WordPress locally while having https
access.
Requirements
On Manjaro Linux, you can install them with pacman
.
sudo pacman -S docker docker-compose mkcert
Installation
- Clone the repo.
- You can delete
.git
,.gitignore
,keepachangelog.hbs
andpackage.json
. - Fill the dotenv files (at least
DWP_DOMAIN_NAME
) - Generate a certificate with mkcert & save it in
certs
folder. - Replace the certificate name in
/traefik/ssl.yml
. - On Linux, use ACLs on
/wp-content
Find the details below for the use of mkcert and the management of ACLs.
Mkcert
Once installed, create a new local CA:
mkcert -install
Then, generate a new certificate:
mkcert -cert-file ./certs/your-domain.tld.pem -key-file ./certs/your-domain.tld-key.pem your-domain.tld "*.your-domain.tld"
Consider replacing your-domain.tld
.
ACLs
To keep write permissions while giving them to Apache, you must use ACLs. Otherwise you will be asked for FTP access to add plugins via the administration or to use the import for example.
sudo setfacl -Rm user:yourUsername:rwx wp-content
sudo setfacl -Rdm user:yourUsername:rwx wp-content
sudo setfacl -Rm user:http:rwx wp-content
sudo setfacl -Rdm user:http:rwx wp-content
Consider replacing yourUsername
. On Manjaro, the Apache user is http
, you may need to replace it on another distribution.
Usage
docker-compose up -d
Then, you can access:
- WordPress at
www.your-domain.tld
- Traefik dashboard at
traefik.your-domain.tld
- PHPMyAdmin at
pma.your-domain.tld
Disclaimer
I have not tested this method on Windows or Mac. The step regarding ACLs is probably different.
This method is for local use for development purposes. It should not be used in production.
License
This project is open source and available under the MIT License.