This is a guide to set up a new WordPress installation running in Docker, with WP-CLI available for database management. The only prerequisite is Docker.
git clone git@github.com:hamishau/vagrant.wordpress.gitSearch for all instances of yourapp in docker-compose.yml and replace with your preferred project name. You may also want to update the site title, admin email, and admin password in the setup service command.
docker compose up -dWordPress is automatically installed during the first deploy. Once the containers are running, the site is available at http://localhost:8080. Log in at http://localhost:8080/wp-admin with the credentials configured in the setup service (default: admin / admin).
Containers are set to restart: "no" and will not start automatically on boot or Docker daemon restart. Use the commands below to manage them manually.
docker compose startdocker compose stopThese are not required as part of the deployment — just helpful commands for ongoing development.
docker compose run --rm --profile cli cli wp db export - --allow-root > yourapp.sqldocker compose run --rm --profile cli cli wp db import - --allow-root < yourapp.sqldocker compose run --rm --profile cli cli wp db reset --yes --allow-rootdocker compose run --rm --profile cli cli wp <command> --allow-rootdocker compose run --rm --profile cli cli wp cli update --allow-rootdocker compose down -v