Table of Contents
Easy local WordPress developement environment using Docker Compose.
- Docker containers for:
.env.example
template for easy project config using a.env
file- custom nginx config for:
- custom development domain (e.g. myapp.test)
- redirecting HTTP requests to HTTPS
- proxying missing images & static files from a production site
- Shell scripts for:
- creating TLS/SSL certificate (signed by local CA)
- importing a MySQL database dump
-
Grab the Repo - first clone or download this repository to your computer.
-
Initial Project Configuration - before actually running anything in Docker, be sure to first:
- Set environment variables - copy the
.env.example
file into a.env
file in the project root and update the values to suit your project. - Update
/etc/hosts
file - add entry for custom development domain to/etc/hosts
file (e.g.127.0.0.1 mysite.test
) either using providedadd-hosts-entry.sh
script or by manually editing the file directly. - Generate TLS/SSL certificates - use the provided
setup-certs.sh
script to automatically create certificates needed to enforce HTTPS.
- Set environment variables - copy the
-
Start Docker - now we're ready to actually start Docker and run our containers using Docker Compose:
docker compose up -d
-
Import a Database (Optional) - optionally, you can import an existing database by placing the exported database file in the
/config/database
directory (see/config/database/README.md
for expected filename format) and then running the providedimport-db.sh
script.- alternatively, you can also use the
docker exec
command to import a database file, see Docker reference page fordocker exec
command more info.
- alternatively, you can also use the
-
Visit Local Development Site - if everythings working as expected, you should be able to visit your new Docker power local WordPress installation by visiting the domain you specified in your project's
.env
file.
Stoping Docker - when you're finished working, to stop running containers use:
docker compose down
Starting Docker - to start Docker containers back up, run:
docker compose up -d