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.gitEdit .env to set the database name, credentials, port, site title, and admin login.
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 cli wp db export - --allow-root > yourapp.sqldocker compose run --rm cli wp db import - --allow-root < yourapp.sqldocker compose run --rm cli wp db reset --yes --allow-rootdocker compose run --rm cli wp <command> --allow-rootdocker compose run --rm cli wp cli update --allow-rootdocker compose down -v