Run LocalWP-compatible zip files in Docker Compose — no LocalWP installation required.
- One-command start:
docker compose upautomatically imports your zip and starts WordPress. - One-click admin URL: a temporary magic-link login token is printed in the startup logs.
- Site URL & WP-Admin URL printed on every startup.
- Configurable PHP version (7.4 – 8.3+).
- Apache or nginx — switch with a single setting.
- Export back to LocalWP-compatible zip with
./export.sh. - Override support via
docker-compose.override.yml(Traefik, custom labels, etc.). - phpMyAdmin available out of the box at http://localhost:8081.
git clone https://github.com/reenhanced/localwp-docker-compose.git
cd localwp-docker-composeExport your site from LocalWP (Right-click site → Export), then copy the resulting
.zip into the import/ directory:
import/
└── my-site.zip ← place it here
The zip must follow the LocalWP export format:
my-site.zip
└── app/
├── public/ ← WordPress files
└── sql/
└── local.sql ← database dump
Edit .env to set your preferences:
| Variable | Default | Description |
|---|---|---|
COMPOSE_PROFILES |
apache |
Web server: apache or nginx |
PHP_VERSION |
8.2 |
PHP version (e.g. 7.4, 8.1, 8.3) |
LOCAL_URL |
http://localhost:8080 |
URL where the site will be served |
HTTP_PORT |
8080 |
Host port for HTTP traffic |
MYSQL_DATABASE |
wordpress |
WordPress database name |
MYSQL_USER |
wordpress |
MySQL user |
MYSQL_PASSWORD |
wordpress |
MySQL password |
MYSQL_ROOT_PASSWORD |
rootpassword |
MySQL root password |
docker compose upOn the first run the following happens automatically:
- MySQL starts and becomes healthy.
- The WordPress files from
import/*.zipare extracted into a persistent volume. - The SQL dump is imported into MySQL.
wp-config.phpis patched with the container's database credentials.siteurlandhomeinwp_optionsare updated toLOCAL_URL.- A one-click login URL is generated and printed to the console.
Subsequent docker compose up calls skip the import (idempotent lock file) and
just print the URLs before starting the web server.
After a successful start you will see something like:
╔══════════════════════════════════════════════════════════════════╗
║ LocalWP Docker Compose – Site Information ║
╠══════════════════════════════════════════════════════════════════╣
║ Site URL : http://localhost:8080/ ║
║ WP-Admin : http://localhost:8080/wp-admin/ ║
║ One-click login: http://localhost:8080/?localwp_autologin=... ║
╠══════════════════════════════════════════════════════════════════╣
║ phpMyAdmin : http://localhost:8081/ ║
╠══════════════════════════════════════════════════════════════════╣
║ Run './export.sh' to create an updated LocalWP-compatible zip ║
╚══════════════════════════════════════════════════════════════════╝
Click the One-click login URL to access WP-Admin without entering credentials. The token expires after one hour; restart the container to get a fresh URL.
Edit .env and set:
# Apache (default)
COMPOSE_PROFILES=apache
# nginx + PHP-FPM
COMPOSE_PROFILES=nginxThen rebuild and restart:
docker compose up --buildNote: switching web servers for the first time requires
--buildso Docker creates the correct image. Subsequent starts with the same profile do not need--build.
Edit .env:
PHP_VERSION=8.3Then rebuild:
docker compose up --buildSupported tags mirror those on Docker Hub for the wordpress image:
7.4, 8.0, 8.1, 8.2, 8.3, etc.
Update LOCAL_URL in .env (and add the hostname to /etc/hosts if needed):
LOCAL_URL=http://mysite.testIf you are mapping a custom hostname, add it to your hosts file:
127.0.0.1 mysite.test
Copy the example and customise it:
cp docker-compose.override.yml.example docker-compose.override.ymldocker-compose.override.yml is automatically merged by Docker Compose and is
excluded from version control by .gitignore.
Generate an updated LocalWP-compatible zip from the running site:
./export.sh
# or specify an output path:
./export.sh /tmp/my-site-backup.zipThe resulting zip can be imported back into LocalWP or any other tool that
understands the app/public + app/sql/local.sql format.
# Stop (preserve data volumes)
docker compose down
# Stop and delete all data (volumes, images)
docker compose down -v --rmi local| Symptom | Fix |
|---|---|
| No zip found on startup | Copy your *.zip into import/ and run docker compose up |
| Site URL wrong after import | Update LOCAL_URL in .env and delete the lock file: docker compose run --rm wordpress rm /var/www/html/.localwp-docker-init-done, then restart |
| Plugin/theme updates fail | Ensure the wp_data volume has write access (runs as www-data) |
| One-click URL not working | The token expired (1 hour); restart the container to generate a new one |
| Rebuild not picking up PHP version change | Run docker compose up --build |