Skip to content

Latest commit

 

History

History
executable file
·
79 lines (50 loc) · 1.63 KB

File metadata and controls

executable file
·
79 lines (50 loc) · 1.63 KB

Introduction

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.

Clone Repository

git clone git@github.com:hamishau/vagrant.wordpress.git

Project Name

Edit .env to set the database name, credentials, port, site title, and admin login.

Deploy

docker compose up -d

WordPress 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.

Start / Stop

Start containers

docker compose start

Stop containers

docker compose stop

Post Installation

These are not required as part of the deployment — just helpful commands for ongoing development.

Export Database

docker compose run --rm cli wp db export - --allow-root > yourapp.sql

Import Database

docker compose run --rm cli wp db import - --allow-root < yourapp.sql

Reset Database

docker compose run --rm cli wp db reset --yes --allow-root

Run Any WP-CLI Command

docker compose run --rm cli wp <command> --allow-root

Update WP-CLI

docker compose run --rm cli wp cli update --allow-root

Destroy Everything (including database)

docker compose down -v