WP Staging CLI provides commands to control Docker containers for your WordPress sites. This guide covers starting, stopping, restarting containers, checking status, and accessing shells.
Start Containers
Start containers for all sites:
Start containers for a specific site:
Alias: You can also use wpstaging up as an alternative to start.
Stop Containers
Stop containers for all sites:
Stop containers for a specific site:
Alias: You can also use wpstaging down as an alternative to stop.
Restart Containers
Restart containers for all sites:
Restart containers for a specific site:
Use restart when you’ve made configuration changes or if a site is not responding.
Check Container Status
View the status of all sites:
Example output:
Check status for specific sites:
Or multiple sites:
Access PHP Shell
Open an interactive shell in the PHP container (as the web server user):
Open a shell as root:
Once inside the shell, you have access to:
Example shell session:
Access Database Shell
Open an interactive shell in the MariaDB container:
Open as root:
This gives you direct access to the MySQL/MariaDB command line for database management.
Remove All Docker Data
Stop all containers and remove all Docker data (volumes, configurations, etc.):
Warning: This command removes everything – all sites, databases, uploaded files, and configurations. This action cannot be undone. You’ll be prompted for confirmation before proceeding.
Use this command when you want to completely clean up your Docker environment or before uninstalling WP Staging CLI.
Environment Path Flag
All container commands support the --env-path flag to specify a custom Docker environment location:
Default: ~/wpstaging
Command Summary
| Command | Alias | Description |
|---|---|---|
start [hostname] |
up |
Start containers |
stop [hostname] |
down |
Stop containers |
restart [hostname] |
– | Restart containers |
status [hostname...] |
– | Show container status |
shell <hostname> [root] |
– | PHP container shell |
shell-db <hostname> [root] |
– | Database container shell |
remove |
– | Remove all Docker data |