Easily set up a local development environment for your existing WordPress site using Docker. This solution is ideal for developing and testing in an environment that mirrors your live site.
- Docker and Docker Compose installed.
-
WordPress Container:
- Volumes:
site/wp-content: Place your productionwp-contentfolder here. It includes themes, plugins, uploads, etc. π¨
- Volumes:
-
Database (DB) Container:
- Volumes:
mysqldumps/backup.sql.gz: Put your production database snapshot here. It's imported automatically on first run. πinit/migrate.sh: URL migration script, runs automatically. π
- Volumes:
- Clone/Download: Get the project files. π¨βπ»
- Database Prep: Create a dump from the live database and save it as
mysqldumps/backup.sql.gz. ποΈ - Content Prep: Copy
wp-contentfrom your site tosite/wp-content. π - Configuration: Set variables in
.env. π - Run: In the project root, execute:
docker-compose up -d && docker exec -ti wordpress '/prep.sh'
Access your site at http://localhost and the admin panel at http://localhost/wp-admin. π
Enjoy a seamless and efficient development process for your WordPress site! π