Docker Configuration

WP Staging CLI generates Docker configuration files automatically when you create sites. This guide covers advanced configuration options and manual file generation.

Configuration Files

When you create a site, WP Staging CLI generates these files in ~/wpstaging/sites/<hostname>/:

Update Hosts File

Add or update entries in your system’s hosts file for local domain resolution:

Or use the short alias:

This command:

Note: This command requires elevated privileges (sudo on Linux/macOS, Administrator on Windows).

Generate Compose File

Regenerate the docker-compose.yml file for a specific site:

Or use the short alias:

Use this when you need to:

Generate Docker Files

Regenerate all Docker configuration files for a site:

Or use the short alias:

This regenerates:

SSL Certificate Management

WP Staging CLI uses mkcert to generate locally-trusted SSL certificates.

Reinstall Certificate

If you have certificate issues, regenerate the SSL certificate for a site:

Reinstall Certificate Authority

If certificates are not trusted by your browser, reinstall the mkcert CA to your system trust store:

Note: The --reinstall-ca flag requires elevated privileges to install the CA certificate in your system’s trust store.

View Site Configuration

Display the environment variables and configuration for a site:

This shows the parsed docker-compose.yml settings including:

Custom Environment Path

By default, all Docker environments are stored in ~/wpstaging. You can specify a custom path:

Then use the same path for all subsequent commands:

Custom Compose File Path

Specify a custom location for the docker-compose.yml file:

Port Configuration

If default ports conflict with other services, customize them when creating sites:

Flag Default Description
--http-port 80 Nginx HTTP port
--https-port 443 Nginx HTTPS port
--db-port 3306 MariaDB port
--mailpit-http-port 8025 Mailpit web interface port

IP Address Configuration

By default, sites use IP addresses in the 127.3.2.x range (loopback addresses). This allows multiple sites to run simultaneously on the same ports (80/443).

macOS IP Alias

On macOS, the CLI automatically creates IP aliases for addresses in the 127.3.2.x range. This requires sudo access.

Tip: To avoid repeated password prompts on macOS, set up passwordless sudo for the ifconfig command. See the FAQ for detailed instructions.

Configuration Commands Summary

Command Alias Description
update-hosts-file uhf Update hosts file with site entries
generate-compose-file gcf Regenerate docker-compose.yml
generate-docker-file gdf Regenerate all Docker config files
reinstall-cert Regenerate SSL certificate
compose-info Display site configuration

Directory Structure

The default environment directory structure:

Next Steps

Updated on January 27, 2026

Rene Hermenau

Author: Rene Hermenau

About the author: René Hermenau is the founder of WP STAGING. He works on WordPress backups, staging, migrations, database handling, and safe deployment workflows.