Docker based development environment for WordPress- Includes Caddy, MariaDB, PHP, Memcached, Mailhog and Adminer.
WPDev creates a full development environment for WordPress containing:
- NGINX
- MariaDB
- Redis
- PHP (5.3 / 7.4 / 8.0 / 8.1 / 8.2)
- Mailhog
You can easily customize this further by editing the docker-compose.yml
file yourself.
The easiest way to use this is by cloning it into a directory for each site you want.
git clone https://github.com/PeterBooker/wpdev.git dir-name
Next, copy .env.example
to .env
and customize the environment variables, adding in the local domain you want to use. Make sure the domain you use is added to your local hosts file.
If you want to use HTTPS then you can overwrite the certs in .docker/config/certs
with your own (Note: mkcert is a great tool.)
Next, from the newly created directory, start up the Docker containers:
docker-compose up -d
During startup WordPress will be installed if needed. Once running you can access WordPress at general.dev
and Mailhog at mailhog.general.dev
. WordPress files are persisted to /.docker/wordpress/
and DB files to /.docker/data/db/
.
If you want to use an existing WordPress repository, you can symlink it into /.docker/wordpress/
.
Finally, to stop and remove all the containers:
docker-compose down
- Add convenience scripts for DB backups, DB imports, adding domains to hosts file and generating SSL certs.
Licensed under MIT.