Table of Contents
Easy local WordPress developement environment using Docker Compose.
- Docker containers for:
.env.exampletemplate for easy project config using a.envfile- 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.examplefile into a.envfile in the project root and update the values to suit your project. - Update
/etc/hostsfile - add entry for custom development domain to/etc/hostsfile (e.g.127.0.0.1 mysite.test) either using providedadd-hosts-entry.shscript or by manually editing the file directly. - Generate TLS/SSL certificates - use the provided
setup-certs.shscript 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/databasedirectory (see/config/database/README.mdfor expected filename format) and then running the providedimport-db.shscript.- alternatively, you can also use the
docker execcommand to import a database file, see Docker reference page fordocker execcommand 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
.envfile.
Stoping Docker - when you're finished working, to stop running containers use:
docker compose downStarting Docker - to start Docker containers back up, run:
docker compose up -d