Quick links: Features | Installation | Usage | Contributing | Credits | Roadmap
Easily set up a local development environment that mirrors your existing WordPress site exported with the wp-migrate-db plugin using Docker and Docker Compose.
- Docker and Docker compose
- WP-Cli support
- Easy setup with wp-migrate-db plugin
- Wordpress and PHP versions and wp cli are installed manually (you can install specific versions if you can't find the correct tag at wordpress docker hub). You only need to set it up in the
.env
file - Custom wordpress entrypoint script (with wp-cli commands)
- Apache2 for wordpress setup
- Mysql for database setup
- phpmyadmin and adminer interface to interact with your database
Make sure you have the latest versions of Docker and Docker Compose installed on your machine.
- Docker and Docker Compose installed
- make
- zip/unzip
- git
- Install on your wordpress website the plugin named 'wp migrate lite' and export your website
- Clone/Download the project
- Place the zip file in the
zip/
folder - Copy the example environment into
.env
cp .env.example .env
- Edit the
.env
file to change the default environment variables - A
Makefile
will help you to place files at the right place in your project
make
Open a terminal and cd
to the folder in which docker-compose.yml
is saved and run :
docker compose up # use option '-d' for daemon mode
You can now access your site at http://localhost:3000
and the admin panel at http://localhost:3000/wp-admin
(port 3000 by default in env).
To access your database, you can use adminer
at http://localhost:8080
or phpmyadmin
at http://localhost:8081
.
docker compose down
Your wordpress database is persistent even after shutting down your containers, if you want to start from the original database you exported from wp migrate plugin, you need to delete the database
folder and restart your docker containers with docker compose.
sudo rm -r database
make clean
To see the build process in plain text for a specific image :
BUILDKIT_PROGRESS=plain docker compose up -d --no-deps --build wordpress
Inspecting your running db container health command (requires jq program ):
docker inspect db | jq '.[0].State.Health'
Feel free to open an issue in this github repository if you have any questions or want to see a feature implemented first.
- Project based on : https://github.com/lugosidomotor/DockerLocalWordPress
The idea of this project would be to make it a general docker-compose for wordpress, extend other configurations (nginx, mariadb...) and support other wordpress plugins that helps you migrate/backup your website for a local development environment with docker.
- Export db dump script
- Support nginx configuration
- Support mariadb (healthcheck, Dockerfile...)
- Redis cache?
- Https for local development (ssl certification)
- Add wp-cli bash completion, run wp-cli without root
- Themes development + update
- Custom php config (php.ini)
- Start as a new wordpress project
- Git wordpress versionning?
- WP Migrate : load docker compose config from
wpmigrate-export.json
?